Skip to main content
You attach files to an agent with the sandbox option on defineAgent(). Pass defineSandbox({ files }) to copy paths from src/files/ into the agent’s /workspace/agent directory before each prompt, where the agent can read them like local files. files accepts:
  • A directory under src/files/ (a file set), as a string
  • One or more directories and/or specific files, as a string array
  • Inline { path, file } entries when you seed content directly in code

Attach an entire file set

Pass a string to attach every file in src/files/{name}/:
src/agents/support.ts
If the folder doesn’t exist, the agent fails to build with an “unknown file set” error. A shared set can be attached to any number of agents.

Attach multiple sets

Pass an array of set names when an agent needs several shared folders:
Each set’s folder layout is preserved under /workspace/agent. If two sets contain the same relative path with different contents, resolve fails with a conflicting-path error.

Attach specific files

Pass paths relative to src/files/ to attach only those files (or a nested directory):
You can mix sets and file paths in the same array: files: ["planetscale", "support/macros.md"].

Where files land at runtime

Paths are relative to the file set root (the top-level folder under src/files/):
Reference the paths the agent should read from the systemPrompt so the agent knows they’re there:
Keystroke reconciles attached files on each prompt after deploy: new files are created, changed files overwrite previous deployed content, and removed files are deleted. Agent-created paths that were never part of the attachment are preserved. The agent system prompt includes the full list of deploy-owned paths so the model knows which files may be overwritten.

Verify it

After deploying, prompt the agent and confirm it’s using the files:

Next steps

Files overview

What files are and how they differ from skills.

Attach skills to agents

Add reusable playbooks alongside files.

Build agents

Configure models, tools, skills, and files.

Run agents

Prompt agents and inspect their sessions.