Claude Agents: Features, Managed Agents API, and How to Build with Them
Anthropic now offers three distinct surfaces for running Claude as an autonomous agent, each built for different use cases. Managed Agents launched in beta in April 2026 with cloud sandboxes and self-hosted options. Claude Code runs agents in your terminal. The Messages API gives you full control over the agent loop. This guide covers what each surface does, how they compare, and how to start building with them.
The Agent Infrastructure Gap
According to McKinsey's 2025 survey, 62% of organizations are experimenting with AI agents, but only 23% have scaled agents in even one business function. That 39-point gap exists because building a reliable agent means solving more than inference. You need tool execution, sandboxed environments, session persistence, and a way to get agent output into human hands.
Anthropic's answer is three agent surfaces, each targeting a different slice of that infrastructure problem. Claude Managed Agents handles the full stack: sandbox provisioning, tool execution, and session persistence on Anthropic's infrastructure. Claude Code puts an agent loop in your terminal for interactive development work. The Messages API gives you raw model access so you can build a custom agent loop with your own tools and runtime.
Understanding which surface fits your use case is the difference between shipping an agent in a day and spending weeks building infrastructure from scratch.
What Are Claude Agents?
Claude agents are autonomous AI systems built on Anthropic's Claude models that can read files, run commands, browse the web, and execute code to complete complex tasks with minimal human intervention. Unlike a single API call that returns text, an agent runs in a loop: it receives a task, decides which tool to use, executes it, evaluates the result, and repeats until the job is done.
All three agent surfaces share the same underlying Claude models (Opus 4.8, Sonnet 4.6, Haiku 4.5) and the same core capabilities: multi-step reasoning, tool use, and extended context windows. What differs is who manages the agent loop and where tools execute.
Here is how the three surfaces compare:
The rest of this guide breaks down each surface so you can pick the right one.
How Claude Managed Agents Work
Managed Agents is the newest surface, launched in beta in April 2026. Instead of building your own agent loop, tool execution layer, and sandbox, you get all of that from Anthropic's infrastructure. The system is built around four concepts: agents (model + prompt + tools), environments (where the sandbox runs), sessions (a running instance), and events (messages between your app and the agent).
The architecture separates the "brain" (Claude and the use) from the "hands" (sandboxes and tools) and the session (an append-only event log). This decoupling means the use is stateless. If it fails, a new one picks up where the old one left off by reading the session log. Anthropic's engineering team reported a 60% reduction in median time-to-first-token and over 90% reduction at p95 after adopting this architecture.
Built-in tools
Managed Agents gives Claude access to:
- Bash: Run shell commands inside the sandbox
- File operations: Read, write, edit, glob, and grep files
- Web search and fetch: Search the web and retrieve page content
- MCP servers: Connect to any external tool provider via the Model Context Protocol
You enable the full toolset with a single configuration flag (agent_toolset_20260401) or selectively enable individual tools.
Environments
Two options for where your agent's sandbox runs:
Cloud sandbox runs on Anthropic-managed infrastructure. You configure networking (unrestricted or restricted), and Anthropic handles provisioning and teardown. Containers spin up on demand through tool calls, not upfront, so sessions that do not need a sandbox skip the provisioning latency entirely.
Self-hosted sandbox runs on your own infrastructure. This option exists for compliance or data-residency requirements where you cannot send execution to Anthropic's cloud.
Getting started
Here is a minimal Python example that creates an agent, environment, and session, then streams the response:
from anthropic import Anthropic
client = Anthropic()
agent = client.beta.agents.create(
name="Coding Assistant",
model="claude-sonnet-4-6",
system="You are a helpful coding assistant.",
tools=[{"type": "agent_toolset_20260401"}],
)
environment = client.beta.environments.create(
name="dev-env",
config={"type": "cloud", "networking": {"type": "unrestricted"}},
)
session = client.beta.sessions.create(
agent=agent.id,
environment_id=environment.id,
)
After creating the session, you send user events and stream back agent responses via server-sent events. The agent autonomously decides which tools to call, executes them in the sandbox, and streams results back in real time. When it finishes, it emits a session.status_idle event.
Pricing
Managed Agents bills on two dimensions: standard token pricing (same rates as the Messages API) plus $0.08 per session-hour of runtime. Runtime accrues only while the session status is "running," not while waiting for user input or sitting idle. Container compute is included in the session-hour charge.
How to Build a Custom Agent with the Messages API
The Messages API is the most flexible surface. You get direct model access and build the agent loop yourself. This means you control every aspect: which tools are available, how tool results are processed, when to retry, and how conversation state persists.
A basic agent loop with the Messages API looks like this:
from anthropic import Anthropic
client = Anthropic()
messages = [{"role": "user", "content": "Analyze the Q2 report"}]
while True:
response = client.messages.create(
model="claude-sonnet-4-6",
max_tokens=4096,
tools=your_tools,
messages=messages,
)
if response.stop_reason != "tool_use":
break
### Execute tool calls and append results
messages.append({"role": "assistant", "content": response.content})
for block in response.content:
if block.type == "tool_use":
result = execute_tool(block.name, block.input)
messages.append({
"role": "user",
"content": [{"type": "tool_result",
"tool_use_id": block.id,
"content": result}],
})
The tradeoff is clear: you get full control, but you build and maintain everything. Session persistence, error recovery, sandboxing, and tool execution are all your responsibility. This surface makes sense when you need custom tool implementations, fine-grained control over the agent loop, or integration with an existing orchestration framework.
For teams already running agent infrastructure (custom sandboxes, specialized tools, proprietary execution environments), the Messages API slots into what you have. For teams starting from zero, Managed Agents eliminates months of infrastructure work.
Give your Claude agents a workspace that persists
50 GB free storage, MCP-ready endpoint, and built-in RAG. Upload agent output, share it with your team, and hand off ownership when the job is done. No credit card, no expiration.
Claude Code as an Agent Surface
Claude Code is Anthropic's terminal-based agent. It runs an agent loop locally: it reads your files, executes shell commands, searches the web, and calls MCP servers, all from your command line. Think of it as a Managed Agent that runs on your laptop instead of Anthropic's cloud.
Claude Code is strongest for interactive development workflows. You give it a task ("refactor this module to use dependency injection" or "find and fix the race condition in the queue handler"), and it works through it step by step, asking for permission before destructive operations. It supports subagents for parallel work, hooks for lifecycle automation, and MCP servers for connecting to external tools.
When Claude Code fits
- Interactive coding: debugging, refactoring, writing tests, code review
- Exploratory work where you want to watch the agent think and steer it
- Tasks that need access to your local filesystem, git history, or development tools
- Prototyping agent workflows before moving them to Managed Agents or a custom API loop
When it does not fit
- Long-running async tasks that should run without your terminal open
- Production workloads that need to scale across multiple sessions
- Tasks that need cloud-based sandboxing for security isolation
The key distinction: Claude Code is an interactive agent for developers. Managed Agents is a programmable agent runtime for applications.
How to Connect Agent Output to Team Workflows
Building the agent is half the problem. The other half is getting agent output into a place where humans can review, collaborate on, and act on it. An agent that generates reports, processes documents, or builds project files needs somewhere to put them.
Local filesystems work for solo development, but break down when agents serve teams. S3 and Google Drive handle storage, but they are not designed for agent-to-human handoff. You end up building permission management, file organization, and collaboration features yourself.
Fast.io approaches this differently. It provides shared workspaces where agents and humans work on the same files. An agent authenticates via API key or OAuth, uploads output to a workspace, and the team sees it immediately with previews, search, and commenting. When the project is done, the agent can transfer ownership to a human while retaining admin access.
The platform exposes a MCP server with tools for workspace management, file operations, AI-powered search, and workflow automation. Connect it to any Claude agent surface:
{
"mcpServers": {
"fastio": {
"url": "/storage-for-agents/"
}
}
}
With Intelligence Mode enabled, uploaded files are automatically indexed for semantic search and RAG chat with citations. No separate vector database setup required.
The free agent plan includes 50 GB storage, 5,000 credits per month, and 5 workspaces with no credit card or expiration.
Frequently Asked Questions
What are Claude agents?
Claude agents are autonomous AI systems built on Anthropic's Claude models that can read files, run shell commands, browse the web, and execute code. They operate in a loop, deciding which tools to use, executing them, and evaluating results until the task is complete. Anthropic offers three surfaces for running agents, each with different tradeoffs around control, infrastructure, and use case fit.
How do Claude Managed Agents work?
You create an agent (defining model, prompt, and tools), set up an environment (cloud sandbox or self-hosted), and start a session. You send user messages as events, and the agent autonomously executes tools in the sandbox while streaming results back via server-sent events. The session persists server-side, so you can pause and resume. The use is stateless, meaning if it fails, a new one picks up from the session event log.
What is the difference between Claude Code and Claude Managed Agents?
Claude Code runs an agent loop in your terminal for interactive development work. You watch it execute, approve or deny tool calls, and steer it in real time. Managed Agents runs on Anthropic's infrastructure (or self-hosted sandboxes) for programmatic, long-running tasks. Claude Code is for developers at their keyboards. Managed Agents is for applications that need to run agents at scale without human supervision.
Can Claude agents run autonomously?
Yes. Both Managed Agents and Messages API agents can run fully autonomously without human intervention. Managed Agents sessions continue executing tools and processing tasks even when your application is not actively streaming events. Claude Code can also run autonomously but is designed for interactive use where a developer reviews and approves actions.
What tools do Claude Managed Agents support?
Managed Agents includes built-in tools for Bash (shell commands), file operations (read, write, edit, glob, grep), web search, web content fetching, and MCP server connections. You can enable all tools at once with the agent_toolset_20260401 configuration or selectively enable individual tools.
How much do Claude Managed Agents cost?
Managed Agents bills on two dimensions. Token usage follows standard Claude API pricing for the model you choose. On top of that, sessions incur a $0.08 per session-hour runtime charge, metered to the millisecond and only while the session is actively running. Container compute is included in the session-hour fee.
Related Resources
Give your Claude agents a workspace that persists
50 GB free storage, MCP-ready endpoint, and built-in RAG. Upload agent output, share it with your team, and hand off ownership when the job is done. No credit card, no expiration.