diff --git a/README.md b/README.md index 5fb85b4e..e7828de0 100644 --- a/README.md +++ b/README.md @@ -166,7 +166,6 @@ OpenSandbox provides examples covering SDK usage, agent integrations, browser au - **[gemini-cli](examples/gemini-cli/README.md)** - Run Google Gemini CLI inside OpenSandbox. - **[codex-cli](examples/codex-cli/README.md)** - Run OpenAI Codex CLI inside OpenSandbox. - **[kimi-cli](examples/kimi-cli/README.md)** - Run [Kimi CLI](https://github.com/MoonshotAI/kimi-cli) (Moonshot AI) inside OpenSandbox. -- **[iflow-cli](examples/iflow-cli/README.md)** - Run iFLow CLI inside OpenSandbox. - **[langgraph](examples/langgraph/README.md)** - LangGraph state-machine workflow that creates/runs a sandbox job with fallback retry. - **[google-adk](examples/google-adk/README.md)** - Google ADK agent using OpenSandbox tools to write/read files and run commands. - **[nullclaw](examples/nullclaw/README.md)** - Launch a [Nullclaw](https://github.com/nullclaw/nullclaw) Gateway inside a sandbox. @@ -242,4 +241,4 @@ This project is open source under the [Apache 2.0 License](LICENSE). - DingTalk: Join the [OpenSandbox technical discussion group](https://qr.dingtalk.com/action/joingroup?code=v1,k1,A4Bgl5q1I1eNU/r33D18YFNrMY108aFF38V+r19RJOM=&_dt_no_comment=1&origin=11) ## Star History -[![Star History Chart](https://api.star-history.com/svg?repos=alibaba/OpenSandbox&type=date&legend=top-left)](https://www.star-history.com/#alibaba/OpenSandbox&type=date&legend=top-left) \ No newline at end of file +[![Star History Chart](https://api.star-history.com/svg?repos=alibaba/OpenSandbox&type=date&legend=top-left)](https://www.star-history.com/#alibaba/OpenSandbox&type=date&legend=top-left) diff --git a/docs/.vitepress/scripts/docs-manifest.mjs b/docs/.vitepress/scripts/docs-manifest.mjs index 88a2d1ee..d393433f 100644 --- a/docs/.vitepress/scripts/docs-manifest.mjs +++ b/docs/.vitepress/scripts/docs-manifest.mjs @@ -153,7 +153,6 @@ const shortTitleByPath = { "examples/gemini-cli/README.md": "Gemini CLI", "examples/google-adk/README.md": "Google ADK", "examples/host-volume-mount/README.md": "Host Volume Mount", - "examples/iflow-cli/README.md": "iFlow CLI", "examples/langgraph/README.md": "LangGraph", "examples/playwright/README.md": "Playwright", "examples/README.md": "Examples Overview", @@ -198,7 +197,6 @@ const shortTitleByPathZh = { "examples/gemini-cli/README.md": "Gemini CLI", "examples/google-adk/README.md": "Google ADK", "examples/host-volume-mount/README.md": "宿主机目录挂载", - "examples/iflow-cli/README.md": "iFlow CLI", "examples/langgraph/README.md": "LangGraph", "examples/playwright/README.md": "Playwright", "examples/README.md": "示例总览", diff --git a/docs/README_zh.md b/docs/README_zh.md index fb152993..75f51a00 100644 --- a/docs/README_zh.md +++ b/docs/README_zh.md @@ -162,7 +162,6 @@ OpenSandbox 提供了丰富的示例来演示不同场景下的沙箱使用方 - **[gemini-cli](../examples/gemini-cli/README.md)** - 在 OpenSandbox 中运行 Google Gemini CLI。 - **[codex-cli](../examples/codex-cli/README.md)** - 在 OpenSandbox 中运行 OpenAI Codex CLI。 - **[kimi-cli](../examples/kimi-cli/README.md)** - 在 OpenSandbox 中运行 [Kimi CLI](https://github.com/MoonshotAI/kimi-cli)(Moonshot AI)。 -- **[iflow-cli](../examples/iflow-cli/README.md)** - 在 OpenSandbox 中运行 iFlow CLI。 - **[langgraph](../examples/langgraph/README.md)** - 基于 LangGraph 状态机编排沙箱任务与回退重试。 - **[google-adk](../examples/google-adk/README.md)** - 使用 Google ADK 通过 OpenSandbox 工具读写文件并执行命令。 - **[nullclaw](../examples/nullclaw/README.md)** - 在沙箱中启动 Nullclaw Gateway。 @@ -243,4 +242,4 @@ OpenSandbox 提供了丰富的示例来演示不同场景下的沙箱使用方 ## Star History -[![Star History Chart](https://api.star-history.com/svg?repos=alibaba/OpenSandbox&type=date&legend=top-left)](https://www.star-history.com/#alibaba/OpenSandbox&type=date&legend=top-left) \ No newline at end of file +[![Star History Chart](https://api.star-history.com/svg?repos=alibaba/OpenSandbox&type=date&legend=top-left)](https://www.star-history.com/#alibaba/OpenSandbox&type=date&legend=top-left) diff --git a/examples/README.md b/examples/README.md index ea17791f..589c0088 100644 --- a/examples/README.md +++ b/examples/README.md @@ -10,7 +10,6 @@ Examples for common OpenSandbox use cases. Each subdirectory contains runnable c - ☁️ [**docker-ossfs-volume-mount**](docker-ossfs-volume-mount): Mount OSSFS volumes in Docker runtime (inline credentials, subpath, sharing) - 🎯 [**rl-training**](rl-training): Reinforcement learning training loop inside a sandbox - Claude [**claude-code**](claude-code): Call Claude (Anthropic) API/CLI within the sandbox -- iFlow [**iflow-cli**](iflow-cli): CLI invocation template for iFlow/custom HTTP LLM services - Google Gemini [**gemini-cli**](gemini-cli): Call Google Gemini within the sandbox - OpenAI [**codex-cli**](codex-cli): Call OpenAI/Codex-like models within the sandbox - Kimi [**kimi-cli**](kimi-cli): Call Kimi Code CLI (Moonshot AI) within the sandbox @@ -25,7 +24,7 @@ Examples for common OpenSandbox use cases. Each subdirectory contains runnable c ## How to Run - Set basic environment variables (e.g., `export SANDBOX_DOMAIN=...`, `export SANDBOX_API_KEY=...`) -- Add provider-specific variables as needed (e.g., `ANTHROPIC_API_KEY`, `OPENAI_API_KEY`, `GEMINI_API_KEY`, `KIMI_API_KEY`, `IFLOW_API_KEY`/`IFLOW_ENDPOINT`, etc.; model selection is optional) +- Add provider-specific variables as needed (e.g., `ANTHROPIC_API_KEY`, `OPENAI_API_KEY`, `GEMINI_API_KEY`, `KIMI_API_KEY`, etc.; model selection is optional) - Navigate to the example directory and install dependencies: `pip install -r requirements.txt` (or refer to the Dockerfile in the directory) - Then execute: `python main.py` - To run in a container, build and run using the `Dockerfile` in the directory diff --git a/examples/iflow-cli/README.md b/examples/iflow-cli/README.md deleted file mode 100644 index 195debca..00000000 --- a/examples/iflow-cli/README.md +++ /dev/null @@ -1,48 +0,0 @@ -# iFlow CLI Example - -Call OpenAI-compatible iFlow/custom HTTP endpoints via the `iflow-cli` npm package in OpenSandbox. - -## Start OpenSandbox server [local] - -Pre-pull the code-interpreter image (includes Node.js): - -```shell -docker pull sandbox-registry.cn-zhangjiakou.cr.aliyuncs.com/opensandbox/code-interpreter:v1.0.2 - -# use docker hub -# docker pull opensandbox/code-interpreter:v1.0.2 -``` - -Start the local OpenSandbox server, logs will be visible in the terminal: - -```shell -uv pip install opensandbox-server -opensandbox-server init-config ~/.sandbox.toml --example docker -opensandbox-server -``` - -## Create and Access the iFlow Sandbox - -```shell -# Install OpenSandbox package -uv pip install opensandbox - -# Run the example (requires SANDBOX_DOMAIN / SANDBOX_API_KEY / IFLOW_API_KEY; IFLOW_BASE_URL has a default) -uv run python examples/iflow-cli/main.py -``` - -The script installs the iFlow CLI (`npm install -g @iflow-ai/iflow-cli@latest`) at runtime (Node.js is already in the code-interpreter image), then sends a simple request `iflow "Compute 1 + 1."`. The API key and endpoint are passed via environment variables. - -![iFlow screenshot](./screenshot.jpg) - -## Environment Variables - -- `SANDBOX_DOMAIN`: Sandbox service address (default: `localhost:8080`) -- `SANDBOX_API_KEY`: API key if your server requires authentication (optional for local) -- `SANDBOX_IMAGE`: Sandbox image to use (default: `sandbox-registry.cn-zhangjiakou.cr.aliyuncs.com/opensandbox/code-interpreter:v1.0.2`) -- `IFLOW_API_KEY`: Your iFlow/DashScope API key (required) -- `IFLOW_BASE_URL`: The iFlow API endpoint URL (default: `https://apis.iflow.cn/v1`) -- `IFLOW_MODEL_NAME`: Model to use (default: `qwen3-coder-plus`) - -## References -- [iFlow CLI](https://cli.iflow.cn/) - Official iFlow CLI site diff --git a/examples/iflow-cli/main.py b/examples/iflow-cli/main.py deleted file mode 100644 index a78e8b0a..00000000 --- a/examples/iflow-cli/main.py +++ /dev/null @@ -1,82 +0,0 @@ -# Copyright 2025 Alibaba Group Holding Ltd. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import asyncio -import os -from datetime import timedelta - -from opensandbox import Sandbox -from opensandbox.config import ConnectionConfig -from opensandbox.models.sandboxes import SandboxImageSpec - - -def _required_env(name: str) -> str: - value = os.getenv(name) - if not value: - raise RuntimeError(f"{name} is required") - return value - - -async def _print_execution_logs(execution) -> None: - for msg in execution.logs.stdout: - print(f"[stdout] {msg.text}") - for msg in execution.logs.stderr: - print(f"[stderr] {msg.text}") - if execution.error: - print(f"[error] {execution.error.name}: {execution.error.value}") - - -async def main() -> None: - domain = os.getenv("SANDBOX_DOMAIN", "localhost:8080") - api_key = os.getenv("SANDBOX_API_KEY") - iflow_api_key = _required_env("IFLOW_API_KEY") - iflow_base_url = os.getenv("IFLOW_BASE_URL", "https://apis.iflow.cn/v1") - iflow_model_name = os.getenv("IFLOW_MODEL_NAME", "qwen3-coder-plus") - image = os.getenv( - "SANDBOX_IMAGE", - "sandbox-registry.cn-zhangjiakou.cr.aliyuncs.com/opensandbox/code-interpreter:v1.0.2", - ) - - config = ConnectionConfig( - domain=domain, - api_key=api_key, - request_timeout=timedelta(seconds=60), - ) - - sandbox = await Sandbox.create( - image, - connection_config=config, - env={ - "IFLOW_apiKey": iflow_api_key, - "IFLOW_baseUrl": iflow_base_url, - "IFLOW_modelName": iflow_model_name, - }, - ) - - async with sandbox: - # Install iFlow CLI (Node.js is already in the code-interpreter image) - install_exec = await sandbox.commands.run( - "npm install -g @iflow-ai/iflow-cli@latest" - ) - await _print_execution_logs(install_exec) - - # Send a simple request via iFlow CLI - run_exec = await sandbox.commands.run('iflow "Compute 1+1=?."') - await _print_execution_logs(run_exec) - - await sandbox.kill() - - -if __name__ == "__main__": - asyncio.run(main()) diff --git a/examples/iflow-cli/screenshot.jpg b/examples/iflow-cli/screenshot.jpg deleted file mode 100644 index 842e69bd..00000000 Binary files a/examples/iflow-cli/screenshot.jpg and /dev/null differ