Claude Managed Agents: pre-built agents running long tasks on Anthropic's infrastructure
TL;DR
Managed Agents is Anthropic's pre-built agent harness: define an agent, choose an environment, start a session, send events, with no loop or sandbox to build. It suits long, asynchronous work; it's in beta and stateful, so not ZDR-eligible.
Building an agent that works for hours (reading a repo, running commands, searching the web, writing a report) on the Messages API means building a whole system yourself: the agent loop, tool execution, a secure sandbox, state storage, interruption handling. Claude Managed Agents is the version Anthropic builds and runs for you: a configurable agent harness on managed infrastructure, with prompt caching, compaction and other optimisations built in. You just define the agent and send it work.
Messages API or Managed Agents?
| Messages API | Managed Agents | |
|---|---|---|
| What it is | Direct model access | A pre-built agent harness on managed infrastructure |
| Best for | Custom agent loops, fine-grained control | Long-running, asynchronous work |
| You handle | The loop, tools, sandbox, state | Defining the agent and sending events |
Four core concepts
| Concept | What it is |
|---|---|
| Agent | Model, system prompt, tools, MCP servers, skills; created once and reused by ID |
| Environment | Where sessions run: an Anthropic cloud sandbox or a self-hosted sandbox on your infrastructure |
| Session | A running agent in an environment, doing a specific task |
| Events | Messages between your app and the agent: user turns, tool results, status updates |
The flow: create an agent → create an environment → start a session → send events and stream results over SSE → send more events to steer or interrupt. Event history is stored server-side.
Built-in tools
- Bash in the sandbox.
- File operations: read, write, edit, glob, grep.
- Web search and fetch, optionally restricted to domain allow/block lists.
- MCP servers to connect external systems.
There are also scheduled deployments for recurring runs on a cron schedule, and you can mount Files API files into the sandbox.
Getting started
- You need a Claude Console API key and the
managed-agents-2026-04-01beta header on every request (the SDK adds it). - It's enabled by default for all API accounts; some features such as MCP tunnels are in a narrower research preview that requires signing up.
- Available on the Claude API, Claude Platform on AWS and Claude on Google Cloud (Anthropic managed), with some feature differences.
Risks and caveats
- Stateful by design: transcripts, sandbox state and outputs are stored server-side until you delete them, so it is not eligible for Zero Data Retention or a HIPAA BAA. For sensitive data, consider self-hosted sandboxes and delete sessions regularly.
- Beta: behaviour may change between releases.
- The agent has real powers in the sandbox: web content and MCP results can still carry prompt injection; restrict domains and tools to what's needed.
How to apply it
- Dev: Do the quickstart, then move a background job you currently run with a home-grown loop (say, a daily report digest) to Managed Agents and compare the effort.
- Tech Lead: Choose Managed Agents for long, asynchronous work when you don't want to run sandboxes; keep the Messages API when you need step-by-step control.
- PM: "Hand the AI a task and get results later" features ship much faster when you don't have to build agent infrastructure.
Sources & references
- Claude Managed Agents overview — Claude Docs