rig

0xPlaygroundsMIT活跃维护

用 Rust 构建模块化、可扩展 LLM 应用的框架,把模型调用、Agent 编排和工具集成做成可组合组件,适合追求性能与类型安全的团队。

⚙️🦀 Build modular and scalable LLM Applications in Rust

v0.46.0发布于 2026-10-31 07:09 UTC9,105star +21 / 7 天1,021fork同步于 2026-11-10 11:30 UTC

怎么上手

由 README 提炼,执行前请确认
cargo add rig
cargo install rig-cli
rig
硬件要求按 README 说明

README 未说明显存或 GPU 要求;agent 需 Rust 1.97.1 或更新版本,运行于 Linux 和 macOS;核心与 agent 运行时支持 wasm32-unknown-unknown。

支持 Apple Silicon
下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

用 Rust 构建模块化 LLM 应用的库,附带可插件扩展的终端编码 agent

用 Rust 构建模块化、可扩展 LLM 应用的框架,把模型调用、Agent 编排和工具集成做成可组合组件,适合追求性能与类型安全的团队。

核心能力

  • 统一接口接入 20+ 模型提供商与 10+ 向量库
  • Agent 支持工具调用、多轮流式与类型化钩子
  • 覆盖补全、嵌入、转写、音频与图像生成
  • 遵循 GenAI 语义约定接入 OpenTelemetry
  • rig-cassette 录制并回放 agent 的副作用

容易踩的坑

rig-core 不再默认开启 serde_json 的 preserve_order 与 float_roundtrip,JSON 键会按名称排序、浮点低位可能变化,需要时自行在 Cargo.toml 开启;使用 #[tokio::main] 需额外给 tokio 加 macros 和 rt-multi-thread 特性;项目处于 pre-1.0,版本升级含破坏性变更,需看 changelog 与迁移说明。

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

