Example: Code Agent
Document ID: EX-003
File Path: docs/16-examples/code-agent.md
Version: 1.0.0
Status: Draft
Owner: Developer Relations Team
Last Updated: 2026-06-27
1. Goal
Section titled “1. Goal”Build a tool-using agent that operates on a repository — reading files, running commands, and proposing changes — with tools executed safely in the Tool Runtime sandbox.
2. Tools Used
Section titled “2. Tools Used”| Tool | Purpose | Permissions |
|---|---|---|
fs.read / fs.write | Read/edit files | fs:read/fs:write:/workspace |
shell.run | Run build/test | sandboxed, no egress |
git.diff / git.commit | Version control | fs:*:/workspace |
These run sandboxed with default-deny egress (tool isolation); the agent gets only the declared grants.
3. Define the Agent
Section titled “3. Define the Agent”agents/code-agent.yaml:
kind: Agentmetadata: { name: code-agent }spec: model_selector: { capability: chat, class: frontier } instructions: | You are a coding assistant. Read relevant files before editing. Run tests after changes. Propose a git diff; do not commit without approval. tools: [fs.read, fs.write, shell.run, git.diff] policies: [no-network-egress] budget: { max_cost_usd: 1.00 }A frontier-class model is selected for harder reasoning; a policy forbids egress.
4. Run
Section titled “4. Run”wovyr agents run -f agents/code-agent.yaml --stream \ --input '{"message":"Add input validation to parse_config and run the tests."}'The stream shows tool calls interleaved with reasoning:
tool_call · fs.read("src/config.rs")delta · "I'll add validation for empty keys..."tool_call · fs.write("src/config.rs", ...)tool_call · shell.run("cargo test") → exit 0tool_call · git.diff → proposed patchdone · tokens: 9.2k, cost_usd: 0.21, tool_calls: 45. Sandbox & Safety
Section titled “5. Sandbox & Safety”- Each tool runs in an ephemeral sandbox;
shell.runhas no network and a CPU/mem/time limit. git.commitis not granted — the agent proposes a diff for human review, enforcing change control.- All tool executions are audited.
6. Add Human Approval (optional)
Section titled “6. Add Human Approval (optional)”Wrap the commit step in a workflow with a
human task so a reviewer approves the diff
before git.commit runs — see Customer Support for the
pattern.
7. Observe
Section titled “7. Observe”- Per-tool duration, resources, and cost in the trace inspector.
- Tool execution metrics in monitoring.
8. Related Documents
Section titled “8. Related Documents”9. Revision History
Section titled “9. Revision History”| Version | Date | Description |
|---|---|---|
| 1.0.0 | 2026-06-27 | Initial Code Agent example |