Loading...
  • ビルド
  • 管理
  • モデルと料金
  • クライアントSDK
  • APIリファレンス
Search...
⌘K
Log in
クラウド環境のセットアップ
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
ビルド/エージェント環境の設定

クラウド環境のセットアップ

セッション用のクラウドコンテナをカスタマイズします。

Was this page helpful?

環境は、エージェントが実行されるコンテナ設定を定義します。環境を一度作成し、セッションを開始するたびにそのIDを参照します。複数のセッションが同じ環境を共有できますが、各セッションは独自の分離されたコンテナインスタンスを取得します。

すべてのManaged Agents APIリクエストには、managed-agents-2026-04-01ベータヘッダーが必要です。SDKはベータヘッダーを自動的に設定します。

環境の作成

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

nameは組織とワークスペース内で一意である必要があります。

セッションで環境を使用する

セッションを作成する際に、環境IDを文字列として渡します。

設定オプション

パッケージ

packagesフィールドは、エージェントが起動する前にコンテナにパッケージをプリインストールします。パッケージはそれぞれのパッケージマネージャーによってインストールされ、同じ環境を共有するセッション間でキャッシュされます。複数のパッケージマネージャーが指定された場合、アルファベット順(apt、cargo、gem、go、npm、pip)で実行されます。特定のバージョンをオプションで固定することができます。デフォルトは最新版です。

サポートされているパッケージマネージャー:

フィールドパッケージマネージャー例
aptシステムパッケージ (apt-get)"ffmpeg"
cargoRust (cargo)"[email protected]"
gemRuby (gem)"rails:7.1.0"
goGoモジュール"golang.org/x/tools/cmd/goimports@latest"
npmNode.js (npm)"[email protected]"

ネットワーキング

networkingフィールドは、コンテナのアウトバウンドネットワークアクセスを制御します。web_searchまたはweb_fetchツールの許可ドメインには影響しません。

モード説明
unrestricted一般的な安全ブロックリストを除く、完全なアウトバウンドネットワークアクセス。これがデフォルトです。
limitedコンテナのネットワークアクセスをallowed_hostsリストに制限します。allow_package_managersおよびallow_mcp_serversのboolを介してさらなるアクセスが有効になります。

本番環境のデプロイメントでは、明示的なallowed_hostsリストを使用したlimitedネットワーキングを使用してください。エージェントが必要とする最小限のネットワークアクセスのみを付与する最小権限の原則に従い、許可されたドメインを定期的に監査してください。

limitedネットワーキングを使用する場合:

  • allowed_hostsは、コンテナがアクセスできるドメインを指定します。これらはHTTPSプレフィックスが必要です。
  • allow_mcp_serversは、allowed_hosts配列にリストされているものを超えて、エージェントに設定されたMCPサーバーエンドポイントへのアウトバウンドアクセスを許可します。デフォルトはfalseです。
  • allow_package_managersは、allowed_hosts配列にリストされているものを超えて、公開パッケージレジストリ(PyPI、npmなど)へのアウトバウンドアクセスを許可します。デフォルトはfalseです。

環境のライフサイクル

  • 環境は明示的にアーカイブまたは削除されるまで持続します。
  • 複数のセッションが同じ環境を参照できます。
  • 各セッションは独自のコンテナインスタンスを取得します。セッションはファイルシステムの状態を共有しません。
  • 環境はバージョン管理されません。環境を頻繁に更新する場合は、環境の状態とセッションをマッピングするために、これらの更新を自分側でログに記録することをお勧めします。

環境の管理

プリインストール済みランタイム

クラウドコンテナには、一般的なランタイムがすぐに使える状態で含まれています。プリインストール済みの言語、データベース、ユーティリティの完全なリストについては、コンテナリファレンスを参照してください。

session = client.beta.sessions.create(
    agent=agent.id,
    environment_id=environment.id,
)
ant beta:environments create <<'YAML'
name: data-analysis
config:
  type: cloud
  packages:
    pip:
      - pandas
      - numpy
      - scikit-learn
    npm:
      - express
  networking:
    type: unrestricted
YAML
pipPython (pip)"pandas==2.2.0"
config = {
    "type": "cloud",
    "networking": {
        "type": "limited",
        "allowed_hosts": ["api.example.com"],
        "allow_mcp_servers": True,
        "allow_package_managers": True,
    },
}
# 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"