infinity README

项目的 README,来自 github.com/hydro-project/infinity。合并为一个 markdown 文件:README.md。

Infinity

Infinity is a Rust framework for building massively concurrent agentic systems, light enough to fit 75k agents 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, "global.anthropic.claude-sonnet-4-6").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:?}");
}

Between turns, an agent is pure data, just its conversation history with no task, no stack, and no open connection, so a waiting agent hibernates for free and wakes on the next message. The same agent code runs unchanged in a resident process on your laptop and on serverless platforms like AWS Lambda, where scale to zero is the default.

Get started today at infinity.hydro.run!

Learn More

infinity (hydro-project/infinity)

正在搜索数据库…

这是什么?Infinity 是一个用 Rust 编写的框架,用于构建大规模并发的智能体系统。智能体在等待慢速工具时会主动让出执行权,而不是阻塞。在两轮对话之间,智能体只是纯数据,没有运行中的进程,因此可以免费休眠,并在收到下一条消息时被唤醒。这使得单个实例可以在树莓派这样小的硬件上承载多达 75,000 个智能体。
这是我可以在其上开发的框架,还是现成的智能体?它是一个运行时/框架层,对智能体的作用就像 async 之于线程。Infinity Code 是基于它构建的独立编程智能体,用来展示该运行时能够实现的功能。
我该怎么开始用它构建?先按照 infinity.hydro.run 上的快速入门,构建你的第一个智能体,然后阅读架构指南,了解让出执行和休眠机制的工作原理。
我能复用现有的 MCP 工具服务器吗?可以。现有的 MCP 服务器可以通过 Reactive Agent Protocol(RAP)中的兼容层原样运行。RAP 也是一个开放规范,任何人都可以为新的工具服务器实现它。
等待中的智能体会保持网络连接或进程打开吗?不会。RAP 会在工具结果和订阅事件就绪时直接投递,即使是当前没有任何进程的智能体也能收到,因此智能体等待期间无需保持任何连接。
同一套智能体代码能同时在我的笔记本电脑和无服务器平台上运行吗?可以。同一份智能体代码无需修改,即可在笔记本电脑上的常驻进程中运行,也能在 AWS Lambda 等无服务器平台上运行;后者默认会自动缩容至零。
什么是 Reactive Agent Protocol(RAP)?RAP 是一个开放协议,用于通过网络提供工具服务,且无需保持连接打开。结果和订阅事件会在就绪时投递,即使是没有运行中进程的智能体也能收到;任何人都可以实现该规范。
什么是 Infinity Code?Infinity Code 是基于 Infinity 运行时构建的编程智能体,专为并发工作而设计:它可以在后台运行构建和测试并流式输出结果,在并行线程中编辑代码并使用堆叠式沙箱,并将每个结果以差异(diff)的形式交给你审阅。
为什么它能在树莓派上承载 75,000 个智能体?两轮对话之间,智能体只是它的对话历史,没有任务、调用栈或打开的连接。因此空闲的智能体可以免费休眠,只有在收到新消息被唤醒时才消耗资源,从而让每个智能体的内存开销极小。
大小
4.9 MB
星标
836
时长
7个月
提交 · 90 天