Loading...
  • Messages
  • Managed Agents
  • Admin
Search...
⌘K
First steps
OverviewQuickstartPrototype in Console
Define your agent
Agent setupToolsMCP connectorPermission policiesAgent Skills
Configure agent environment
Cloud environment setupCloud container reference
Delegate work to your agent
Start a sessionSession event streamSubscribe to webhooksDefine outcomesAuthenticate with vaults
Manage agent context
Access GitHubAttach and download files
Advanced orchestration
Multiagent sessions
Working with files
Files APIPDF supportImages and vision
Skills
OverviewBest practicesSkills for enterprise
MCP
Remote MCP servers
Claude on cloud platforms
Claude Platform on AWS
Log in
Cloud environment setup
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...

Solutions

  • AI agents
  • Code modernization
  • Coding
  • Customer support
  • Education
  • Financial services
  • Government
  • Life sciences

Partners

  • Amazon Bedrock
  • Google Cloud's Vertex AI

Learn

  • Blog
  • Courses
  • Use cases
  • Connectors
  • Customer stories
  • Engineering at Anthropic
  • Events
  • Powered by Claude
  • Service partners
  • Startups program

Company

  • Anthropic
  • Careers
  • Economic Futures
  • Research
  • News
  • Responsible Scaling Policy
  • Security and compliance
  • Transparency

Learn

  • Blog
  • Courses
  • Use cases
  • Connectors
  • Customer stories
  • Engineering at Anthropic
  • Events
  • Powered by Claude
  • Service partners
  • Startups program

Help and security

  • Availability
  • Status
  • Support
  • Discord

Terms and policies

  • Privacy policy
  • Responsible disclosure policy
  • Terms of service: Commercial
  • Terms of service: Consumer
  • Usage policy
Managed Agents/Configure agent environment

Cloud environment setup

Customize cloud containers for your sessions.

Environments define the container configuration where your agent runs. You create an environment once, then reference its ID each time you start a session. Multiple sessions can share the same environment, but each session gets its own isolated container instance.

This page covers type: cloud environments. To run sandboxes on your own infrastructure, see Self-hosted sandboxes.

All Managed Agents API requests require the managed-agents-2026-04-01 beta header. The SDK sets the beta header automatically.

Create an environment

ant beta:environments create \
  --name "python-dev" \
  --config '{type: cloud, networking: {type: unrestricted}}'

The name must be unique within your organization and workspace.

Use the environment in a session

Pass the environment ID as a string when creating a session.

session = client.beta.sessions.create(
    agent=agent.id,
    environment_id=environment.id,
)

Configuration options

Packages

The packages field pre-installs packages into the container before the agent starts. Packages are installed by their respective package managers and cached across sessions that share the same environment. When multiple package managers are specified, they run in alphabetical order (apt, cargo, gem, go, npm, pip). You can optionally pin specific versions; the default is latest.

ant beta:environments create <<'YAML'
name: data-analysis
config:
  type: cloud
  packages:
    pip:
      - pandas
      - numpy
      - scikit-learn
    npm:
      - express
  networking:
    type: unrestricted
YAML

Supported package managers:

FieldPackage managerExample
aptSystem packages (apt-get)"ffmpeg"
cargoRust (cargo)"[email protected]"
gemRuby (gem)"rails:7.1.0"
goGo modules"golang.org/x/tools/cmd/goimports@latest"
npmNode.js (npm)"[email protected]"
pipPython (pip)"pandas==2.2.0"

Networking

The networking field controls the container's outbound network access. It does not impact the web_search or web_fetch tools' allowed domains.

ModeDescription
unrestrictedFull outbound network access, except for a general safety blocklist. This is the default.
limitedRestricts container network access to the allowed_hosts list. Further access is enabled via the allow_package_managers and allow_mcp_servers bool.
config = {
    "type": "cloud",
    "networking": {
        "type": "limited",
        "allowed_hosts": ["api.example.com"],
        "allow_mcp_servers": True,
        "allow_package_managers": True,
    },
}

For production deployments, use limited networking with an explicit allowed_hosts list. Follow the principle of least privilege by granting only the minimum network access your agent requires, and regularly audit your allowed domains.

When using limited networking:

  • allowed_hosts specifies domains the container can reach. These must be HTTPS-prefixed.
  • allow_mcp_servers permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the allowed_hosts array. Defaults to false.
  • allow_package_managers permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the allowed_hosts array. Defaults to false.

Environment lifecycle

  • Environments persist until explicitly archived or deleted.
  • Multiple sessions can reference the same environment.
  • Each session gets its own container instance. Sessions do not share file system state.
  • Environments are not versioned. If you frequently update your environments, you may want to log these updates on your side, to map environment state with sessions.

Manage environments

# List environments
ant beta:environments list

# Retrieve a specific environment
ant beta:environments retrieve --environment-id "$ENVIRONMENT_ID"

# Archive an environment (read-only, existing sessions continue)
ant beta:environments archive --environment-id "$ENVIRONMENT_ID"

# Delete an environment (only if no sessions reference it)
ant beta:environments delete --environment-id "$ENVIRONMENT_ID"

Pre-installed runtimes

Cloud containers include common runtimes out of the box. See Container reference for the full list of pre-installed languages, databases, and utilities.

Was this page helpful?

  • Create an environment
  • Use the environment in a session
  • Configuration options
  • Packages
  • Networking
  • Environment lifecycle
  • Manage environments
  • Pre-installed runtimes