Traditional AI agents have EVERY tool loaded into context from the stat, call tools one at a time, each requiring a full inference round trip, for example: "delete all completed tasks," that means: call findTasks, wait, call deleteTask for task 1, wait, call for task 2... each call resends the entire conversation history, so tokens compound fast and there is a lot of wasted tokens and inference.
Codecall is an open source approach that lets agents write and execute TypeScript code in a secured Deno sandbox to orchestrate multiple tools programmatically, like calling an API (which is really all a tool is!)
So instead of 20+ inference passes and 90k+ tokens, the agent can just write and execute:
const tasks = await tools.todoist.findTasks({ completed: true });
for (const task of tasks) {
await tools.todoist.deleteTask({ id: task.id });
}
2 inference passes. The code runs in a Deno sandbox, executes all operations programmatically, and returns a result. In our demo, for one example, this reduced tokens by 74.7% and tool calls by 92.3% while being much faster as well.
How it works (high level) ->
1. There are only 2 tools (readFile, executeCode) + a file tree. The agent reads SDK files on demand, so a 30 tool setup is effectively the to a 5 tool setup (only the file tree gets bigger)
2. Multiple tool calls happen in one execution, not N inference calls for N operations... because the agent can write code to execute and orchestrate multiple tools (like API) this significantly reduces the number of passes + tokens per request
3. Models have a 10-50% failure rate searching through large datasets in context. Code like users.filter(u => u.role === "admin") is deterministic and avoids those failure, so not only is it more efficient & cheaper. its also often much more accurate when doing operations with lots of data!
We also generate TypeScript SDK files from MCP tool definitions, so the agent sees clean types and function signatures. It also learns from errors, so when a tool call fails, it updates the SDK file with learned constraints so future agents avoid the same mistake.
Codecall works with any MCP server (stdio/http). Would love feedback from anyone interested in or building more complex agents :)
Interesting! First time im seeing this course, thanks for the link. From a high level it’s definitely in the same code first agents family then. After reading about smolagents for a bit i think the main things Codecall adds are TypeScript + generated SDKs, progressive tool discovery (readFile + executeCode instead of exposing every tool directly), and the single script sandboxed execution first flow w/ learned constraints, rather than the more of the "multi‑step ReAct loop" that smolagents prioritizes (like in the link below), which is a bit more like traditional tool calling w/ code ->
Traditional AI agents have EVERY tool loaded into context from the stat, call tools one at a time, each requiring a full inference round trip, for example: "delete all completed tasks," that means: call findTasks, wait, call deleteTask for task 1, wait, call for task 2... each call resends the entire conversation history, so tokens compound fast and there is a lot of wasted tokens and inference.
Codecall is an open source approach that lets agents write and execute TypeScript code in a secured Deno sandbox to orchestrate multiple tools programmatically, like calling an API (which is really all a tool is!)
So instead of 20+ inference passes and 90k+ tokens, the agent can just write and execute:
const tasks = await tools.todoist.findTasks({ completed: true }); for (const task of tasks) { await tools.todoist.deleteTask({ id: task.id }); }
2 inference passes. The code runs in a Deno sandbox, executes all operations programmatically, and returns a result. In our demo, for one example, this reduced tokens by 74.7% and tool calls by 92.3% while being much faster as well.
How it works (high level) ->
1. There are only 2 tools (readFile, executeCode) + a file tree. The agent reads SDK files on demand, so a 30 tool setup is effectively the to a 5 tool setup (only the file tree gets bigger)
2. Multiple tool calls happen in one execution, not N inference calls for N operations... because the agent can write code to execute and orchestrate multiple tools (like API) this significantly reduces the number of passes + tokens per request
3. Models have a 10-50% failure rate searching through large datasets in context. Code like users.filter(u => u.role === "admin") is deterministic and avoids those failure, so not only is it more efficient & cheaper. its also often much more accurate when doing operations with lots of data!
We also generate TypeScript SDK files from MCP tool definitions, so the agent sees clean types and function signatures. It also learns from errors, so when a tool call fails, it updates the SDK file with learned constraints so future agents avoid the same mistake.
Codecall works with any MCP server (stdio/http). Would love feedback from anyone interested in or building more complex agents :)
This is basically what you learn in the huggingface smolagents course (months ago)...
They call it CodeAct
https://huggingface.co/learn/agents-course/en/unit2/smolagen...
Interesting! First time im seeing this course, thanks for the link. From a high level it’s definitely in the same code first agents family then. After reading about smolagents for a bit i think the main things Codecall adds are TypeScript + generated SDKs, progressive tool discovery (readFile + executeCode instead of exposing every tool directly), and the single script sandboxed execution first flow w/ learned constraints, rather than the more of the "multi‑step ReAct loop" that smolagents prioritizes (like in the link below), which is a bit more like traditional tool calling w/ code ->
https://huggingface.co/blog/smolagents