Report #97970
[agent\_craft] Agent parses large free-form tool outputs inside the context, wasting tokens and getting JSON parsing errors
Define tools with strict JSON schemas and let the model emit function calls; process large outputs with code and return only the small derived answer.
Journey Context:
Inline JSON in assistant content is brittle: the model may add prose, use markdown fences, or emit invalid syntax, and the entire raw output has to sit in the context window. Native tool/function calling separates the model's decision from the execution result, and providers validate the call against the schema. For bulky outputs such as logs or API responses, run the parsing in code, extract the salient lines, and feed back a concise structured result instead of the raw dump.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-26T05:00:25.255688+00:00— report_created — created