python-hello

Official

A minimal Python hello world template for testing

Install

abx
abx template deploy ./python-hello -y --alias python-hello
abx create --template python-hello
# TemplateID from `abx --json template deploy` is also accepted

On each provider

Express publishes this directory with abx template deploy. The other providers do not declare templates.build, so they do not register this directory.

ProviderStatusHow
Alibaba Cloud Agent Sandbox Express EditionDeploys on ExpressUse →
Alibaba Cloud Agent Sandbox Container EditionExisting template idUse →
CubeSandboxExisting template idUse →
E2BExisting template idUse →
OpenSandboxImage URI, not this directoryUse →

About

中文版 | English


English

A minimal Python development environment template.

Installation

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

Usage

abx create --template python-hello

Named Commands (End-to-End)

After the container starts, commands.py runs automatically, listens on port 9000, and provides the following named commands:

# Greet
abx run <sandbox-id> hello --name Alice
# → Hello, Alice!

# Run Python code
abx run <sandbox-id> run_script --code "print(1+1)"
# → 2

Equivalent SDK usage:

from agent_sandbox import Sandbox

sandbox = Sandbox.create_sync(template="python-hello")
result = sandbox.run_sync("hello", name="Alice")
print(result)  # Hello, Alice!

Upload / Download

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

Environment

  • Base image: python:3.12-slim
  • Python 3.12 and pip; in-sandbox package agent-sandbox-server
  • Working directory: /app

中文

基础 Python 开发环境模板。

安装

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

使用

abx create --template python-hello

命名命令(端到端)

容器启动后会自动运行 commands.py,监听端口 9000,提供以下命名命令:

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

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

SDK 侧等价写法:

from agent_sandbox import Sandbox

sandbox = Sandbox.create_sync(template="python-hello")
result = sandbox.run_sync("hello", name="Alice")
print(result)  # Hello, Alice!

上传 / 下载

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

环境

  • 基础镜像: python:3.12-slim
  • Python 3.12 and pip; in-sandbox package agent-sandbox-server
  • 工作目录: /app

Deploy and local e2e

Install and register this template:

abx template install alibaba-agent-sandbox/awesome-templates//python-hello

From this directory (build, push, and register):

abx deploy

From the repository root, with agent-sandbox-server and httpx installed:

python3 scripts/run_local_e2e.py

That starts python3 commands.py in this directory and runs e2e_test.py.

Files