Skip to main content
Mythos

Agent Loop is the orchestration cycle inside 📝Claude Managed Agents — the model picks a tool, the harness executes it, the result returns to context, and the model decides the next step — repeating until the task completes.

The loop is what distinguishes Managed Agents from a single Messages API call. A standard API request is one turn: prompt in, completion out. The Agent Loop runs many turns autonomously, with 📝Claude selecting tools, the harness dispatching them to sandboxes, and tool outputs feeding back into context until the session reaches session.status_idle. Context management, error handling, retries, and tool-result formatting all happen inside the loop rather than in client code.

In Anthropic's brain-hands architecture, the Agent Loop is the brain side. The harness running the loop is stateless and decoupled from execution: it provisions sandboxes only when Claude calls a tool, and it can be rebooted independently without losing session data because the session itself is a durable event log stored outside the context window. This is why the same loop continues running even when the underlying container is replaced — and why Self-Hosted Sandboxes can swap out the execution environment without touching the loop itself. The Agent Loop always runs on Anthropic's infrastructure; only the sandbox layer beneath it can be customer-controlled.

The loop's design also enables multiple stateless harnesses serving the same session, and multiple sandboxes serving the same harness — the foundation for scaling long-running agentic work.

Contexts

Created with 💜 by One Inc | Copyright 2026