What Are Claude Managed Agents?

July 23, 2026

A practical guide to server-hosted AI agents built with Anthropic's Claude Agent SDK, and how they change the way you build with AI.


Most developers who start building with AI follow the same pattern. You send a message to the model, read the response, do something with it, and repeat. That works fine for simple tasks. But once your task requires multiple steps, tool use, and the ability to make decisions along the way, you need something more structured. That is where agents come in, and Managed Agents specifically are Anthropic's answer to the question of how to run those agents reliably at scale.

What Is a Managed Agent?

A Managed Agent is an AI agent that runs inside a secure, server-side execution environment managed by Anthropic. You define the agent's behavior by giving it a model, a system prompt, and a set of tools. Anthropic's infrastructure handles the rest: running the agentic loop, executing tool calls, managing intermediate state, and returning the final result to your code.

The key distinction is where the work happens. In a traditional DIY agent setup you write the loop yourself. Your code calls the model, checks whether it wants to use a tool, runs the tool, feeds the result back, and calls the model again. You handle the infrastructure, the error recovery, and the state management. With a Managed Agent, that loop moves to Anthropic's servers. Your application sends a task and waits for a completed response.

The Agent Loop Under the Hood

Understanding the loop helps you build better agents, whether managed or not.

When you send a task to a Managed Agent, the following sequence runs automatically:

  1. Claude receives your message and decides whether it can answer directly or needs to use a tool.
  2. If it calls a tool, the SDK executes the corresponding function and returns the output to Claude.
  3. Claude continues reasoning, possibly calling more tools, until it reaches a final answer.
  4. The completed response is returned to your application.

Each tool call is logged. Each intermediate step is tracked. You can inspect what the agent did and why, which matters when something goes wrong.

Setting Up Your First Managed Agent

The entry point is the Claude Agent SDK, installed via pip:

pip install anthropic

Initialize the client with your API key stored in an environment variable:

import anthropic
import os

client = anthropic.Anthropic(
    api_key=os.environ.get("ANTHROPIC_API_KEY")
)

Define your tools as a list of dictionaries. Each tool needs a name, a clear description (Claude uses this to decide when to call it), and an input schema:

tools = [
    {
        "name": "get_word_count",
        "description": "Count the number of words in a given string.",
        "input_schema": {
            "type": "object",
            "properties": {
                "text": {
                    "type": "string",
                    "description": "The text to count words in."
                }
            },
            "required": ["text"]
        }
    }
]

Back the tool with a Python function:

def get_word_count(text: str) -> int:
    return len(text.split())

tool_map = {"get_word_count": get_word_count}

Run the agent using the Tool Runner, which manages the agentic loop for you:

with client.beta.messages.tool_runner(
    model="claude-sonnet-5",
    tools=tools,
    messages=[{
        "role": "user",
        "content": "How many words are in: The quick brown fox?"
    }]
) as runner:
    result = runner.run()
    print(result.content)

The Tool Runner handles the back-and-forth between Claude and your tool functions automatically. You do not write the loop.

Why Managed Instead of DIY?

Building a DIY agent loop is not hard. But maintaining one in production is. The loop has to handle model errors, tool timeouts, unexpected output formats, and token limits. Each of those failure modes needs its own error handling, retry logic, and logging.

Managed Agents reduce that surface. The execution environment is stable, the loop behavior is consistent, and Anthropic handles the edge cases you would otherwise discover in production at 2 AM.

There are trade-offs. A managed environment gives you less control over exactly how the loop runs. If you need fine-grained control over every step, a DIY loop with your own orchestration is the right tool. But for the majority of use cases, development speed and operational reliability outweigh the loss of low-level control.

Practical Use Cases

Research and summarization. Give the agent a web search tool. Ask it to research a topic, compare sources, and return a structured summary. The agent decides how many searches to run and when it has enough information to answer.

Code review. Point the agent at a file or repository. Ask it to identify issues, suggest improvements, and explain its reasoning. The agent can call a file-reading tool multiple times as it works through the code.

Data processing. Give the agent read and write access to a CSV file. Ask it to clean the data, calculate summary statistics, and write a report. Each operation is a separate tool call.

Document analysis. Feed the agent a policy document or contract. Ask it to extract key dates, obligations, and risks. The agent can re-read sections, cross-reference content, and build up a structured output over multiple passes.

Tips for Building Reliable Agents

Write tool descriptions the way you would write documentation for a junior developer. Be specific about what the tool does, what inputs it expects, and what it returns. Vague descriptions lead to tool calls made at the wrong time or with the wrong arguments.

Test each tool function independently before connecting it to the agent. A tool that crashes silently will produce confusing agent behavior that is hard to debug.

Start with one tool, get the agent working end to end, then add more tools one at a time. Adding five tools at once and trying to debug a broken agent is much harder than building incrementally.

Set a clear, specific system prompt. Tell the agent its role, the scope of what it should do, and any constraints it should respect. An agent without a system prompt will behave consistently but may not behave the way you expect.

Download the Guide

The slide deck linked below walks through every step covered in this post, with code examples on each slide. It is designed to be used as a reference while you build your first agent.

Download: How to Create a Claude Managed Agent (PowerPoint)

The deck covers installation, tool definition, the tool runner setup, handling tool calls, and best practices, in ten slides with syntax-highlighted code on every technical slide.


Managed Agents lower the barrier to building reliable AI workflows. The infrastructure question is answered for you. What remains is the interesting part: deciding what the agent should do, what tools it should have, and what problem it is actually solving. That part is still yours to figure out, and it is the part worth spending time on.