Rust Oxide:為 AI Agent 打造的輕量 Rust 核心
Rust Oxide: a small Rust kernel for AI agents
Rust Oxide 是一組 Rust crates,為 AI Agent 提供透過單一訊息總線存取結構化 API 和開放網絡的基礎,並記錄每項決策。其工作空間有 150 項通過測試,附設的 rust-oxide-lib 提供三個可執行 Agent,其中 news-agent 可在不連接網絡或 API key 的情況下,使用模擬後端執行完整流程。
Most agent code I read glues an LLM to a pile of HTTP calls, a headless browser and a scratch database, each with its own error handling and logging. When something goes wrong, nobody can say what the agent saw, what it decided, or why.
Rust Oxide is my attempt at a cleaner base: a set of Rust crates that give an agent one way to reach structured APIs and the open web, with every decision written down.
The shape of it
Three layers, all talking over one message bus:
-
Native core.
oxide-kis a micro-kernel: modules register with it, exchangeCommandandEventenvelopes over atokiochannel, and keep config in a SQLite registry. Next to it sitoxide-mirror(an event-sourced local copy of the data an agent works with, queryable with SQL) andoxide-graph(a small typed knowledge graph). -
WASM plugins.
oxide-compresscuts tokens before anything reaches a model: it keeps the fields that matter, strips metadata and chunks text by meaning. It compiles to WebAssembly, so it runs the same everywhere. -
AI harness.
oxide-browser-shdrives Chromium through the accessibility tree and retries a failed step with a different selector instead of giving up.oxide-llm-orchestratoris the one place prompts and model calls live.
Around them: oxide-gen turns an OpenAPI, GraphQL or gRPC spec into a Rust client crate, oxide-mcp-server exposes the modules as MCP tools, and oxide-mesh lets agents on different machines talk, with CRDTs for shared state.
Every decision is logged
The part I care about most is small: oxide-k::xai, an append-only log. Each entry records the actor, the action, the rationale, the inputs, the output and a confidence score. When an agent does something odd, you query the log by actor and read what it was thinking, instead of guessing from stdout.
Try it
The sister repo rust-oxide-lib has three runnable agents:
-
hello-agentboots the kernel and sends aPingover the bus (about 110 lines). -
news-agentruns the whole pipeline (browser, extract, compress, mirror, LLM, decision log, graph query) on mock backends, so it needs no network or API key. -
mcp-launcherserves the browser and mirror modules as MCP tools over stdio, so Claude Code can call them.
Swapping the mocks for real Chromium and a real model changes the constructors, not the code shape.
The workspace has 150 passing tests and runs clean under clippy -D warnings. It is early, and I would like to hear where the design is wrong.
More of what I am building: manjunathasaiuppu.in.
來源:DEV Community · dev.to