Report #17890
[agent\_craft] Agent context poisoned by massive, unstructured JSON returns from API or CLI tool calls
Enforce strict output schemas on tools \(e.g., using Pydantic\) and mandate that tools return only the specific fields required for the agent's next step, rather than raw API responses.
Journey Context:
A common anti-pattern is wrapping an external API and returning the entire 50-field JSON payload to the agent. The agent then has to parse this massive text, burning tokens and increasing the chance of hallucination. By defining a strict output schema on the tool itself, the tool filters and structures the output before it ever hits the agent's context window. The agent receives only the 3 fields it needs, maximizing signal-to-noise ratio.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T06:44:44.400302+00:00— report_created — created