Read this plain-English walkthrough and understand what Claude Managed Agents are, when to use them, and how to set one up without guessing.
Free guide · copy-paste ready · built by the BrainVaultAI team
Managed Agents (also called Claude Agents or the Agents API) let you run Claude as a persistent, tool-using process, not just a chat turn. It handles memory, tool calls, multi-step reasoning, and long-running tasks automatically. This guide explains the difference between regular Claude API calls and agent mode, when agents are the right choice, and the minimum setup needed to get a working agent running via the API. No fluff. If you've used the Claude API before, you're 80% of the way there. The remaining 20% is covered here.
What Managed Agents Are (Plain English)
**Regular Claude API call:**
You send a message → Claude responds → done. Stateless. Single turn. **Claude Agent:**
You give Claude a goal and tools → Claude figures out the steps → calls tools as needed → loops until done → returns final result. Stateful within a run. Multi-turn internally. **When to use agents:**
- Task requires more than one tool call
- You don't know exactly how many steps are needed upfront
- Task involves decision-making mid-process ("if X then do Y")
- You want Claude to handle retries and error recovery automatically **When NOT to use agents:**
- Simple one-shot generation (write this email, summarize this)
- You need a specific output format with no tool use
- Latency is critical (agents add overhead) **Key concepts:**
- System prompt: tells Claude what it is and what it can do
- Tools: functions Claude can call (web search, database query, API call, etc.)
- Tool results: what comes back after Claude calls a tool
- Stop condition: how Claude knows it's done
Minimum Agent Setup (Python)
Minimum working agent via the Anthropic Python SDK: ```python
import anthropic client = anthropic.Anthropic() # Define your tools
tools = [ { "name": "web_search", "description": "Search the web for current information", "input_schema": { "type": "object", "properties": { "query": {"type": "string", "description": "Search query"} }, "required": ["query"] } }
] messages = [{"role": "user", "content": "Research the top 3 competitors of [COMPANY] and summarize their pricing"}] # Agent loop
while True: response = client.messages.create( model="claude-opus-4-5", max_tokens=4096, system="You are a research agent. Use the tools available to complete the user's task fully before responding.", tools=tools, messages=messages ) if response.stop_reason == "end_turn": print(response.content[0].text) break # Handle tool calls if response.stop_reason == "tool_use": tool_results = [] for block in response.content: if block.type == "tool_use": # Execute your actual tool here result = execute_tool(block.name, block.input) tool_results.append({ "type": "tool_result", "tool_use_id": block.id, "content": result }) messages.append({"role": "assistant", "content": response.content}) messages.append({"role": "user", "content": tool_results})
``` Replace `execute_tool()` with your actual tool implementation. That's the core loop.
Agent System Prompt Template
Use this as your base system prompt. Fill in the brackets: ```
You are [AGENT NAME], a [ROLE] agent. Your job: [ONE SENTENCE ON WHAT THIS AGENT ACCOMPLISHES] Tools available to you:
- [TOOL 1]: [what it does]
- [TOOL 2]: [what it does] How to work:
1. Understand what the user needs before calling any tools
2. Use the minimum number of tool calls needed
3. If a tool call fails, try once with a modified approach, then report the failure
4. When you have enough information, stop calling tools and deliver the final answer Output format:
[Describe exactly what your final response should look like] Do not:
- Make up information you could get from a tool
- Run more than [N] tool calls total without checking in
- Return partial results without flagging them as partial
```
Want the editable version?
We'll send the editable version of this asset, plus a short series of our highest-leverage AI plays for operators. No spam. Unsubscribe in one click.
Free. No spam. Unsubscribe in one click. By submitting you agree to receive emails from BrainVaultAI.