Code Mode is an approach to make AI agents more reliable, more efficient, and better suited for complex workflows in io.Connect environments.
Today, most AI agents work by calling tools one step at a time. That works well for simple tasks, but it starts to break down as soon as the number of available tools grows. The LLM has to inspect a long list of tools, choose the right one, provide the right arguments, process the returned data, and then decide what to do next. For multi-step workflows, every tool call becomes another potential failure point.
This also creates a context problem. Each tool comes with descriptions, schemas, instructions, and often large responses. As more tools are added, more of the model’s context window is consumed before the user’s task even begins.
Instead of exposing hundreds of tools directly to the LLM, with Code Mode the model gets access to a much smaller set of capabilities: it can inspect the available API, request the specific definitions it needs, and generate a short code snippet that executes the required logic. That code is then run in a controlled sandbox, where it can call the relevant io.Connect-aware APIs, loop over results, filter data, branch conditionally, and return only the final answer.
Example use case - find the adviser for a client named Amelia Reid. In the traditional tool-calling flow, the full client list is returned to the LLM, which then has to reason over the data. With Code Mode, the LLM writes a small script that calls the client API, searches for Amelia Reid programmatically, extracts the adviser field, and returns only the result.
The full dataset doesn’t need to leave the machine. The LLM doesn’t need to reason over records. The logic is executed deterministically in code, rather than through a long chain of tool calls. This can reduce token usage, lower the chance of hallucinations, and make complex workflows easier to execute reliably.
For io.Connect, there’s a bonus since many environments already contain rich application networks: applications, methods, intents, FDC3 intents, and other capabilities. Code Mode gives a way to expose that capability to AI systems without flooding the model with every tool definition and every data payload upfront.
The implementation is a restricted Python sandbox that can run both on desktop and in the browser. It doesn’t require Docker, a cloud-based sandbox, or extra infrastructure. On desktop, the runtime can run as a local process. In the browser, it can run through WebAssembly. The sandbox is intentionally limited: it doesn’t have access to external Python libraries or native Python modules. It can only execute basic Python logic and call the specific external functions we expose to it, using the APIs and applications already available in the io.Connect environment.