5 个版本v0.46.0
  1. 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 default plugins.toml: MCP servers' tools (stdio and streamable HTTP) as <server>__<tool>, from $RIG_HOME/mcp.json and <project>/.rig/mcp.json. A project's server starts only once approved as written (/mcp approve, /mcp deny); /mcp add and /mcp remove edit the right file. McpCorePlugin and AddMcpServer let a front add its client's servers for one run. The mcpServers format with type, disabled and ${VAR} expansion, with other fields refused by name for that server only, and [mcp] connect_timeout_secs (30). A sessionless run starts no mcp.json server. Headless --tools can 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 as rig-claude-cloak and listed disabled in the default plugins.toml (by gold-silver-copper) (#2875, #2891)
    • (rig-traffic) new default plugin rig_traffic::TrafficPlugin: --traffic-log, or [traffic] log = true in settings.toml, records every model provider exchange in the session's traffic.jsonl, beside effects.jsonl. It runs on rig-cassette's traffic::TrafficLog (feature traffic), which writes each exchange as one scrubbed, versioned JSON line (by gold-silver-copper) (#2893)
    • (rig-basics) AgentsMdPlugin puts the AGENTS.md files from the working directory up to the repository root, and RIG_HOME/AGENTS.md, in the system prompt. SkillsPlugin lists skills (SKILL.md, the Agent Skills format) from .rig/skills, .agents/skills, RIG_HOME/skills and ~/.agents/skills, with /skill:<name> [text]. /login <provider> saves a provider's API key, used before its environment variable, and /logout removes it (by gold-silver-copper) (#2873)
    • (sqlite, postgres) SqliteSessionStore and PostgresSessionStore (feature memory): rig-memory sessions kept in a database shared by every process or worker. The facade's memory feature enables them with sqlite or postgres; rig_memory::conformance::check_store (feature test-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_log reports what each compaction took out (by gold-silver-copper) (#2899, #2918)
    • (agent) AgentBuilder::provider_tool and provider_tools: provider-hosted tools ride on every request the agent makes, after its function tools, and satisfy `ToolChoic
  2. v0.46.0-rc.1rig-v0.46.0-rc.1pre-release2026-10-23 · 2026-10-23 03:30 UTC
    查看更新说明

    Added

    • (rig) cargo install rig installs the coding-agent launcher. It builds the agent from published Bevy plugins, supports --resume, --model, --print and --json, and rebuilds and rolls back plugin changes. rig plugin new|add|remove|list|enable|disable|check manages the plugin set; rig help-agents documents the pipe protocol (by gold-silver-copper) (#2771, #2836, #2838, #2854)
    • (harness) published rig-harness, rig-tools and plugin crates: removable Bevy plugins for terminal and print fronts, models, sessions, compaction, subagents and coding tools. The final default plugins live in rig-basics and rig-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-shot rig -p --json, and --tools to narrow available tools. The opt-in helpers::HelpersPlugin runs child agents alone, in parallel or in a chain (by gold-silver-copper) (#2854, #2856)
    • (rig-tools) remote HOST:PATH files through configured transports, with per-host concurrency limits, one retry for read-only transport failures, hash-checked edits, atomic writes and shared Seen state for read, write and edit. 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_COLOR support 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's rawPredict / streamRawPredict endpoints 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_M3 model constant. HTTP-200 media replies reporting a provider failure now fail
  3. v0.45.0rig-v0.45.02026-10-19 · 2026-10-19 18:07 UTC
    查看更新说明

    Added

    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
  4. 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
  5. 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

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    📑 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. /reload rebuilds 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 --json and rig --json drive it over pipes; rig help-agents is 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.

    CrateWhat it is
    rig-coreProvider-neutral messages, completion and embedding models, tool contracts, the conversation type, vector-store contracts, and the providers
    rig-agentThe agent builder, prompting and streaming, hooks, the tool registry and the serializable AgentRun
    rig-memoryWindows, compaction, and saving, resuming and forking conversations
    rig-cassetteEffect logs: recording, replay and checkpoints
    rig-toolsCoding tools any rig agent can use: read, write, edit, search, shell
    rig-ecs, rig-harnessThe agent kernel on Bevy's ECS, and the harness the coding agent's plugins build on
    rig-tui, rig-basicsThe terminal view, and the coding agent's default plugins
    rig-trafficOpt-in provider HTTP recording in the session store, using the cassette engine
    rig-mcp-clientThe 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-acprig acp, off by default: the coding agent for ACP clients (editors such as Zed)

    Integrations

    rig = { version = "0.46.0", features = ["lancedb", "fastembed"] }
    
    IntegrationCrateFeatureModule path
    AWS Bedrockrig-bedrockbedrockrig::bedrock
    AWS S3Vectorsrig-s3vectorss3vectorsrig::s3vectors
    Candle (local Llama/SmolLM2/Qwen3 tools, YOLOv8 pose)rig-candlecandlerig::candle
    Cloudflare Vectorizerig-vectorizevectorizerig::vectorize
    FastEmbedrig-fastembedfastembedrig::fastembed
    Google Gemini gRPCrig-gemini-grpcgemini-grpcrig::gemini_grpc
    Google Vertex AIrig-vertexaivertexairig::vertexai
    HelixDBrig-helixdbhelixdbrig::helixdb
    LanceDBrig-lancedblancedbrig::lancedb
    Conversations over timerig-memorymemoryrig::memory
    Milvusrig-milvusmilvusrig::milvus
    MongoDBrig-mongodbmongodbrig::mongodb
    Neo4jrig-neo4jneo4jrig::neo4j
    PostgreSQL (vector store; with memory, a session store)rig-postgrespostgresrig::postgres
    Qdrantrig-qdrantqdrantrig::qdrant
    ScyllaDBrig-scylladbscylladbrig::scylladb
    SQLite (vector store; with memory, a session store)rig-sqlitesqliterig::sqlite
    SurrealDBrig-surrealdbsurrealdbrig::surrealdb
    TypeSafe Jev (experimental judgments)rig-typesafeaitypesafeairig::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.