Skip to content

feat: enhance custom_sandbox_example with full two-layer teaching demo#102

Merged
chickenlj merged 1 commit intoagentscope-ai:mainfrom
flystar32:feat/custom-sandbox-example
May 7, 2026
Merged

feat: enhance custom_sandbox_example with full two-layer teaching demo#102
chickenlj merged 1 commit intoagentscope-ai:mainfrom
flystar32:feat/custom-sandbox-example

Conversation

@flystar32
Copy link
Copy Markdown
Contributor

Summary

Enhance the custom_sandbox_example to serve as a comprehensive teaching demo for both layers of sandbox customization.

Changes

New Files

  • CustomClient.java — Fake/stub BaseClient implementation demonstrating the sandbox runtime instance lifecycle, with multi-platform comparison comments (Docker / K8s / ECS / Serverless)
  • CustomClientStarter.java — Custom BaseClientStarter factory with Builder pattern
  • README.md / README-zh.md — Bilingual documentation covering both infrastructure and application layer customization

Modified Files

  • CustomSandbox.java — Added callTool() override with before/after/error hooks, fakeToolExecution(), and convenience methods (runPython() / runShell())
  • Main.java — Rewritten as a 10-step end-to-end lifecycle demo using only custom components

Key Design Decisions

  • All implementations use fake/stub code — no real runtime environment needed to run the example
  • Uses "sandbox runtime backend" terminology instead of "container runtime backend" to reflect that the backend can be any compute resource (Docker, ECS, VM, K8s Pod, Serverless, etc.)
  • API naming note added: although the code API uses "container" (e.g. createContainer, ContainerCreateResult), it is a general-purpose abstraction

How to Test

cd examples/simple_agent_use_examples/custom_sandbox_example
mvn clean compile
mvn exec:java -Dexec.mainClass="io.agentscope.Main"

- Add CustomClient (fake/stub BaseClient) demonstrating sandbox runtime
  instance lifecycle with multi-platform comparison comments
- Add CustomClientStarter (BaseClientStarter factory) with Builder pattern
- Rewrite CustomSandbox with callTool hooks (before/after/error),
  fakeToolExecution, and convenience methods (runPython/runShell)
- Rewrite Main.java as 10-step end-to-end lifecycle demo
- Add bilingual documentation (README.md + README-zh.md) covering
  both infrastructure layer and application layer customization
- Use 'sandbox runtime backend' terminology instead of 'container runtime'

Change-Id: I25dfb16c7196e55d8c9309ce055858412042b35e
Co-developed-by: Qoder <noreply@qoder.com>
@chickenlj chickenlj merged commit a532524 into agentscope-ai:main May 7, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants