ls, cat, grep, write files, run scripts — anything bash can do — against data that lives in your S3 bucket.
The whole thing is about 30 lines.
1. Create a workspace disk
2. Wrap disk.exec as a tool
Steps 2 and 3 below use the Vercel AI SDK (TypeScript). The pattern is identical from Python — wrap Disk.exec as a tool in whatever agent framework you use (for example, tool use with the Anthropic Python SDK). Only the framework glue changes; the Disk.exec call is the same.
Using the Vercel AI SDK, an exec tool is a handful of lines:
- Keep the description minimal. The agent doesn’t need to know it’s on Archil, or that this is a “workspace disk” — those are implementation details that cost reasoning tokens.
"Run a shell command inside the workdir."is enough. - Return a single string, not an object. Prefix with
exit Nand let the model read the output. Splitting stdout and stderr into fields forces the model to think about which field to read first; most of the time it doesn’t matter. - Don’t over-describe the argument.
z.string()without a.describe()is fine — the model knows what a shell command is.
3. Run the agent
- Call
bash({ command: "ls" })to discover what’s there. - Call
bash({ command: "grep ERROR app.log" })to find the errors. - Summarize the result.
archil mount ...) to inspect what the agent has been doing.
Patterns
Persistent agent memory
Write to a known path and the next agent run sees it:Fan-out across the bucket
A map-reduce across every file in a directory:disk.grep instead — it fans the same work out in a single call and returns structured matches.
Running a local agent, too
If the agent runs on your laptop but wants the same workspace, mount the disk alongside:exec-backed bash tool does.