CLAUDE LABJP
APPLY — ant CLI v1.30.0 introduces ant apply, which creates and updates agents, environments, skills, memory stores, and deployments straight from files in your repositoryLOCKFILE — Commit the claude-lock.json it writes. Skip that step and every later run quietly creates fresh resources instead of updating the ones you already havePLAN — ant apply prints a plan and waits for your approval before applying. If you intend to run it unattended in CI, decide how that approval is handled firstPRICING — The increase to $3 / $15 per MTok for Claude Sonnet 5 never happened. The introductory $2 / $10 is now simply the standard priceSOURCE — Prices and version numbers get garbled in secondhand coverage. It is worth checking the release notes on platform.claude.com before you quote either oneBETA — Agent Skills and the Skills API left beta, so the skills-2025-10-02 header is optional now. The Files API did too, but there the header still changes the response shapeAPPLY — ant CLI v1.30.0 introduces ant apply, which creates and updates agents, environments, skills, memory stores, and deployments straight from files in your repositoryLOCKFILE — Commit the claude-lock.json it writes. Skip that step and every later run quietly creates fresh resources instead of updating the ones you already havePLAN — ant apply prints a plan and waits for your approval before applying. If you intend to run it unattended in CI, decide how that approval is handled firstPRICING — The increase to $3 / $15 per MTok for Claude Sonnet 5 never happened. The introductory $2 / $10 is now simply the standard priceSOURCE — Prices and version numbers get garbled in secondhand coverage. It is worth checking the release notes on platform.claude.com before you quote either oneBETA — Agent Skills and the Skills API left beta, so the skills-2025-10-02 header is optional now. The Files API did too, but there the header still changes the response shape
Articles/API & SDK
API & SDK/2026-04-10Advanced

The Boundaries That Trip You Up Moving Claude Managed Agents to Production — Agent / Environment / Session, and Keeping Keys Out of the Sandbox

A production design walkthrough for Claude Managed Agents, checked against the SDK's actual type definitions. Covers which object owns sandbox control, persistent memory, credentials, delegation, and cost measurement.

managed-agents6production111architecture10api39enterprise5security18

Premium Article

I Assumed I Could Just Add a Config Block

When I started moving a Managed Agents prototype toward something production-shaped, my mental model was simple: keep adding blocks to agents.create() — a sandbox block, a memory block, an audit block — and eventually the shape would be right. Configuration lives in one place, surely.

None of those blocks exist.

Rather than keep guessing, I installed the SDK and read the types directly. In @anthropic-ai/sdk 0.120.0, the top level of AgentCreateParams holds exactly ten fields:

FieldWhat it carries
name / descriptionHuman-readable identity
modelModel ID — a bare string, or an object carrying id and speed
systemSystem prompt
toolsBuilt-in toolset / MCP tools / custom tools
mcp_serversMCP server connections
skillsSkill references
multiagentDelegation roster
metadata / betasArbitrary key-values / beta headers

sandbox, memory, observability, optimization, audit, permissions, checkpoint, lifecycle — zero matches for every one of them. There is no instructions either; the field is system.

More fundamentally, client.agents is undefined. The surface lives under client.beta.agents. And client.beta.agents.batch, .pipelines, .secrets, and client.beta.sessions.run all return undefined as well.

So the blueprint I had in my head — "declare everything on the agent" — was never a real shape to begin with. Carry that misreading into a design review and you end up redrawing the skeleton during implementation. What follows is a walk through each boundary I misread, in the order the mistakes cost me time.

If you're new to the platform, the concepts and setup path are covered in the complete guide to Claude Managed Agents — that's the smoother entry point.

The Skeleton Splits Three Ways

Configuration doesn't gather in one place because responsibility is split across three objects.

ObjectOwnsLifetime
AgentModel, system prompt, tools, MCP servers, skills, delegation rosterPersistent, versioned
EnvironmentHow the container is provisioned (runtime, network policy)Persistent, reused
SessionOne interaction. References an agent and environment; carries resources, vaults, budgetDisposable

The agent loop itself runs on Anthropic's orchestration layer. The container is where tools execute. Once that division clicks, the absence of sandbox settings on the agent stops feeling like an omission: the agent's persona and the workshop it operates in are defined separately and composed at session time.

The minimal shape looks like this:

import Anthropic from "@anthropic-ai/sdk";
 
const client = new Anthropic();
 
// 1. The workshop template (reused across sessions)
const env = await client.beta.environments.create({
  name: "report-workspace",
  config: {
    type: "cloud",
    networking: { type: "unrestricted" },
  },
});
 
// 2. The agent — persistent and versioned. Never create this in the request path.
const agent = await client.beta.agents.create({
  name: "sales-report-agent",
  model: "claude-sonnet-4-6",
  system: "You produce monthly sales reports. Always source figures from attached data.",
  tools: [{ type: "agent_toolset_20260401" }],
});
 
// 3. The session — created per run, referencing the agent by ID
const session = await client.beta.sessions.create({
  agent: agent.id,
  environment_id: env.id,
  title: "April 2026 monthly report",
});

One operational note that matters more than it looks: don't call agents.create() inside your request path. Agents are persistent objects, so creating one per request quietly accumulates near-duplicate configs. Store the returned ID and reference it from then on.

Environment names are unique, too. Recreating one with an existing name returns a 409. If you want CI to run this idempotently, write the create-then-fall-back-to-lookup branch up front rather than discovering it on a Friday deploy.

Thank you for reading this far.

Continue Reading

What follows includes implementation code, benchmarks, and practical content we hope you'll find useful. This site runs without ads — server and development costs are supported entirely by members like you. If it's been helpful, we'd be truly grateful for your support.

WHAT YOU'LL LEARN
Catch the wrong-object mistake early — knowing which of Agent / Environment / Session owns each setting, grounded in the SDK's own types rather than guesswork
Draw a precise line around what the Vault boundary protects, so MCP credentials never enter the sandbox and you can say exactly what that does and does not buy you
Measure runtime spend instead of estimating it, using the active_seconds and list_cost the session reports about itself
Secure payment via Stripe · Cancel anytime

Unlock This Article

Get full access to the rest of this article. Buy once, read anytime. This site is ad-free — your support goes directly toward keeping it running.

or
Unlock all articles with Membership →
Share

Thank You for Reading

Claude Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • Copy-paste ready implementation code
  • New advanced guides published daily
  • $5/mo or $15 for lifetime access
View Membership →

Related Articles

API & SDK2026-04-12
Claude Managed Agents Sandbox Design: Running Autonomous Agents Safely in Production
A deep dive into the sandbox architecture of Claude Managed Agents, with production-ready security patterns and implementation code for running autonomous agents safely.
API & SDK2026-04-09
Claude Managed Agents: Anthropic's New Agent Infrastructure (April 2026)
Anthropic launched Claude Managed Agents in public beta on April 8, 2026. This guide covers everything: sandboxed execution, authentication, checkpoints, scoped permissions, pricing, and how to get started building production-ready AI agents 10x faster.
API & SDK2026-06-27
When Claude API Streaming Stops Without an Error: Detecting Silent Stalls and Resuming Mid-Stream
How to catch the 'silent stall' where Claude API streaming stops with no exception at all, using a content-level watchdog that times the gap between tokens, plus a resume path that carries received text forward as an assistant prefill, and a four-layer timeout budget for long-running automation.
📚RECOMMENDED BOOKS
Build a Large Language Model (From Scratch)
Sebastian Raschka
LLM Dev
Prompt Engineering for LLMs
Berryman & Ziegler
Prompting
AI Engineering
Chip Huyen
AI Eng
* Contains affiliate links