Skip to main content

Infinity

An open-source Rust framework for building agents, on a runtime efficient enough to fit fifty thousand of them in the memory of a Raspberry Pi.

Infinity does for agents what async did for threads. Instead of blocking on slow tools, Infinity agents run them concurrently, yield while they wait, and cost nothing until the next event arrives.

let system = AgentSystemBuilder::new_local(
InMemoryConversationStore::new(),
InMemoryStateStore::new(),
StaticModel::new(provider, "claude-sonnet-4-5").await?,
)
.start();

let mut thread = system.thread_builder().launch().await;
thread.send_user_text("Write a haiku about Rust").await?;

while let Some(event) = thread.recv().await {
println!("{event:?}");
}

Scale

Fifty thousand agents on a Raspberry Pi

In Infinity, an idle agent is pure data: between turns, an agent is just its conversation history, with no task, no stack, and no open connection. After twenty tool-calling turns, an agent occupies about 154 KB, so fifty thousand of them fit in under 8 GB of RAM.

Agents spend most of their lives waiting: builds run for twenty minutes, webhooks fire hours later, humans reply tomorrow. Runtimes that hold a process per agent pay for all of that time; Infinity hibernates a waiting agent for free and wakes it on the next message.

How the runtime works →
010k20k30k40k50kresident agents0 GB2 GB4 GB6 GB8 GBprocess memory (RSS)Raspberry Pi 5 (8 GB)50,000 agents in 7.9 GB154 KB per agent
Measured: idle resident agents after 20 tool-calling turns each (2,000,000 completions total), single thread, in-memory stores. Benchmark source

Asynchrony

Agents that never block

Infinity gives agents primitives for asynchrony. A tool call can stay open as a subscription and stream events, so a shell command delivers each chunk of output as it happens; spawn_thread forks a subagent that works in parallel; sleep awaits a timer or the next event without polling.

Like actor systems, Infinity organizes agents into agent systems: pools of concurrent agents that share nothing and communicate through in-order messages to each agent's mailbox. The runtime intelligently schedules the whole pool the way an async executor schedules tasks, so thousands of agents make progress on a few threads.

The Agent System API →

Serverless

Scale to zero is the default

Because agent turns never block, Infinity is perfect for serverless environments: on AWS Lambda, each SQS FIFO delivery triggers one step of the runtime, which loads state, runs the completion, dispatches tool calls, and exits.

Infinity agents can run forever with near-zero cost: an agent waiting on a three-day CI pipeline costs exactly nothing until something happens. The included CDK constructs deploy the whole stack in a few lines, and the same agent code runs unchanged on your laptop and in the cloud.

Deploy on AWS Lambda →
Traditional Agent Runtime
time →← compute × memoryAgent AAgent BAgent CAgent DAgent EAgent F

Reactive Agent Protocol

Asynchronous tools over the network

Agent RuntimeRAP ToolExternaltime →RuntimesubscriberegistersubscribedRuntime💤💤💤webhookprocess💤eventRuntime

With the Reactive Agent Protocol (RAP), you can serve tools over the network without holding a connection open: the runtime invokes a tool with one POST carrying a callback URL, and the server delivers results or subscription events whenever they are ready. Tool servers scale like ordinary web services, and they can serve hibernating agents that currently have no process at all.

Infinity supports MCP out of the box: stdio and HTTP MCP servers connect in-process, and existing MCP servers run unchanged through a compatibility layer. Anyone can implement the open RAP specification in their own runtime or tool server.

Read the RAP spec →

Infinity Code

A coding agent built for concurrent work

Chat

Implement the login and session system with JWT tokens and parameterized queries

I'll implement the auth module. All database queries will use parameterized statements.

Edit src/auth/token.ts (9 lines)

Edit src/auth/login.ts (19 lines)

Edit src/auth/session.ts (17 lines)

Done. Implemented login.ts, session.ts, and token.ts. All queries use parameterized statements and passwords are compared with timing-safe equality.

Infinity Code is a coding harness built on the runtime, and you extend it with the same RAP and MCP tools as any other Infinity agent. It boots instantly, and because sessions live in a daemon, the interface responds with zero latency even when the agent runs remotely. The agent runs builds and tests in the background while their output streams in, edits in parallel threads with stacked sandboxes, and hands you each result as a diff to review.

Get Infinity Code →

Enter the stack at any layer

Embed the runtime through its Rust API, deploy it on Lambda with the CDK constructs, build tool servers on RAP, or take Infinity Code as a finished coding agent. Everything is open source and MCP-compatible, so your existing tools keep working while your agents stop paying to wait.