<< Home | Tech
82% token reduction and 93% latency reduction
| Area | Tech |
| AI used | Any |
| Source | r/AI_Agents |
| Posted | 2026-11-15 |
The move
Pass tool outputs by variable reference instead of re-typing JSON blobs.Steps
- Identify redundant JSON blobs in your agent's tool output.
- Store the output in a variable or reference file.
- Pass the variable reference to the LLM instead of the full JSON.
- Verify that the agent can still access the data via the reference.
Prompt for your AI
Refactor my agent's tool execution logic to pass outputs by variable reference ($var) instead of injecting the full JSON blob into the context window. Ensure the agent can still process the data correctly while minimizing token usage.
What happened
Engineers found that popular agent frameworks waste thousands of tokens by loading unused tool schemas on every turn. By switching to variable references for tool outputs, they significantly optimized performance. This change reduced token consumption and latency for production agent systems.Watch out
Ensure the agent has a reliable way to resolve the variable reference. Verify that the system architecture supports persistent storage for the referenced data.Give it to your agent
Read https://howtheyuse.ai/p/82-token-reduction-and-93-latency-reduction.md and help me do this.