Guide · AI Implementation

Should you build Claude agents on the Messages API, the Agent SDK, or Managed Agents, or buy one?

A decision guide for custom Claude agents: what the Messages API, Agent SDK and Managed Agents each give you, data-retention eligibility, costs, and when configuring an existing product beats building.

Author
Chris Gooding
Read time
8 min read
Published
October 26, 2026
Topic
AI Implementation
On this page (9)

Use Managed Agents when you want Anthropic to host a long-running agent with the sandbox, tools and session state already built. Use the Agent SDK when you want Claude Code's agent loop inside software you run. Use the Messages API when you need full control of the loop, strict data handling or the simplest request-response flow. Buy or configure an existing product when the work already lives in Claude, Slack, GitHub or Salesforce.

This is a decision guide for a CIO, architect or product owner who has a workflow in mind and needs to pick a route. It covers the three ways to build on Claude, powered by Anthropic, the cases where you should not build at all, and the data, cost and operations questions that decide most projects. Details are as of October 2026 from Anthropic's platform and Claude Code documentation. Managed Agents is in beta, so confirm terms with Anthropic for your contract.

What are the options at a glance?

Ways to build a Claude agent
OptionWho runs the agent loopWhere tools runWhat you buildBest for
Messages API (Client SDK)YouYour application for client tools; Anthropic for server tools such as web search and code executionThe loop, tool handlers, state, retries, logging. The SDK's tool runner can drive the loop for youEmbedded features, high-volume classification or extraction, strict data rules, fine control
Claude Agent SDK (Python, TypeScript)A library you run in a process you operateYour infrastructureThe host application, permissions, deploymentAgents that need Claude Code's file, shell and web tools, hooks, subagents and sessions inside your own product or pipeline
Claude Managed Agents (beta)AnthropicAn Anthropic-managed cloud sandbox, or a self-hosted sandbox on your infrastructureThe agent definition and your application's event handlingLong-running or asynchronous tasks, scheduled runs, teams that do not want to run agent infrastructure
Configure an existing productAnthropic or the vendorVendor-managedConnectors, skills, plugins, promptsKnowledge work in Claude, Claude Tag in Slack, Claude Code in GitHub, Agentforce in Salesforce

What does Managed Agents give you?

Managed Agents is a pre-built agent harness running in Anthropic's infrastructure. You define an agent (model, system prompt, tools, MCP servers and skills) once, define an environment, then start sessions that reference both. Your application sends user events and receives results streamed over server-sent events, and can send further events to steer or interrupt the agent mid-task. Event history is stored server-side. Built-in tools include Bash, file operations (read, write, edit, glob, grep), web search and fetch with optional domain allowlists or blocklists, and MCP servers. The harness handles prompt caching and compaction. Anthropic positions it for tasks that run minutes or hours, need a sandbox with network access, need persistent files across interactions, or run on a schedule through scheduled deployments.

  • Access: a Claude API key and the managed-agents-2026-04-01 beta header on every request. The SDKs set the header automatically. It is enabled by default for API accounts.
  • Where it runs: the Claude API, Claude Platform on AWS, and Claude Models on Google Cloud (Anthropic managed), with some feature differences on those two.
  • Self-hosted sandboxes: you run a worker on a Linux host that needs only outbound HTTPS. Claude still runs on Anthropic's side, and tool inputs and outputs still pass through Anthropic's control plane, so this keeps execution and files in your environment but not the conversation. Self-hosted sessions accept memory stores but not file or GitHub repository resources.
  • Private MCP servers: MCP tunnels can reach servers inside your network but are a limited research preview within the beta, by request.
  • Pricing: $0.08 per session-hour of active runtime plus standard token rates, per claude.com/pricing.

What does the Agent SDK give you?

