In short Usually you run the agent loop yourself in your code: send a request, handle the tool call, return the result, repeat. A managed agent is when Anthropic runs the loop for you: in a sandbox, on its own infrastructure, sending you a stream of events about what the agent does. Less code and hassle, but less control.
Two ways to run an agent
Self-managed
You keep the loop yourself: you call the model, run the tools, manage context. Plus: full control of every step. Minus: your code, your infrastructure, your responsibility for the loop, errors, context and cost.
Managed
Anthropic runs the loop for you in an isolated sandbox: it calls the model, runs the tools, keeps the context. You set the task and listen to an event stream — what the agent did, what it called, where it landed. Plus: less of your own code and infra, safe isolation. Minus: less control over the loop's details.
Analogy: hiring a crew with a foreman. Self-managed — you're the foreman, directing every worker. Managed — you hand the task to a contractor: they run the work on their site and send you progress reports.
The event stream
Since the loop runs "on their side," you see it through an event stream: Anthropic reports along the way — the agent started a step, called this tool, got a result, continued, finished. You consume those events in your app: show progress, log, react. Like reading a delivery status feed rather than driving the truck.
When to choose which
| Self-managed | Managed agent | |
|---|---|---|
| Control | maximal | limited |
| Your code/infra | a lot | little |
| Isolation | you build it | out of the box |
| When to take | fine control, custom tools, special logic | a working agent fast, no loop plumbing |
The Claude Platform 101 course shows both: first you build the loop by hand (to understand the agent loop mechanics), then a managed agent end-to-end, reading its event stream.
Related
The source is the Claude Platform 101 course. Related: the agent loop and tools, agent context management.