ASK KNOX
beta
LESSON 304

From Code to Cloud — Choosing Managed Agents

Managed Agents is not a better Claude Code — it is a different infrastructure path for a specific class of production workloads. Know the decision matrix before you build.

8 min read

There are three distinct ways to build with Claude at the infrastructure level, and the choice between them is not a matter of capability — it is a matter of execution model. Most teams default to the Messages API because it is the simplest entry point. Some reach for Claude Code because they want an interactive agent. Managed Agents is the path most teams discover late, after they have already built the wrong thing for their use case.

This lesson is about making that decision correctly the first time.

The Three Paths

Standard Messages API — request, response, done. You send a prompt, you receive a completion. Your code drives all orchestration. There is no persistent session, no built-in tool execution environment, and no background execution. The model processes one turn and returns.

This is the right path for: classification, single-turn generation, structured data extraction, short multi-turn conversations where your code manages the loop, and any task that completes in a single inference call.

Claude Code — an interactive agent with a local execution environment. A human is present and observing. The agent reads files, runs commands, edits code, and asks for clarification. The feedback loop is tight and human-mediated. Sessions end when the human closes them.

This is the right path for: development work, exploratory analysis, tasks that benefit from human oversight at each decision point, and any workload where you want to watch the agent work in real time.

Claude Managed Agents — async, unattended pipeline execution on Anthropic's infrastructure. You define an agent, start a session, and the agent runs to completion without requiring a human to watch. Sessions persist, results are retrievable after completion, and the infrastructure handles everything else.

This is the right path for: production pipelines that run on a schedule, research agents that gather and synthesize information over hours, post-commit processing workflows, content generation pipelines, and any task where fire-and-forget is the correct operational model.

What Managed Infrastructure Actually Means

When Anthropic manages the infrastructure, you get specific guarantees and give up specific controls.

What Anthropic handles:

Container lifecycle — the execution environment is provisioned when a session starts and cleaned up when it ends. You do not manage Docker images, container registries, or runtime environments.

Session persistence — the agent's work state persists for the duration of the session. Files written in one step are available in subsequent steps. You do not need to build your own state management.

Scaling — if you start ten sessions simultaneously, Anthropic's infrastructure runs them in parallel. You do not manage compute scaling or queue management.

Process health — if the agent process encounters an unexpected failure, the infrastructure handles recovery within the session. You do not write watchdog processes or restart logic.

What you manage:

Agent definition — the model, system prompt, tools, and skills you configure determine what the agent can do. This is your responsibility to get right.

Input and output — you start sessions with inputs and retrieve outputs. You own the data pipeline around the agent.

Error handling at the business level — the infrastructure handles infrastructure failures. You handle cases where the agent produces incorrect or incomplete output.

The Use Case Matrix

Use this to route decisions:

Execution modelDurationHuman in loop?Right path
Single inferenceSecondsNoMessages API
Multi-turn loop you controlMinutesNoMessages API
Interactive developmentMinutes-hoursYesClaude Code
Autonomous pipelineMinutes-hoursNoManaged Agents
Scheduled nightly jobMinutes-hoursNoManaged Agents
Event-triggered processingVariableNoManaged Agents

The boundary between "Messages API" and "Managed Agents" is whether the task needs to run autonomously without a human-controlled orchestration loop. If your code is writing the orchestration loop — iterating over documents, calling Claude repeatedly, accumulating state in your own database — that is Messages API territory. If you want the agent to run the orchestration loop itself while your code just waits for the result, that is Managed Agents.

What You Give Up

The managed path is not free of tradeoffs. Know them before you commit to the architecture.

Reduced debugging transparency. When a Claude Code session produces wrong output, you can inspect every file change, every command run, every intermediate state. In Managed Agents, you have session events and logs. The execution is opaque relative to local development. Debugging requires reasoning from event streams rather than direct inspection.

Less infrastructure control. You cannot install arbitrary system packages, mount your own volumes, configure custom networking, or override any runtime characteristic that falls outside the environment schema. The environment is managed, which means constrained.

API maturity constraints. Managed Agents is in beta. The API surface is not finalized. Behavior can change between versions. You need to build with this awareness — log aggressively, pin to explicit versions, and have fallback paths for critical production systems.

Latency model. Sessions are async. The expected execution model is start-and-poll or start-and-stream. If you need a synchronous blocking call that returns in under two seconds, the Messages API is the right tool.

The Migration Signal

Teams typically reach for Managed Agents when one of three things happens:

They build an autonomous pipeline on the Messages API and discover they are writing a significant amount of infrastructure code to manage state, retry logic, queue management, and compute scaling — code that has nothing to do with their actual problem.

They run a Claude Code session for a production task and realize they are watching it run for an hour without intervening — and they want that session to run while they are asleep.

They start planning multiple parallel pipelines and realize their current architecture requires dedicated compute for each one.

If any of these describes your current situation, the architecture is telling you something. The managed path exists because this problem space is common enough that Anthropic built infrastructure for it.