
The biggest mistake we're all making with AI agents
Vozniak Nazar•November 17, 2025
Share:
The biggest mistake we're all making with AI agents? We're making them use tools like humans, instead of like developers.
For months, we've been giving LLMs direct access to tools through function calling - essentially teaching them a foreign language of special tokens and JSON schemas. It works, but it's inefficient and expensive.
We just tried something different: Instead of having agents call tools directly, we have them write code that calls the tools.
The results shocked us:
- Agents handle 5x more tools without getting confused
- Multi-step workflows use 60-70% fewer tokens
- Complex orchestration that used to fail now works flawlessly
- We've already saved our clients millions of tokens (and counting)
Why does this work?
LLMs have seen millions of lines of real production code. They've debugged TypeScript, composed APIs, and written functions in the wild. But tool-calling? That's a synthetic skill learned in a lab.
How we did it:
- Convert all tool definitions (MCP servers, APIs, etc.) into a clean TypeScript interface
- Put the agent in a secure sandbox with only one "tool": execute code
- Let the agent write actual TypeScript to orchestrate the workflow
- Run the code, return only what matters
The agent writes the logic once, and the code handles the plumbing. No more pumping intermediate results back through the LLM's context window.
This isn't a small optimization. It's a fundamental rethinking of how we structure AI workflows. Your agents become more capable, your costs drop dramatically, and your users stop hitting token limits.
The future of AI agents isn't better function calling. It's letting them be the developers we've been training them to be all along.
For months, we've been giving LLMs direct access to tools through function calling - essentially teaching them a foreign language of special tokens and JSON schemas. It works, but it's inefficient and expensive.
We just tried something different: Instead of having agents call tools directly, we have them write code that calls the tools.
The results shocked us:
- Agents handle 5x more tools without getting confused
- Multi-step workflows use 60-70% fewer tokens
- Complex orchestration that used to fail now works flawlessly
- We've already saved our clients millions of tokens (and counting)
Why does this work?
LLMs have seen millions of lines of real production code. They've debugged TypeScript, composed APIs, and written functions in the wild. But tool-calling? That's a synthetic skill learned in a lab.
How we did it:
- Convert all tool definitions (MCP servers, APIs, etc.) into a clean TypeScript interface
- Put the agent in a secure sandbox with only one "tool": execute code
- Let the agent write actual TypeScript to orchestrate the workflow
- Run the code, return only what matters
The agent writes the logic once, and the code handles the plumbing. No more pumping intermediate results back through the LLM's context window.
This isn't a small optimization. It's a fundamental rethinking of how we structure AI workflows. Your agents become more capable, your costs drop dramatically, and your users stop hitting token limits.
The future of AI agents isn't better function calling. It's letting them be the developers we've been training them to be all along.
Share: