Skip to main content

Claude Sandbox SDK

管理 Claude Agent 沙盒服务的 CLI 工具。

安装

pip install claude-sandbox-sdk

使用

启动服务

# 前台运行
claude-sandbox start

# 后台运行
claude-sandbox start --daemon

# 指定端口
claude-sandbox start --port 8300

# 指定地址和端口
claude-sandbox start --host 127.0.0.1 --port 8300

停止服务

claude-sandbox stop

# 强制终止
claude-sandbox stop --force

重启服务

claude-sandbox restart

# 重启并更换端口
claude-sandbox restart --port 8300

查看状态

claude-sandbox status

查看日志

# 查看最近 50 行
claude-sandbox logs

# 实时跟踪
claude-sandbox logs --follow

# 查看最近 100 行
claude-sandbox logs --lines 100

配置

配置优先级: CLI 参数 > 环境变量 > 默认值

配置项 环境变量 默认值
host CLAUDE_SANDBOX_HOST 0.0.0.0
port CLAUDE_SANDBOX_PORT 8200
log_level CLAUDE_SANDBOX_LOG_LEVEL INFO

数据目录

服务运行时数据存储在 ~/.claude-sandbox/:

  • pid — 运行中的进程 PID
  • port — 当前使用的端口
  • server.log — 服务日志

开发

# 克隆仓库
git clone https://github.com/ai302/claude-sandbox-sdk.git
cd claude-sandbox-sdk

# 安装开发依赖
pip install -e ".[dev]"

# 运行测试
pytest

# 代码检查
ruff check .
mypy app/

发布

# 构建
python -m build

# 上传到 PyPI
twine upload dist/*

API 端点

端点 方法 说明
/health GET 健康检查
/sessions GET 列出会话
/sessions/{id} GET 获取会话信息
/sessions/{id}/messages GET 获取会话消息
/ws/chat WebSocket 聊天接口

License

MIT

Metadata

Release files for claude-sandbox-sdk 0.1.29

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for claude-sandbox-sdk 0.1.29
File Size Uploaded Provenance Actions
claude_sandbox_sdk-0.1.29.tar.gz 73.1 kB Without provenance Details for claude_sandbox_sdk-0.1.29.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for claude-sandbox-sdk 0.1.29
File Interpreter ABI Platform Actions
claude_sandbox_sdk-0.1.29-py3-none-any.whl Python 3 none any Details for claude_sandbox_sdk-0.1.29-py3-none-any.whl

Total release size: 157.8 kB

Release files / claude_sandbox_sdk-0.1.29.tar.gz

Download URL claude_sandbox_sdk-0.1.29.tar.gz
Size 73.1 kB
Tags Source
SHA-256 checksum
How to use checksums
a652735f859aae16a2109dd6895539c4a792c7d00b071d10db82ed1a5d505ee2
BLAKE2b-256 checksum
How to use checksums
537fc72f0e72e75155f6d69b8292bb3e74dfe8a323083151e1f9fd660fa35372
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.13

Release files / claude_sandbox_sdk-0.1.29-py3-none-any.whl

Download URL claude_sandbox_sdk-0.1.29-py3-none-any.whl
Size 84.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c5ba3e69e15cd72503d1dc7d43d448ef295144b0364a9ce9bc62b6e044a7bb0e
BLAKE2b-256 checksum
How to use checksums
6478525172b0fa76bda62ee03736a1b902bee6ae4d2c77b018e186b121d972e4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.13

Security for claude-sandbox-sdk 0.1.29

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.29 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page