Claude Managed Agents

When a Claude Managed Agents session stops for a tool confirmation, a named person decides it in Deliverd, hosted or self-hosted.

Claude Managed Agents is Anthropic's service for running agents: the agent loop, sandboxes, credentials and session history. It can now also be self-hosted, with the whole service running in your own cloud or data centre. Either way, a permission policy of always_ask stops a session before a tool call runs and waits for an answer. Deliverd makes that answer come from a named person, from the email, Slack or Teams, with a record of who decided and why.

How it works

  1. The agent calls a tool whose policy is always_ask. The session emits the call as agent.tool_use or agent.mcp_tool_use with evaluated_permission: "ask", and pauses with session.status_idle and stop_reason.type: "requires_action".
  2. The watcher, running next to your applications, finds the paused session and asks Deliverd about each held call: the tool, the MCP server it is on, and its input, field by field.
  3. The approver decides. A yes is sent as user.tool_confirmation with result: "allow" and the call runs. A no is sent with result: "deny" and the person's reason as the deny_message, which the model reads.
  4. Each call is one request, keyed by its event id, so a watcher that restarts finds the request it already made instead of asking twice.

Set it up

  1. 1

    Hold the calls that matter

    In the agent's definition, set permission_policy: always_ask on the tools a person must see first: per tool with configs, or for a whole toolset with default_config. MCP toolsets ask by default. Running sessions keep the policy they started with, so new sessions pick up the change.

  2. 2

    Get an agent key

    Create an agent in Deliverd (Agents → your agent → Keys) and set DELIVERD_API_KEY to its key where the watcher runs. Use an agent key, not a personal one, so the person who started the agent can still approve.

  3. 3

    Run the watcher

    Install @deliverd/sdk or deliverd (Python) and start one of the watchers below as a long-running process. On a self-hosted server, point ANTHROPIC_BASE_URL at your server and set ANTHROPIC_API_KEY to its server API key.

The agent

name: Ops agent
model: claude-opus-5-5
mcp_servers:
  - type: url
    name: github
    url: https://mcp.example.com/github
tools:
  - type: agent_toolset_20260401
    default_config:
      permission_policy:
        type: always_allow
    configs:
      - name: bash
        permission_policy:
          type: always_ask
  - type: mcp_toolset
    mcp_server_name: github
    # MCP toolsets ask by default; written out so nobody changes it by accident.
    default_config:
      permission_policy:
        type: always_ask

The watcher (TypeScript)

import Anthropic from "@anthropic-ai/sdk";
import { Deliverd } from "@deliverd/sdk";
import { watchManagedAgentSessions } from "@deliverd/sdk/adapters";

// Self-hosted: ANTHROPIC_BASE_URL is your server, ANTHROPIC_API_KEY its API key.
// Hosted: leave ANTHROPIC_BASE_URL unset and use your Claude API key.
const client = new Anthropic();

await watchManagedAgentSessions(client, {
  deliverd: new Deliverd(), // reads DELIVERD_API_KEY: use an agent key
  approvers: ["platform-team"],
  onError: (err, sessionId) => console.error(sessionId, err),
});

The watcher (Python)

from anthropic import Anthropic
from deliverd import Deliverd
from deliverd.adapters.managed_agents import watch_sessions

# Self-hosted: ANTHROPIC_BASE_URL is your server, ANTHROPIC_API_KEY its API key.
watch_sessions(
    Anthropic(),
    Deliverd(),  # reads DELIVERD_API_KEY: use an agent key
    approvers=["platform-team"],
    on_error=lambda err, session_id: print(session_id, err),
)

If your code already follows a session's stream, answer it there instead: followManagedAgentSession (TypeScript) or follow_session (Python) answers each pause until the turn ends. For a loop of your own, answerManagedAgentConfirmations / answer_tool_confirmations does one pass over one session.

Following one session

from deliverd.adapters.managed_agents import follow_session

# Open the stream before you send the message that starts the turn.
follow_session(client, session.id, Deliverd(), approvers=["platform-team"])

Self-hosted servers

  • No webhooks. A self-hosted server sends none, so the watcher polls for idle sessions, every five seconds by default (interval). Against Anthropic's hosted API it works the same way.
  • Waiting costs nothing. A paused session waits indefinitely. The watcher waits on a person for at most ten seconds per call each pass (timeout), so one slow decision never holds up another session, and an undecided call is picked up again next pass from the same request.
  • What leaves your network. For each held call, the watcher sends Deliverd the tool's name, its MCP server, its input and the session id. Session history, credentials and sandboxes stay on your servers. The watcher needs to reach your Managed Agents server and Deliverd, nothing else.
  • Only held calls are answered. Calls the server marks allow (including a worker's own tools on a self-hosted environment) or deny are left alone, and so are custom tools, which run in your application: call deliverd.approve() there before running one.

What the approver can answer

DecisionSent to the sessionWhat the agent sees
Approvedresult: "allow"The call runs.
Declinedresult: "deny", deny_messageThat a person declined it, who, their reason, and not to retry it.
Approved with changesresult: "deny", deny_messageThat it was not run as proposed, and the approved values, so it can call again with them. A confirmation cannot carry corrected input.
Undecided before timeoutNothing yetNothing: the session stays paused, and the next pass asks again from the same request.
Expired or withdrawnresult: "deny", deny_messageThat nobody decided in time, so it was not run.

Options

OptionWhat it does
approversWho decides: people, teams or groups. Your organisation's admins when omitted.
whenWhich held calls go to a person. Every one by default. A call when leaves out is allowed, so use it to narrow, not to widen.
describeWhat the approver reads. Built from the tool, its server and its input when omitted.
actions (Python)Maps a tool to a gate action, so your policy can allow or deny it before a person is asked.
timeout, expiresIn / expires_inHow long one pass waits on a person (ten seconds in the watcher), and how long the request stays open (one hour).
agentId / agent_idWatch one agent's sessions only.
intervalTime between the watcher's passes. Five seconds by default.
flowId, metadataPut each ask on a flow's timeline, or tag it for your own records. The session id is added to the metadata.

Or let the agent ask

The watcher answers calls the platform holds. An agent can also ask for itself, before it acts, through the Deliverd MCP server: request_approval for a person, check_gate for your policy. Add it to the agent like any MCP server.

mcp_servers:
  - type: url
    name: deliverd
    url: https://deliverd.dev/api/mcp
tools:
  - type: agent_toolset_20260401
  - type: mcp_toolset
    mcp_server_name: deliverd
    # Asking a person is the point of these tools, so they run without a second confirmation.
    default_config:
      permission_policy:
        type: always_allow

A self-hosted server connects only to MCP hosts listed in its settings, and rejects mcp_oauth vault credentials because it cannot refresh them. List the host, and store an agent key as a static_bearer vault credential for the server's URL. Replace it before the key expires.

mcp:
  allowed_hostnames:
    - deliverd.dev

More on the SDKs is in SDKs. Anthropic's own pages: permission policies, self-hosted Managed Agents and what differs when self-hosted.

Try it on your own agent.

Free to start, no card. Sign up with Google, Microsoft or GitHub, and the first page after hands you an API key.