Managed Agents vs Agent SDK vs Cloud Tasks — which harness?
Anthropic now has three ways to run autonomous agents. Each has different pricing, capabilities, and trade-offs. Here’s the comparison nobody wrote.
The three options
| Managed Agents (API) | Agent SDK (Library) | Cloud Scheduled Tasks | |
|---|---|---|---|
| Runs on | Anthropic cloud | Your infrastructure | Anthropic cloud |
| Cost model | $0.08/hr + API tokens | API tokens only | Claude subscription (included) |
| Model selection | Per-agent | Per-agent | Session-level (one model) |
| Multi-agent | Yes (research preview) | Yes (Agent tool) | Yes (subagents) |
| Tools | Bash, Read, Write, Edit, Glob, Grep, WebSearch, WebFetch | Same | Same |
| MCP servers | Supported | Supported | Connectors only |
| Auth | API key | API key | Subscription |
| Max runtime | Hours | Unlimited (your infra) | ~30 min per session |
| Best for | Production SaaS, long-running tasks | CI/CD, custom apps, multi-model routing | Daily automation, personal workflows |
Cost math: a real example
Scenario: A daily agent that checks 40 sources, writes 5 articles, and updates tracking data. Takes ~20 minutes of active execution, uses ~50K input + 20K output tokens with Sonnet.
| Approach | Cost per run | Monthly (30 runs) |
|---|---|---|
| Managed Agents | $0.027 runtime + ~$0.45 tokens = $0.48 | $14.40 |
| Agent SDK (Sonnet) | ~$0.45 tokens = $0.45 | $13.50 |
| Cloud Tasks (Max plan) | Included in $100/mo subscription = $0 marginal | $0 (but $100/mo fixed) |
If you run <3 agents: Cloud Tasks on your subscription is cheapest. If you run 10+ specialized agents: Agent SDK gives you multi-model routing (use Haiku at $1/M for data gathering, Opus at $5/M for synthesis) which can cut token costs 60%. If you need production reliability: Managed Agents handle infrastructure, monitoring, and SSE streaming.
Managed Agents: the API
from anthropic import Anthropic
client = Anthropic()
# Create a reusable agent definition
agent = client.beta.agents.create(
name="Daily Research Agent",
model="claude-sonnet-4-6",
system="You are a research agent that finds and analyzes AI developments.",
tools=[{"type": "agent_toolset_20260401"}],
)
# Create an environment with network access
env = client.beta.environments.create(
name="research-env",
config={"type": "cloud", "networking": {"type": "unrestricted"}},
)
# Start a session
session = client.beta.sessions.create(
agent=agent.id, environment_id=env.id, title="Daily research"
)
# Stream results
with client.beta.sessions.events.stream(session.id) as stream:
client.beta.sessions.events.send(session.id, events=[
{"type": "user.message", "content": [{"type": "text", "text": "Find today's AI news"}]}
])
for event in stream:
if event.type == "agent.message":
print(event.content[0].text)
elif event.type == "session.status_idle":
break
All endpoints require the managed-agents-2026-04-01 beta header. Multi-agent coordination is in research preview.
Decision framework
Start with Cloud Tasks if you’re on a Claude subscription and want zero-cost automation. It’s the fastest path and works for daily workflows.
Move to Agent SDK when you need multi-model routing (Haiku for cheap tasks, Opus for quality), CI/CD integration, or custom orchestration logic.
Use Managed Agents when you’re building a product that needs hosted agent execution, SSE streaming to a frontend, or Anthropic-managed infrastructure.