The Agent SDK gives you the same tools, agent loop and context management that power Claude Code, as a Python or TypeScript library. You get built-in tools to read, write and edit files, run commands and search the web; hooks that run your code at points in the agent lifecycle; subagents; MCP connections; permission rules for which tools run automatically and which need approval; sessions you can resume or fork; and skills, commands and memory loaded from .claude folders, as in Claude Code. Plugins load by local path. For other languages, Anthropic suggests running the Claude Code CLI as a subprocess with -p and JSON output.

  • Authentication: an API key from the Claude Console, or a cloud provider set by environment variable: CLAUDE_CODE_USE_BEDROCK for Amazon Bedrock, CLAUDE_CODE_USE_ANTHROPIC_AWS for Claude Platform on AWS, CLAUDE_CODE_USE_VERTEX for Google Cloud's Agent Platform, or CLAUDE_CODE_USE_FOUNDRY for Microsoft Foundry. Unless previously approved, Anthropic does not allow third-party products built on the SDK to offer claude.ai login or subscription rate limits.
  • Terms: use is governed by Anthropic's Commercial Terms of Service, including when the agent serves your own customers.
  • Branding if you ship it: Claude Agent or {YourAgentName} Powered by Claude is allowed; Claude Code or Claude Code Agent is not.
  • You operate it: hosting, scaling, isolation of the shell and file tools, secrets, and monitoring are your job.

What does the Messages API give you?

The Messages API is direct model access. You define tools with JSON schemas; Claude returns a tool_use block; your code runs the function and sends back a tool_result. Server tools such as web search, web fetch, code execution and tool search run on Anthropic's side with no handler code. Adding strict: true to a tool definition makes the tool calls Claude returns match your schema exactly, and the MCP connector lets a request call remote MCP servers without a separate MCP client. Everything else, including memory between turns, retries, timeouts, approval steps and audit logging, is yours to build. That is more work, and it is also the most control you can get.

Which route fits your data-handling rules?

This question settles many decisions before any architecture debate. Anthropic publishes which API features are eligible for zero data retention (ZDR) and for HIPAA-ready access. Several agent building blocks are not eligible, because they store state by design.

ZDR and HIPAA eligibility of agent building blocks (Anthropic API and data retention page, October 2026)
FeatureZDR eligibleHIPAA-ready eligibleRetention note
Messages APIYesYesStandard calls
Prompt cachingYesYesPrompts and outputs not stored
Web search toolYesYesResults returned in the response
Web fetch toolYesNoFetched content returned in the response
MCP connectorNoNoStandard retention policy
Code execution toolNoNoContainer data retained up to 30 days
Agent SkillsNoNoStandard retention policy
Files APINoNoRetained until deleted or expired
Batch processingNoNo29-day retention
Claude Managed AgentsNoNoTranscripts persist until you delete them

So if your contract requires ZDR or a BAA, build on the Messages API with client-side tools you run, and keep the agent loop, files and tool execution in your environment. The Agent SDK can also fit, depending on which provider and features it uses; check each feature against the table. Also note that Claude Fable 5.1 and some other models are designated Covered Models that require 30-day data retention, so ZDR is not available on them unless Anthropic expressly authorizes it. For the full data picture, see our guide to whether Claude trains on your data.

How do the costs compare?

Main cost drivers (claude.com/pricing and Anthropic models overview, October 2026)
ItemPrice
Claude Opus 5.5 tokens$4 per million input, $20 per million output
Claude Sonnet 5.5 tokens$2 per million input, $10 per million output
Claude Haiku 5.5 tokensFrom $0.10 per million input, from $0.50 per million output
Claude Fable 5.1 tokens$10 per million input, $50 per million output
Batch processing50% off token prices
Managed Agents runtime$0.08 per session-hour of active runtime, plus tokens
Code execution50 free hours per organization per day, then $0.05 per hour per container
Web search$10 per 1,000 searches, plus tokens

Token spend usually dominates. Agents resend context on every step, so long tasks cost far more than single requests; prompt caching and compaction matter. The hidden cost of the Messages API and Agent SDK routes is engineering and operations time. The hidden cost of Managed Agents is less control over the runtime and a beta surface that may change between releases.

When should you buy or configure instead of building?

  • The work is a person doing knowledge work with company data: use the Claude apps with connectors, skills and plugins. No code to maintain.
  • The work happens in Slack, such as triage, on-call or answering from internal tools: look at Claude Tag, which runs under an admin-governed identity with its own connections and spend limit.
  • The work is code review, issue triage or CI fixes: Claude Code GitHub Actions, GitLab CI/CD, Code Review and cloud scheduled tasks cover much of it.
  • The work lives inside Salesforce records and processes: compare Agentforce with a custom agent first. Our guide on Agentforce versus custom AI agents covers that choice.
  • Build only when the agent must run inside your product, follow logic no product supports, serve customers directly, or meet data rules the products cannot.

What is a sound build sequence?

Custom agent build steps with owners
StepOwnerOutput
1. Define the task and the success measureBusiness ownerOne paragraph, a target metric, and the cost of a wrong answer
2. Build an evaluation setBusiness owner and engineerReal examples with expected outcomes, including cases where the agent should refuse or escalate
3. Settle data rulesSecurity and legalZDR or BAA requirement, allowed systems, retention, region; this picks or rules out routes
4. PrototypeEngineerA Managed Agents session or a Messages API loop run against the evaluation set
5. Choose hostingArchitectManaged Agents, Agent SDK in your infrastructure, or Messages API in your application
6. Least-privilege toolsEngineer and system ownersRead-only tools first, narrow scopes, row limits, human approval for any write or send
7. ObservabilityPlatform teamPer-session logs, token and cost tracking, alerting on failures and runaway loops
8. Pin versionsEngineerPinned model IDs and skill versions, so an upload by someone else does not change production
9. Staged releaseProduct ownerInternal users, then a small external group, with the evaluation set rerun on every change

Where do custom agent projects go wrong?

  • Choosing Managed Agents and discovering late that the contract requires ZDR or a BAA.
  • Giving the agent write tools before evaluations exist, so nobody can tell whether a change made it better or worse.
  • Running the Agent SDK shell and file tools on a host that also holds production credentials. Anthropic's self-hosted sandbox guide gives the same advice: keep your API key off the worker host.
  • Feeding untrusted content (email, web pages, tickets) into an agent with broad tools. Tool output can carry prompt injection; limit what the agent can do after reading it.
  • Building a custom agent for work an existing product already does, then owning that code forever.

Abstrakt Solutions, a Certified Services Partner in the Claude Partner Network, designs and builds custom agents on the Messages API, the Agent SDK and Managed Agents, often connected to Salesforce. See our Claude custom agents services or the Sync Payments case study on bringing Claude into Salesforce workflows.

Questions people also ask

What is the difference between the Claude Agent SDK and Managed Agents?

The Agent SDK is a library you run in your own process, giving you Claude Code's tools and loop. Managed Agents is a hosted harness: Anthropic runs the loop and the sandbox, or you run only the tool-execution sandbox, and you drive it through the API.

Is Claude Managed Agents eligible for zero data retention or HIPAA?

Not as of October 2026. Anthropic states that Managed Agents is stateful by design and not eligible for ZDR or HIPAA BAA coverage. You can delete sessions and uploaded files through the API.

How much does Claude Managed Agents cost?

The Claude pricing page lists $0.08 per session-hour of active runtime plus standard token rates. Web search and code execution have their own charges.

Can we run Claude agents on AWS or Google Cloud?

Yes. Current models are on Amazon Bedrock, Google Cloud, Microsoft Foundry and Claude Platform on AWS, and the Agent SDK can authenticate through Bedrock, Claude Platform on AWS, Google Cloud's Agent Platform or Foundry. Managed Agents is available on Claude Platform on AWS and Claude Models on Google Cloud (Anthropic managed), with some feature differences.

Can we use our Claude Enterprise subscription to power a custom agent?

Use API key authentication for agents you build. Anthropic does not allow third-party products built on the Agent SDK to offer claude.ai login or subscription limits unless previously approved.

Chris Gooding, President & CEO of Abstrakt Solutions
Chris Gooding
President & CEO, Abstrakt Solutions
LinkedIn →

Tech Talk

A monthly brief for the people who own Salesforce, AI and revenue technology

What changed in Salesforce and AI this month, and what to do about it.

One email a month. Written by the consultants who deliver the work, not by a marketing team, for the leaders who make the technology decisions.

  • What changed in Salesforce, AI, integration and RevOps, and what it means for your org
  • At least one framework, checklist or reference architecture you can take into a meeting
  • Honest opinions, including when we disagree with what a vendor is selling
  • No sales sequence. We do not sell from this list

Consultant analysis, not vendor recaps. One click to leave.

One email a month. Your industry and your address, nothing else. We never share either, and you can unsubscribe from the bottom of any issue. See what’s in Tech Talk →

Call (314) 916-4095 Book a consultation
Call (314) 916-4095 Book a call