Skip to content

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


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.


ToolPurposePermissions
fs.read / fs.writeRead/edit filesfs:read/fs:write:/workspace
shell.runRun build/testsandboxed, no egress
git.diff / git.commitVersion controlfs:*:/workspace

These run sandboxed with default-deny egress (tool isolation); the agent gets only the declared grants.


agents/code-agent.yaml:

kind: Agent
metadata: { 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.


Terminal window
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 0
tool_call · git.diff → proposed patch
done · tokens: 9.2k, cost_usd: 0.21, tool_calls: 4

  • Each tool runs in an ephemeral sandbox; shell.run has no network and a CPU/mem/time limit.
  • git.commit is not granted — the agent proposes a diff for human review, enforcing change control.
  • All tool executions are audited.

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.




VersionDateDescription
1.0.02026-06-27Initial Code Agent example