1. Create the agent
Define the model, system prompt, tools, MCP servers, and skills once. Anthropic treats the agent definition as a reusable object you reference by ID later.
Use this guide to build the first working Managed Agents session without mixing up agents, environments, sessions, and event streams.
Last updated
2026-04-12
If these prerequisites are missing, the first session usually fails in ways that look mysterious but are actually configuration gaps.
Create a Claude Console account and an API key before you touch the session endpoints.
Use the managed-agents-2026-04-01 beta header on direct API calls. The SDK adds it for you.
Decide which model, prompt, and tool scope belong in the first agent before you open a session.
Be explicit about network access when you create the environment because the default container starts with networking off.
The quickstart stays short because Managed Agents only has a few first-class primitives.
Define the model, system prompt, tools, MCP servers, and skills once. Anthropic treats the agent definition as a reusable object you reference by ID later.
Create a cloud environment that defines packages, mounted files, and network access rules. This is the runtime container the session will use.
Start a session tied to the agent and environment, then post user events and stream results over SSE until the session goes idle.
The first useful prototype only needs one session, one user event, and one stream of agent events coming back.
bash
This code example is adapted from the official quickstart and keeps the same order of operations while trimming extra scaffolding.
# Create a session
session=$(curl -sS --fail-with-body https://api.anthropic.com/v1/sessions \
-H "x-api-key: $ANTHROPIC_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "anthropic-beta: managed-agents-2026-04-01" \
-H "content-type: application/json" \
-d '{
"agent": "agent_01...",
"environment_id": "env_01...",
"title": "Quickstart session"
}')
SESSION_ID=$(jq -er '.id' <<<"$session")
# Send a user event
curl -sS --fail-with-body \
"https://api.anthropic.com/v1/sessions/$SESSION_ID/events" \
-H "x-api-key: $ANTHROPIC_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "anthropic-beta: managed-agents-2026-04-01" \
-H "content-type: application/json" \
-d '{
"events": [{
"type": "user.message",
"content": [{
"type": "text",
"text": "Inspect this project and summarize the deployment risks."
}]
}]
}'These are the first problems teams usually hit once the agent object exists.
| Dimension | Problem | Likely cause | First fix |
|---|---|---|---|
| API rejects the request | Requests fail before the session even starts. | The beta header or API key is missing. | Add the managed-agents beta header and verify account credentials before changing the prompt. |
| External access does not work | The agent cannot reach external resources you expected it to use. | Networking is still disabled in the environment config. | Create or update the environment with the correct network policy. |
| It runs but you cannot tell what happened | The session appears idle but the useful output is hard to interpret. | You are not reading the event stream or inspecting session events directly. | Stream SSE events in real time and fetch the stored event log when debugging. |
These are the questions that help most when you are translating docs into the first working prototype.
Yes. Anthropic documents Console as a visual way to create and test the same agent and session resources before you move configuration into code.
Not by itself. A session gives you a running instance. You still need to send user events and then watch the event stream or fetch events later.
These pages are the shortest path to the next question most teams hit.
Use this page when you need a compact explanation of the hosted runtime, the core concepts, and the workloads that match Managed Agents best.
Open pageUse this page when you need the operational limits and runtime envelope before you promise capacity or security posture.
Open pageUse this page when a session is failing, stuck, or acting unlike the runtime you thought you configured.
Open pageUse the waitlist if you want the next update without checking the docs every week.
Waitlist
Get a short email when this guide adds new examples, API changes, or managed-agents implementation notes.