Claude Managed Agents · MCP
Give your Managed Agent a phone
Your agent can do a lot in its sandbox. It can't pick up a phone. Connect it to KaiCalls and it can call a business, ask a question, and tell you what they said. It can send a text, and read the calls and texts your line took while nobody was looking.
- Your KaiCalls key goes in a vault. The agent never sees it.
- The agent reaches KaiCalls through our MCP server.
- Every call and text waits for your yes. Reading runs on its own.
New to Managed Agents? Anthropic hosts the agent loop and its sandbox for you. It is in beta. Read Anthropic's overview.
Step 1
Get a line and a key
Your agent calls from a KaiCalls line, so it needs one first.
- Get a line. It takes about three minutes.
- Open Settings → Developer Platform, press Create key, and tick the permissions on the right. The key starts with
kc_live_and is shown once. - Get a Claude API key from the Claude Console.
export ANTHROPIC_API_KEY=your_claude_api_key
export KAICALLS_API_KEY=kc_live_your_key_here
pip install anthropicTick these when you make the key
agents:readcalls:readcalls:writesms:readsms:write
Leave the rest off. The agent can do only what the key allows.
Step 2
Connect the agent
Run this once. It makes three things and prints their ids. Save them; every run uses them.
- A vault holding your KaiCalls key as a bearer token for
https://www.kaicalls.com/api/mcp. Anthropic adds it to each request on the way out, so it never sits in the sandbox or the chat history. - An environment whose network is closed except for the agent's MCP servers.
- The agent, with only the KaiCalls tools it needs turned on. Reading tools run on their own.
make_call,send_call_noteandsend_smspause the session until you say yes. It also gets a shell, so it can wait between checks while a call runs.
Want it to call without asking? Change those three to {"type": "always_allow"}. Do that only when you trust every task it will get.
import os
import anthropic
client = anthropic.Anthropic() # reads ANTHROPIC_API_KEY
KAICALLS_MCP = "https://www.kaicalls.com/api/mcp"
# 1. Put your KaiCalls key in a vault. The agent never sees it.
vault = client.beta.vaults.create(display_name="KaiCalls")
client.beta.vaults.credentials.create(
vault.id,
display_name="KaiCalls API key",
auth={
"type": "static_bearer",
"mcp_server_url": KAICALLS_MCP,
"token": os.environ["KAICALLS_API_KEY"],
},
)
# 2. A workspace that can reach its MCP servers and nothing else.
environment = client.beta.environments.create(
name="kaicalls-phone",
config={
"type": "cloud",
"networking": {"type": "limited", "allow_mcp_servers": True},
},
)
# 3. The agent. Reads run on their own; calls and texts wait for your yes.
agent = client.beta.agents.create(
name="Agent with a phone",
model="claude-opus-5-5",
system=(
"You can place phone calls and send texts through the KaiCalls tools. "
"To make a call, use make_call with the number and what to find out. "
"While a call runs, run sleep 30 between check_call_status reads. "
"When it ends, report what the business said, in plain words."
),
mcp_servers=[{"type": "url", "name": "kaicalls", "url": KAICALLS_MCP}],
tools=[
{
"type": "agent_toolset_20260401",
"default_config": {"enabled": False},
"configs": [
{"name": "bash", "enabled": True, "permission_policy": {"type": "auto"}},
],
},
{
"type": "mcp_toolset",
"mcp_server_name": "kaicalls",
"default_config": {"enabled": False},
"configs": [
{"name": "list_agents", "enabled": True, "permission_policy": {"type": "always_allow"}},
{"name": "check_call_status", "enabled": True, "permission_policy": {"type": "always_allow"}},
{"name": "get_transcript", "enabled": True, "permission_policy": {"type": "always_allow"}},
{"name": "get_inbox", "enabled": True, "permission_policy": {"type": "always_allow"}},
{"name": "list_recent_calls", "enabled": True, "permission_policy": {"type": "always_allow"}},
{"name": "list_sms_messages", "enabled": True, "permission_policy": {"type": "always_allow"}},
{"name": "make_call", "enabled": True, "permission_policy": {"type": "always_ask"}},
{"name": "send_call_note", "enabled": True, "permission_policy": {"type": "always_ask"}},
{"name": "send_sms", "enabled": True, "permission_policy": {"type": "always_ask"}},
],
},
],
)
print(f"AGENT_ID={agent.id}")
print(f"ENVIRONMENT_ID={environment.id}")
print(f"VAULT_ID={vault.id}")
Step 3
Give it a call to make
Put the three ids from step 2 in AGENT_ID, ENVIRONMENT_ID and VAULT_ID. Then run the script with a task in plain words:
python call.py "Call the bakery at +1 555 010 0142. Ask if they can do a sheet cake for 30 people this Saturday."Here is what happens:
- The agent asks to run
make_calland shows you the number and the question. You typey. - Kai places the call from your line and asks. To a state where everyone on a call must know it is recorded, Kai says so first.
- The agent reads
check_call_statuswhile the call runs. When it ends, it tells you what the business said.
Kai checks calling hours, your do-not-call list and opt-outs before it dials. If a rule stops a call, the agent gets the reason back. See every check. You still need permission to call or text a person.
import os
import sys
import anthropic
client = anthropic.Anthropic()
task = sys.argv[1] if len(sys.argv) > 1 else (
"Call the hardware store at +1 555 010 0199. Ask if they have a 3/4 inch "
"PEX crimp tool in stock and what it costs. Tell me what they said."
)
session = client.beta.sessions.create(
agent=os.environ["AGENT_ID"],
environment_id=os.environ["ENVIRONMENT_ID"],
vault_ids=[os.environ["VAULT_ID"]],
title="Phone task",
)
# Open the stream first, then send the task.
with client.beta.sessions.events.stream(session.id) as stream:
client.beta.sessions.events.send(
session.id,
events=[{"type": "user.message", "content": [{"type": "text", "text": task}]}],
)
for event in stream:
if event.type == "agent.message":
for block in event.content:
if block.type == "text":
print(block.text, end="", flush=True)
elif event.type == "agent.mcp_tool_use" and event.evaluated_permission == "ask":
print(f"\n\nThe agent wants to run {event.name}:\n{event.input}")
yes = input("Allow it? [y/N] ").strip().lower() == "y"
client.beta.sessions.events.send(
session.id,
events=[
{
"type": "user.tool_confirmation",
"tool_use_id": event.id,
"result": "allow" if yes else "deny",
}
],
)
elif event.type == "session.status_idle":
if event.stop_reason.type != "requires_action":
break
elif event.type == "session.status_terminated":
break
print()
Step 4
Calls that come in
Your line answers its own calls. When you can't pick up, Kai answers, takes the message, and saves the call. The agent doesn't have to be running for that.
When the agent runs, it can catch up. get_inbox returns the calls, voicemails, texts and callbacks since a time you pick. get_transcript reads any call in full.
Want it to happen on its own? Run the same agent on a schedule with Anthropic's scheduled deployments, with a task like "What came in overnight? Draft a reply to each caller."
python call.py "What did I miss since yesterday at 5pm?"
python call.py "Did anyone call about a refund this week? Read me the transcript."
python call.py "Text +1 555 010 0177 from my line: Your order is ready for pickup."Step 5
The tools it gets
The setup turns on these nine. The KaiCalls MCP server has many more, like buying a number or changing what your line says. Add a tool by its name to the configs list when you need it.
| Tool | What it does | Runs |
|---|---|---|
list_agents | Finds your line and its id. | On its own |
check_call_status | Shows a call while it runs, with the latest lines said, then the result. | On its own |
get_transcript | Reads the whole call once it ends. | On its own |
get_inbox | Calls, voicemails, texts and callbacks since a time you pick. | On its own |
list_recent_calls | Searches past calls by number, words or date. | On its own |
list_sms_messages | Reads the texts on your line. | On its own |
make_call | Calls a number and asks what the agent needs to know. | After your yes |
send_call_note | Passes Kai a new instruction while a call is live. | After your yes |
send_sms | Sends a text from your line. | After your yes |
Using Claude Desktop, ChatGPT or another chat app instead? Add KaiCalls as a connector. Building your own loop on the Messages API? The same server works; see agent discovery.