Skip to content

[Feature Request] Integrate CubeSandbox with Pi Agent #698

Description

@chaojixinren

【问题描述】

CubeSandbox 定位为面向 AI Agent 的安全沙箱服务,并与 e2b 协议兼容。Pi Agent是当前主流的终端型 AI 编码 Agent——它们在隔离环境中运行代码、编辑文件、执行命令,天然适合以 CubeSandbox 沙箱作为执行后端或运行环境:既可以把编码 Agent 本身跑在沙箱里获得隔离、可复现的运行环境,也可以让 Agent 编排系统按需拉起 CubeSandbox 沙箱执行其生成的代码。

在实际生产中,我们打算将 CubeSandbox 沙箱运用于 Pi Agent 的自进化Agentic RL 尝试中,目前 CubeSandbox 已有面向 OpenAI Agents、OpenClaw 等的集成示例,但尚未提供 Pi Agent 终端型编码 Agent 的集成文档与可运行示例。

【期望内容/功能改进】

1)为 Pi Agent 编写端到端集成指南,覆盖:在 CubeSandbox 中运行该 Agent 所需的模板构建、运行环境与依赖、API Key 等敏感配置的注入方式、网络与出口策略(Agent 需访问 LLM API)、以及会话保持与状态持久化(借助快照保存 Agent 运行状态、跨会话恢复);
2)提供可运行的示例工程(置于 examples/ 下),包含模板定义与构建脚本、最小可复现的调用流程,以及能在本地部署环境跑通的 README;
3)给出典型使用场景与最佳实践:如把编码 Agent 跑在沙箱内做隔离开发、用沙箱执行 Agent 生成的代码并回收结果、利用快照实现 Agent 长时任务的断点续跑等;
4)补充常见问题与排错(鉴权失败、出口被拦截、镜像拉取、超时等),并与平台既有出口管控、鉴权、模板机制对齐;
5)文档纳入 docs/guide/integrations 体系,遵循既有集成文档模板与风格。


Problem Description

CubeSandbox is positioned as a secure sandbox service for AI Agents and is compatible with the e2b protocol. Pi Agent is a mainstream terminal-based AI coding Agent. It runs code, edits files, and executes commands in isolated environments, which makes it naturally suitable for using CubeSandbox as an execution backend or runtime environment.

CubeSandbox could support Pi Agent in two main ways:

  1. Run the coding Agent itself inside a CubeSandbox environment to provide isolation and reproducible runtime conditions.
  2. Allow an Agent orchestration system to launch CubeSandbox instances on demand to execute code generated by the Agent.

In our production scenario, we plan to use CubeSandbox for Pi Agent self-evolution and Agentic RL experiments. CubeSandbox already provides integration examples for OpenAI Agents, OpenClaw, and similar frameworks, but there is currently no integration documentation or runnable example for Pi Agent as a terminal-based coding Agent.

Expected Feature / Improvement

I would like CubeSandbox to provide official documentation and examples for integrating with Pi Agent.

The integration should ideally include the following:

  1. End-to-end integration guide for Pi Agent

    The guide should cover:

    • Template creation and build process required to run Pi Agent inside CubeSandbox.
    • Runtime environment and dependency setup.
    • Secure injection of sensitive configurations such as API keys.
    • Network and outbound access policies, since the Agent needs to access LLM APIs.
    • Session persistence and state recovery.
    • Using snapshots to save Agent runtime state and resume work across sessions.
  2. Runnable example project

    Please provide a runnable example under the examples/ directory, including:

    • Template definitions.
    • Build scripts.
    • A minimal reproducible invocation flow.
    • A README that can be followed in a local deployment environment.
  3. Typical use cases and best practices

    The documentation should cover common scenarios such as:

    • Running the coding Agent inside a sandbox for isolated development.
    • Using CubeSandbox to execute code generated by the Agent and collect results.
    • Using snapshots to support checkpointing and resuming long-running Agent tasks.
  4. FAQ and troubleshooting

    Please include troubleshooting guidance for common issues, such as:

    • Authentication failures.
    • Blocked outbound network access.
    • Image pull failures.
    • Timeout issues.
    • Problems related to platform authentication, outbound access control, and template mechanisms.
  5. Documentation placement and style

    The documentation should be added under the existing docs/guide/integrations structure and follow the style and format of the existing integration documents.

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions