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
- The agent calls a tool whose policy is
always_ask. The session emits the call asagent.tool_useoragent.mcp_tool_usewithevaluated_permission: "ask", and pauses withsession.status_idleandstop_reason.type: "requires_action". - 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.
- The approver decides. A yes is sent as
user.tool_confirmationwithresult: "allow"and the call runs. A no is sent withresult: "deny"and the person's reason as thedeny_message, which the model reads. - 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
Hold the calls that matter
In the agent's definition, set
permission_policy: always_askon the tools a person must see first: per tool withconfigs, or for a whole toolset withdefault_config. MCP toolsets ask by default. Running sessions keep the policy they started with, so new sessions pick up the change. - 2
Get an agent key
Create an agent in Deliverd (Agents → your agent → Keys) and set
DELIVERD_API_KEYto 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
Run the watcher
Install
@deliverd/sdkordeliverd(Python) and start one of the watchers below as a long-running process. On a self-hosted server, pointANTHROPIC_BASE_URLat your server and setANTHROPIC_API_KEYto 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_askThe 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) ordenyare left alone, and so are custom tools, which run in your application: calldeliverd.approve()there before running one.
What the approver can answer
| Decision | Sent to the session | What the agent sees |
|---|---|---|
| Approved | result: "allow" | The call runs. |
| Declined | result: "deny", deny_message | That a person declined it, who, their reason, and not to retry it. |
| Approved with changes | result: "deny", deny_message | That 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 timeout | Nothing yet | Nothing: the session stays paused, and the next pass asks again from the same request. |
| Expired or withdrawn | result: "deny", deny_message | That nobody decided in time, so it was not run. |
Options
| Option | What it does |
|---|---|
approvers | Who decides: people, teams or groups. Your organisation's admins when omitted. |
when | Which 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. |
describe | What 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_in | How long one pass waits on a person (ten seconds in the watcher), and how long the request stays open (one hour). |
agentId / agent_id | Watch one agent's sessions only. |
interval | Time between the watcher's passes. Five seconds by default. |
flowId, metadata | Put 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_allowA 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.devMore 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.