Claude Managed Agents: Hosted Infrastructure for Production AI Agents
Claude Managed Agents is a hosted service from Anthropic for building and running long-running AI agents in production. It handles server provisioning, sandboxed code execution, session state persistence, automatic error recovery, and secure credential management. You define the agent's behavior, tools, and system prompt; Anthropic's infrastructure runs it.
Architecture
The platform separates agent components so each can fail and recover independently.
The Harness is the active executor. It is stateless and handles one step at a time: it calls the Claude model, receives a decision (use a tool, run code, respond to the user), and routes that decision to the appropriate component. Because it is stateless, a crashed Harness can be replaced without data loss.
The Session is the persistent append-only log of everything that has happened in a task: user messages, model reasoning, tool calls, and results. It is stored separately from the Harness. When the Orchestrator replaces a failed Harness, the new Harness reads the Session log and resumes exactly where the previous one left off.
The Sandbox is the isolated execution environment for code and file operations. Code run inside the Sandbox cannot access the host system or other agents.
The Orchestrator monitors the Harness. If the Harness fails or becomes unresponsive, the Orchestrator provisions a replacement automatically. This is what makes the platform fault-tolerant by design.
Tools, Resources, and MCPs are the agent's external capabilities. Tools are callable functions (web search, file read, CLI). Resources are information sources such as a private GitHub repository. MCPs (Managed Connector Platforms) are secure integrations with third-party services like GitHub, Slack, and Notion. API credentials for these services are stored in a separate Credential Vault; the model itself never accesses raw keys.
Agent creation
Managed Agents supports two creation paths.
The Claude Console Quickstart accepts a plain-English description of the agent and generates a YAML or JSON configuration from it.
The conversational CLI onboarding runs inside Claude Code and guides setup through a series of clarifying questions about tools, permissions, environment, model selection, and system prompt, then generates TypeScript files for setup and runtime.
Building a medical assistant agent
The following walkthrough creates a medi-agent that reads markdown files from a private GitHub repository and responds to questions via Slack, behaving as a medical information assistant.
Prerequisites
Claude Code CLI version 2.1.96 or later is required. This is the version that introduced the Managed Agents skill.
Node.js and a TypeScript runtime such as bun or tsx are also needed.
Initiating onboarding
In the Claude Code terminal:
Claude asks what you want to build. Providing a natural language description:
create a medical agent that reads markdown documents from a private github repo, understands the information like a doctor and that I can communicate with using slack
Claude uses this to drive the configuration conversation.
Configuration rounds
The onboarding runs through three rounds.
Round A: Tools. Claude recommends the prebuilt toolset with read, glob, and grep, and suggests disabling write, edit, and bash to keep the agent read-only. It asks whether web search should be enabled (disabling it keeps the agent grounded in the private repository), whether custom tools are needed, and requests the repository URL.
Round B and C: Environment and identity. Claude proposes a locked-down network environment with no outbound internet access, selects a model (recommending claude-opus-4-6 for medical reasoning, though claude-sonnet-4-6 is more cost-effective for testing), and drafts a system prompt instructing the agent to synthesize and cite information from the repository documents.
Generated code
After configuration, Claude generates two TypeScript files.
setup.ts is a one-time provisioning script. It uses the Anthropic SDK to create the Environment and Agent on Anthropic's platform, then prints the ENVIRONMENT_ID and AGENT_ID to the console. Save both values.
app.ts is the long-running Slack bot. It imports @slack/bolt and the Anthropic SDK, listens for bot mentions, creates or retrieves a Session using the AGENT_ID and ENVIRONMENT_ID, sends the user's message to the session, streams the response, and posts it back to the Slack thread.
Running the setup script
Copy the ENVIRONMENT_ID and AGENT_ID from the output. The agent appears in the Managed Agents section of the Claude Console.
Environment variables
Create a .env file for app.ts:
Starting the bot
The terminal confirms the agent is running on Slack.
Interaction and debugging
Mentioning @medi-bot in Slack and asking a question triggers the agent. It runs a find command to locate relevant files in the repository, reads their contents, synthesizes a response, and posts it back to the thread.
The Sessions tab in the Claude Console shows a full transcript of the agent's process for each interaction: the user message, each tool call with its output, and the final response. This trace is the primary debugging interface.
Pricing
Claude Managed Agents billing is separate from Claude Pro and Team subscriptions.
Token usage is billed at standard Claude API rates for the configured model. Both input tokens (prompts and tool outputs) and output tokens (model responses) are counted.
Session runtime is billed at $0.08 per session-hour, metered to the millisecond. Billing only accrues when the session status is "running." When the agent is waiting for user input or a tool to complete, the status is "idle" and runtime billing is paused. For interactive chat-based agents, most time is spent idle, which keeps runtime costs low.
Final thoughts
The decoupled architecture, where the Session persists independently of the Harness and the Orchestrator replaces failed components automatically, is the core production-readiness argument. Applications built on infrastructure without these properties tend to require custom recovery logic that is difficult to get right.
The conversational CLI onboarding lowers the initial configuration burden, though the generated TypeScript files are straightforward enough to write directly once the pattern is familiar. The Sessions tab in the Console provides enough trace visibility for most debugging without needing additional logging infrastructure.
The pricing model favors interactive agents that spend most of their time waiting. Agents running continuous background jobs with no idle periods accumulate session-hour costs proportionally.
Documentation is available in the Anthropic documentation.