Boot a sandbox from a resident app and let an LLM agent use it. This example boots apps/filesystem, turns its exports (write_file, read_file and the rest) into tools, and asks the agent to write a file and read it back. It is the agent-side counterpart to the hello-world resident app.
It uses the experimental agent framework, @berthos/agents, which isn't published. Run it from a clone.
Needs Docker, and ANTHROPIC_API_KEY or OPENAI_API_KEY. Without a key the script prints SKIP and exits cleanly.
pnpm install && pnpm build # once, from the repo root
cd examples/agents/simple-agent
export ANTHROPIC_API_KEY=sk-ant-... # or OPENAI_API_KEY
pnpm startOn a machine whose kernel can't enforce (Docker Desktop on macOS or Windows), the boot is refused. Prefix the command with BERTH_ALLOW_UNENFORCED=1 to run it unenforced, or see enforcement by platform.
The script prints what the agent said and the tools it called.
index.mjsis the shortest form:runAgent({ apps, task })with nollmpassed. It picks up whichever ofANTHROPIC_API_KEYorOPENAI_API_KEYis set, boots, runs one task and cleans up.index-manual.mjsis the fuller form: an explicitLLMProvider, andAgentandComputerhandles you keep for more than one turn. It also accepts--connect=<name>to attach to a runningberth os upinstance.
Building the image and starting the container on every run adds seconds. Boot once with berth os up, then reconnect:
# from the repo root
berth os up my-agent --apps=apps/filesystem
cd examples/agents/simple-agent
node index-manual.mjs --connect=my-agent # reconnects in milliseconds
berth os down my-agent # from the repo root, when you're doneSee the Berth OS reference.
For Crew.withManager() and Crew.networked(), see experimental/agents/examples and the agents reference.