尚未偵測到更新。GitHub 發布版本後會顯示在這裡。
Runnable examples for building on Tenki
翻譯準備中
正在載入完整 README。
檢視完整 README ↗Runnable examples for Tenki Sandbox. Each folder under examples/ is a short program you can run against the live API and copy into your own project.
The first example takes about 10 minutes once you have an API key.
You need:
tk_ API key. Create keys at app.tenki.cloud.run.mjs scripts, including the first example, use top-level await using, which Node 22 cannot parse. The verify scripts run on Node 20, which is what CI uses.tenki login to store the key.git clone https://github.com/LuxorLabs/cookbook.git
cd cookbook
Each example is self-contained: its own README, source, and dependencies. Nothing installs at the repository root. Install dependencies inside the example you run, with npm install or a virtual environment and that folder's requirements.txt.
export TENKI_API_KEY="tk_..."
The JavaScript SDK also reads TENKI_AUTH_TOKEN. Python examples and CI use TENKI_API_KEY. Each example README names the variable it expects.
To store the key, run tenki login --api-key <key>. That writes ~/.config/tenki/config.yaml, and every verify script reads it from there. Some demos, including examples/run-code-in-a-sandbox/run.mjs, read the environment only, so export the key before you run those.
Tenki infers the workspace from the API key. If you set TENKI_WORKSPACE_ID, most scripts pass it through. Most verify and agent scripts also read current_workspace_id from ~/.config/tenki/config.yaml. DeerFlow's provider is the exception: when the account has more than one workspace, set workspace_id in the sandbox: block of its config (DeerFlow example). Authentication and client setup are in the Sandbox SDK guide.
Start with Run code in a sandbox. It is the create, execute, and dispose lifecycle in about 15 lines of JavaScript.
cd examples/run-code-in-a-sandbox
npm install
node run.mjs
exit 0 -> 42
The script creates a sandbox, runs python3 -c "print(6 * 7)" inside it, prints the exit code and output, and terminates the sandbox when the script ends, because await using disposes it. The sandbox boots in about 2 seconds and is billed per second.
The same loop in Python is Run code with Python. From the repository root:
cd examples/run-code-python
uv venv --python 3.12
uv pip install -r requirements.txt
.venv/bin/python run.py
run.py prints exit 0 -> 42. It also accepts a key saved by tenki login.
Open the example closest to what you are building and follow its README. Agent-framework examples need a model provider key, such as OPENAI_API_KEY, to run the agent. Their verify scripts call the sandbox tool directly and do not need that key.
| Example | What it covers |
|---|---|
| Run code in a sandbox | Create a sandbox, run a command, dispose it |
| Work with files | Read, write, and list files with the TypeScript SDK |
| Expose a port | Serve a web app on a public preview URL |
| Pause, snapshot, and resume | Preserve a sandbox and pick up where it left off |
| Run code with Python | The official tenki Python SDK |
| Run a full-stack app | Serve an API, frontend, and seeded database from one sandbox |
Give an agent a sandbox to run the code it writes.
| Example | What it covers |
|---|---|
| Claude Agent SDK | Tenki as the backend for the SDK's bash and file tools |
| Vercel AI SDK | Tenki as the AI SDK's experimental_sandbox |
| LangChain (JavaScript) | Sandboxed code interpreter tool |
| LangChain (Python) | Code-execution tool for a Python agent |
| CrewAI | Run agent-generated code in a sandbox |
| OpenAI Agents SDK | Sandboxed execution as an agent tool |
| LlamaIndex | Sandboxed execution as a FunctionTool |
| Hugging Face smolagents | Remote Python executor for a CodeAgent |
| Pi Durable | Remote execution env. Every tool call runs in a sandbox |
| AG2 | Native sandbox backend for shell and code tools |
| PraisonAI | One shared sandbox for a whole agent team |
以上為 README 的開頭部分。其餘內容請閱讀原文。 檢視完整 README ↗