rig-core 不再默认开启 serde_json 的 preserve_order 与 float_roundtrip,JSON 键会按名称排序、浮点低位可能变化,需要时自行在 Cargo.toml 开启;使用 #[tokio::main] 需额外给 tokio 加 macros 和 rt-multi-thread 特性;项目处于 pre-1.0,版本升级含破坏性变更,需看 changelog 与迁移说明。
rig
0xPlaygroundsMIT活跃维护用 Rust 构建模块化、可扩展 LLM 应用的框架,把模型调用、Agent 编排和工具集成做成可组合组件,适合追求性能与类型安全的团队。
⚙️🦀 Build modular and scalable LLM Applications in Rust
cargo add rig
cargo install rig-cli
rigREADME 未说明显存或 GPU 要求;agent 需 Rust 1.97.1 或更新版本,运行于 Linux 和 macOS;核心与 agent 运行时支持 wasm32-unknown-unknown。
用 Rust 构建模块化 LLM 应用的库,附带可插件扩展的终端编码 agent
用 Rust 构建模块化、可扩展 LLM 应用的框架,把模型调用、Agent 编排和工具集成做成可组合组件,适合追求性能与类型安全的团队。
核心能力
- 统一接口接入 20+ 模型提供商与 10+ 向量库
- Agent 支持工具调用、多轮流式与类型化钩子
- 覆盖补全、嵌入、转写、音频与图像生成
- 遵循 GenAI 语义约定接入 OpenTelemetry
- rig-cassette 录制并回放 agent 的副作用
容易踩的坑
- v0.46.0rig-v0.46.0最新正式版2026-10-31 · 2026-10-31 07:09 UTC
Added
- (rig-mcp-client) new plugin crate
rig-mcp-client(rig_mcp_client::McpPlugin), listed off in the defaultplugins.toml: MCP servers' tools (stdio and streamable HTTP) as<server>__<tool>, from$RIG_HOME/mcp.jsonand<project>/.rig/mcp.json. A project's server starts only once approved as written (/mcp approve,/mcp deny);/mcp addand/mcp removeedit the right file.McpCorePluginandAddMcpServerlet a front add its client's servers for one run. ThemcpServersformat withtype,disabledand${VAR}expansion, with other fields refused by name for that server only, and[mcp] connect_timeout_secs(30). A sessionless run starts nomcp.jsonserver. Headless--toolscan name a tool a plugin registers in the background, such as<server>__<tool>(by gold-silver-copper) (#2938, #2948) - (rig-acp)
rig acp, an optional plugin: the coding agent for ACP v1 clients (Zed, Neovim plugins), with a rig process per session, rig's models, sign-in, tools, sessions and slash commands, permissions and forms, client MCP servers through rig-mcp-client, and history replayed from rig's own session (by gold-silver-copper) (#2948) - (rig-claude-cloak) an opt-in Linux and macOS plugin for Anthropic subscription OAuth and compatible request shaping under a separate
claude-cloak/*provider, published with every release asrig-claude-cloakand listed disabled in the defaultplugins.toml(by gold-silver-copper) (#2875, #2891) - (rig-traffic) new default plugin
rig_traffic::TrafficPlugin:--traffic-log, or[traffic] log = trueinsettings.toml, records every model provider exchange in the session'straffic.jsonl, besideeffects.jsonl. It runs onrig-cassette'straffic::TrafficLog(featuretraffic), which writes each exchange as one scrubbed, versioned JSON line (by gold-silver-copper) (#2893) - (rig-basics)
AgentsMdPluginputs theAGENTS.mdfiles from the working directory up to the repository root, andRIG_HOME/AGENTS.md, in the system prompt.SkillsPluginlists skills (SKILL.md, the Agent Skills format) from.rig/skills,.agents/skills,RIG_HOME/skillsand~/.agents/skills, with/skill:<name> [text]./login <provider>saves a provider's API key, used before its environment variable, and/logoutremoves it (by gold-silver-copper) (#2873) - (sqlite, postgres)
SqliteSessionStoreandPostgresSessionStore(featurememory): rig-memory sessions kept in a database shared by every process or worker. The facade'smemoryfeature enables them withsqliteorpostgres;rig_memory::conformance::check_store(featuretest-utils) is the contract suite a store runs (by gold-silver-copper) (#2890) - (memory)
rig_memory::migration: a chain of whole-session format steps the agent runs when it opens a session in an earlier format, keeping a copy of the session as it was. The shipped chain has no step.rig_memory::summarized_in_logreports what each compaction took out (by gold-silver-copper) (#2899, #2918) - (agent)
AgentBuilder::provider_toolandprovider_tools: provider-hosted tools ride on every request the agent makes, after its function tools, and satisfy `ToolChoic
- (rig-mcp-client) new plugin crate
- v0.46.0-rc.1rig-v0.46.0-rc.1pre-release2026-10-23 · 2026-10-23 03:30 UTC
查看更新说明
Added
- (rig)
cargo install riginstalls the coding-agent launcher. It builds the agent from published Bevy plugins, supports--resume,--model,--printand--json, and rebuilds and rolls back plugin changes.rig plugin new|add|remove|list|enable|disable|checkmanages the plugin set;rig help-agentsdocuments the pipe protocol (by gold-silver-copper) (#2771, #2836, #2838, #2854) - (harness) published
rig-harness,rig-toolsand plugin crates: removable Bevy plugins for terminal and print fronts, models, sessions, compaction, subagents and coding tools. The final default plugins live inrig-basicsandrig-tui; approval, preview, checkpoints, search, subagents and helpers are opt-in. The plugin guide documents the public extension points (by gold-silver-copper) (#2771, #2832, #2836, #2844, #2848, #2863) - (rig-basics) versioned JSON-lines input and output with
rig --json, one-shotrig -p --json, and--toolsto narrow available tools. The opt-inhelpers::HelpersPluginruns child agents alone, in parallel or in a chain (by gold-silver-copper) (#2854, #2856) - (rig-tools) remote
HOST:PATHfiles through configured transports, with per-host concurrency limits, one retry for read-only transport failures, hash-checked edits, atomic writes and sharedSeenstate forread,writeandedit. Reading or writing a whole file lets a subsequent edit use one transport call (by gold-silver-copper) (#2849, #2850, #2852, #2855, #2857, #2858, #2860) - (rig-tui) a flat, syntax-highlighted transcript with whole tool outputs, state-tinted call rows, word-highlighted diffs, width-aware Markdown tables,
NO_COLORsupport and Shift+Enter on kitty-protocol terminals. New sessions show the version, model and directory in a welcome that is neither saved nor sent to the model (by gold-silver-copper) (#2832, #2859, #2861) - (gemini) Gemini 3 image generation with explicit sizes and reference images, access to every image and text part, Interactions text-to-speech with one or two speakers, current Deep Research options and stream-resume cursors (by gold-silver-copper) (#2809)
- (vertexai)
VertexAi::anthropic(model)serves Claude through Google'srawPredict/streamRawPredictendpoints with Google credentials and the shared Anthropic encoder (by gold-silver-copper) (#2817) - (minimax) image generation, text-to-speech, voice upload and cloning, and the
MINIMAX_M3model constant. HTTP-200 media replies reporting a provider failure now fail
- (rig)
- v0.45.0rig-v0.45.02026-10-19 · 2026-10-19 18:07 UTC
查看更新说明
Added
- (rig-basics) the default plugins.toml no longer lists SessionPickerPlugin (#2863) (by gold-silver-copper)
- (rig-basics) a welcome at the top of the transcript: rig's mark, version, model and directory (#2861) (by gold-silver-copper)
- (rig-tui) [breaking] a flat look: no box drawing, call rows tinted by state, the status line in the input (#2859) (by gold-silver-copper)
- (rig-basics) [breaking] rig over its pipes: --json, -p as the same front, and the helper tool (#2854) (by gold-silver-copper)
- (harness) [breaking] beat Pi, part 4: fix what the benchmark found (#2843) (by gold-silver-copper)
- (harness) [breaking] beat Pi, part 2: deletions, forks are agents, one recovery path, Esc stops subagents (#2841) (by gold-silver-copper)
- (harness) [breaking] beat Pi, part 1: fail closed, one fixed system prompt, keys redacted, /plugins, kernel tests (#2838) (by gold-silver-copper)
- (harness) smaller defaults, whole color-coded transcript, syntax highlighting (#2832) (by gold-silver-copper)
- (gemini) Gemini 3 image, text-to-speech, current deep research (#2809) (by gold-silver-copper)
- (vertexai) Claude through Vertex AI (#2817) (by gold-silver-copper)
- (rmcp) rmcp 3 and MCP feature pass (#2812) (by gold-silver-copper)
- (auth) pluggable token storage (#2815) (by gold-silver-copper)
- (minimax) image, speech, voice cloning and M3 (#2807) (by gold-silver-copper)
- (transcription) segments, word timings and speakers (#2814) (by gold-silver-copper)
- (rig-harness) [breaking] a thin coding agent over rig libraries, with rig-ecs and rig-tools (#2771) (by gold-silver-copper)
- (agent) [breaking] stream tool items as a projection of committed history (#2763) (by gold-silver-copper)
Fixed
- (rig-tools) [breaking] triobench round 8: a read of part of a small remote file gets it whole so an edit after it is one call, an edit's reply shows the changed lines and a few around them (#2860) (by gold-silver-copper)
- (rig-tools) triobench round 6: shell output drops terminal escape codes, a cut keeps the first and last errors, a remote write cut off mid-way says whether it happened, an edit after a write is one call (#2858) (by gold-silver-copper)
- (rig-tools) triobench round 4: edits apply in order, an edit of a file seen whole is one transport ca
- v0.44.0rig-v0.44.02026-10-07 · 2026-10-07 09:47 UTC
查看更新说明
Added
- (providers) base support for the new Anthropic and OpenAI models (#2632) (by gold-silver-copper)
- (gemini) automatic explicit caching for long runs (#2628) (by gold-silver-copper)
- (rig-candle) local YOLOv8 pose estimation (#2615) (by gold-silver-copper)
- (cassette) [breaking] refuse account failures and stored state, keep failed attempts, and move recording tooling into xtask (#2587) (by gold-silver-copper)
- (core) [breaking] signature slots, upstream reasoning provenance and the legacy fixture corpus (#2580) (by gold-silver-copper)
- (core) [breaking] stateful handle round-trips and reasoning provenance (#2578) (by gold-silver-copper)
- (cassette) [breaking] record provider-opaque fields verbatim (#2577) (by gold-silver-copper)
- (cassette) skip non-recordable tests during live re-recording (#2556) (by gold-silver-copper)
- initial typesafeai provider (jev) (#2550) (by 0xMochan) - #2550
- feat!(core, ecs): one provider vocabulary, lossless configuration (#2548) (by gold-silver-copper) - #2548
- feat!(core): Usage counters are Option — an absent counter is representable (#2535) (by gold-silver-copper) - #2535
- (rig-ecs) [breaking] the ECS contract under a long tool loop on five wires, with tool results as data, cached utterance views, bindings as data and runs as commands (#2516) (by gold-silver-copper)
- (rig-ecs) explicit stream delivery — StreamItemsDelivered, two consumers, five-wire matrix (#2515) (by gold-silver-copper)
- (ecs) add durable tool-turn checkpoint boundaries (#2514) (by gold-silver-copper)
- (ecs) expose typed content parts and shared binary assets (#2513) (by gold-silver-copper)
- [breaking] the effect-bus critical path — one protocol, one channel, typed views (#2443) (by gold-silver-copper) - #2443
- [breaking] finish the data layer — blessed ModelTurn conversion, counter/newtype ids, owned dispatch, serde across the protocol surface (#2419) (by gold-silver-copper) - #2419
- [breaking] event-sourced hook state — RunEntry log on AgentRun replaces the durable Scratchpad snapshot (#2408) (by gold-silver-copper) - #2408
- [breaking] transport middleware + run lifecycle hooks (on_run_start/on_run_settled, durable Scratchpad) (#2407) (by [gold-silver-copper](https://github.com/gold-si
- v0.43.0rig-v0.43.02026-09-30 · 2026-09-30 17:03 UTC
查看更新说明
Added
- (providers) base support for the new Anthropic and OpenAI models (#2632) (by gold-silver-copper)
- (gemini) automatic explicit caching for long runs (#2628) (by gold-silver-copper)
- (rig-candle) local YOLOv8 pose estimation (#2615) (by gold-silver-copper)
- (cassette) [breaking] refuse account failures and stored state, keep failed attempts, and move recording tooling into xtask (#2587) (by gold-silver-copper)
- (core) [breaking] signature slots, upstream reasoning provenance and the legacy fixture corpus (#2580) (by gold-silver-copper)
- (core) [breaking] stateful handle round-trips and reasoning provenance (#2578) (by gold-silver-copper)
- (cassette) [breaking] record provider-opaque fields verbatim (#2577) (by gold-silver-copper)
- (cassette) skip non-recordable tests during live re-recording (#2556) (by gold-silver-copper)
- initial typesafeai provider (jev) (#2550) (by 0xMochan) - #2550
- feat!(core, ecs): one provider vocabulary, lossless configuration (#2548) (by gold-silver-copper) - #2548
- feat!(core): Usage counters are Option — an absent counter is representable (#2535) (by gold-silver-copper) - #2535
- (rig-ecs) [breaking] the ECS contract under a long tool loop on five wires, with tool results as data, cached utterance views, bindings as data and runs as commands (#2516) (by gold-silver-copper)
- (rig-ecs) explicit stream delivery — StreamItemsDelivered, two consumers, five-wire matrix (#2515) (by gold-silver-copper)
- (ecs) add durable tool-turn checkpoint boundaries (#2514) (by gold-silver-copper)
- (ecs) expose typed content parts and shared binary assets (#2513) (by gold-silver-copper)
- [breaking] the effect-bus critical path — one protocol, one channel, typed views (#2443) (by gold-silver-copper) - #2443
- [breaking] finish the data layer — blessed ModelTurn conversion, counter/newtype ids, owned dispatch, serde across the protocol surface (#2419) (by gold-silver-copper) - #2419
- [breaking] event-sourced hook state — RunEntry log on AgentRun replaces the durable Scratchpad snapshot (#2408) (by gold-silver-copper) - #2408
- [breaking] transport middleware + run lifecycle hooks (on_run_start/on_run_settled, durable Scratchpad) (#2407) (by [gold-silver-copper](https://github.com/gold-si
用户点评
登录用户的真实使用记录,可按版本和硬件筛选还没有人点评。第一个说出真实体验的人最有价值。
📑 Docs • 🌐 Website • 🤝 Contribute • ✍🏽 Blogs •
Rig is a Rust library for building LLM applications, and rig, a terminal
coding agent built on it that you extend with Bevy plugins.
The coding agent
cargo install rig-cli
rig
In the agent, /login signs in with a ChatGPT plan or saves a provider's API
key, or export the key (such as OPENAI_API_KEY) before starting. /model picks
one of the models those reach, and of a local Ollama or llama.cpp server once
OLLAMA_API_BASE_URL or LLAMACPP_API_BASE_URL names it (or its key is set);
/help lists the commands. rig -p "fix the failing test"
answers one prompt without the terminal view.
- Everything is a plugin. The agent is a Bevy app; its
tools, commands, sessions, sign-in and terminal view are each a plugin, turned
on or off in
settings.toml, so any of them can be removed, replaced or added to. - It rebuilds itself.
/reloadrebuilds the agent with your plugin crates and restarts it in the same session, and keeps the old build running if the new one does not compile. - Scriptable.
rig -p --jsonandrig --jsondrive it over pipes;rig help-agentsis the protocol. - More when you want it. Subagents are an optional plugin, and the tools work on remote hosts over ssh or any command.
The agent guide covers the keys, sessions, compaction, plugins and files, and the plugin guide shows how to write a tool, command or panel. The agent needs Rust 1.97.1 or newer and runs on Linux and macOS.
The library
cargo add rig
use rig::prelude::*;
use rig::providers::openai::{self, OpenAI};
#[tokio::main]
async fn main() -> Result<(), anyhow::Error> {
// The client reads `OPENAI_API_KEY` and builds the models it serves.
let model = OpenAI::from_env()?.completion(openai::GPT_6_1_SOL);
let comedian = AgentBuilder::new(model)
.preamble("You are a comedian here to entertain the user using humour and jokes.")
.build();
let response = comedian.prompt("Entertain me!").await?;
println!("{}", response.output());
Ok(())
}
#[tokio::main] needs tokio's macros and rt-multi-thread features
(cargo add tokio --features macros,rt-multi-thread).
- 20+ model providers and 10+ vector stores, each under one interface
- Agents with tools, multi-turn streaming and typed hooks
- Completion, embedding, transcription, audio and image generation
- GenAI semantic conventions for OpenTelemetry
- Recording and replay of an agent's effects (
rig-cassette) - Browser WASM (
wasm32-unknown-unknown) for the core and the agent runtime (target support)
More in examples/, the docs and the
API reference.
rig-core no longer forces serde_json's preserve_order or
float_roundtrip features. Without them, JSON object keys sort by name,
including schema properties and JSON text embedded in prompts, embeddings
and tool results. Parsing floating-point numbers can change their low bits.
To restore the previous configuration, add this to your application's
Cargo.toml dependencies:
serde_json = { version = "1", features = ["preserve_order", "float_roundtrip"] }
Cargo unifies features across dependencies. rig-cassette with traffic
(and therefore rig-traffic) still enables both features. rig-claude-cloak,
rig-mcp-client and rig-mongodb through BSON still enable preserve_order. These are
application-level serde_json choices; Rig has no forwarding feature.
Crates
The rig crate re-exports the core and the agent runtime, and each companion
crate behind a feature.
| Crate | What it is |
|---|---|
rig-core | Provider-neutral messages, completion and embedding models, tool contracts, the conversation type, vector-store contracts, and the providers |
rig-agent | The agent builder, prompting and streaming, hooks, the tool registry and the serializable AgentRun |
rig-memory | Windows, compaction, and saving, resuming and forking conversations |
rig-cassette | Effect logs: recording, replay and checkpoints |
rig-tools | Coding tools any rig agent can use: read, write, edit, search, shell |
rig-ecs, rig-harness | The agent kernel on Bevy's ECS, and the harness the coding agent's plugins build on |
rig-tui, rig-basics | The terminal view, and the coding agent's default plugins |
rig-traffic | Opt-in provider HTTP recording in the session store, using the cassette engine |
rig-mcp-client | The coding agent's MCP client, off by default: MCP servers' tools, with an opt-in plugin that asks before a project's server starts |
rig-acp | rig acp, off by default: the coding agent for ACP clients (editors such as Zed) |
Integrations
rig = { version = "0.46.0", features = ["lancedb", "fastembed"] }
| Integration | Crate | Feature | Module path |
|---|---|---|---|
| AWS Bedrock | rig-bedrock | bedrock | rig::bedrock |
| AWS S3Vectors | rig-s3vectors | s3vectors | rig::s3vectors |
| Candle (local Llama/SmolLM2/Qwen3 tools, YOLOv8 pose) | rig-candle | candle | rig::candle |
| Cloudflare Vectorize | rig-vectorize | vectorize | rig::vectorize |
| FastEmbed | rig-fastembed | fastembed | rig::fastembed |
| Google Gemini gRPC | rig-gemini-grpc | gemini-grpc | rig::gemini_grpc |
| Google Vertex AI | rig-vertexai | vertexai | rig::vertexai |
| HelixDB | rig-helixdb | helixdb | rig::helixdb |
| LanceDB | rig-lancedb | lancedb | rig::lancedb |
| Conversations over time | rig-memory | memory | rig::memory |
| Milvus | rig-milvus | milvus | rig::milvus |
| MongoDB | rig-mongodb | mongodb | rig::mongodb |
| Neo4j | rig-neo4j | neo4j | rig::neo4j |
PostgreSQL (vector store; with memory, a session store) | rig-postgres | postgres | rig::postgres |
| Qdrant | rig-qdrant | qdrant | rig::qdrant |
| ScyllaDB | rig-scylladb | scylladb | rig::scylladb |
SQLite (vector store; with memory, a session store) | rig-sqlite | sqlite | rig::sqlite |
| SurrealDB | rig-surrealdb | surrealdb | rig::surrealdb |
| TypeSafe Jev (experimental judgments) | rig-typesafeai | typesafeai | rig::typesafeai |
Community
Projects built on Rig are listed in awesome-rig; open a pull request there to add yours. Questions and ideas are welcome on Discord, and CONTRIBUTING.md says how to contribute. Rig is MIT licensed.
[!WARNING] Rig is pre-1.0. Releases contain breaking changes; each release's changelog and migration notes say what changed and how to move.