CHAPTER 06 · Tools and Tool Execution · 5 / 5
Key takeaways
- A tool is a harness-run function described to the model by a JSON schema. The model asks; the harness executes.
- The execution pipeline is parse, validate, check permissions, execute, capture, truncate and format. Skipping the middle steps is what makes toy agents brittle.
- Return structured results: exit code, timing, and a clear success or failure signal, not just raw stdout.
- Truncate huge outputs by keeping the head and the tail and eliding the middle, where the signal usually lives at the ends.
- Keep the tool list small and context-appropriate; it helps the model choose and protects your prompt cache.
Original source: Jonathan Fulton's "Inside the Agent Harness" analysis of the Codex codebase, plus Anthropic's How Claude Code works.