Agent Sandbox Registry

agent-sandbox

Python Hello 模板

无英文版

tests/fixtures/templates/python-hello/README.md

Python Hello 模板

Fixture:本目录是主仓库的离线测试夹具(client-sdk/tests/test_templates/ 使用), 不是发布真源。模板内容、索引与发布以 alibaba-agent-sandbox/awesome-templates 为准。

基础 Python 开发环境模板。

安装

以下 abx 命令由独立 cli 仓库中的 abx CLI 提供(npm install -g @agent-sandbox/cli)。

abx template install ./examples/templates/python-hello --registry-type local

使用

abx create --template python-hello

命名命令(端到端)

容器启动后会自动运行 commands.py,监听端口 9000,提供以下命名命令(用 abx sandbox command list <sandbox-id> 查看):

# 打招呼
abx run <sandbox-id> hello --arg name=Alice
# → Hello, Alice!

# 执行 Python 代码
abx run <sandbox-id> run_script --arg 'code=print(1+1)'
# → 2

SDK 侧等价写法:

from agent_sandbox import Sandbox

sandbox = Sandbox.create(template="python-hello")
result = sandbox.run("hello", name="Alice")
print(result.value)  # Hello, Alice!

上传 / 下载

abx upload <sandbox-id> ./local_file.txt /app/remote.txt
abx download <sandbox-id> /app/remote.txt ./local_file.txt

环境