anyagent-rs
Health Warn
- License — License: Apache-2.0
- Description — Repository has a description
- Active repo — Last push 0 days ago
- Low visibility — Only 5 GitHub stars
Code Warn
- process.env — Environment variable access in tests/fixtures/claude/fixture.mjs
- process.env — Environment variable access in tests/fixtures/codex/fixture.mjs
- process.env — Environment variable access in tests/fixtures/opencode/fixture.mjs
- process.env — Environment variable access in tests/fixtures/pi/fixture.mjs
Permissions Pass
- Permissions — No dangerous permissions requested
No AI report is available for this listing yet.
A Rust crate to connect multiple harnesses under one, simple, up-to-date interface.
anyagent
For apps that want to use the AI subscriptions a user already pays for.
One Up-to-date, feature-rich Rust interface to the agents already on a users machine.
Users have Claude Code, Codex, Cursor, Grok, OpenCode, Kiro, Antigravity, and friends on their
machines — each with its own CLI, protocol, and quirks. If you're building an
app on top of them, you end up writing and maintaining a driver per agent.
anyagent is that layer, once: it finds the agents, speaks each one's protocol
(native or ACP), and gives you one typed
API — Runtime, Session, and a stream of Events.
Your app keeps its own transcript, UI, and policy. anyagent owns the processes, the wires, and the turn rules — every agent behaves the same way through it.
Use
[dependencies]
anyagent = "0.0.1"
use anyagent::{EventKind, Runtime, SessionOptions};
use futures::StreamExt;
let runtime = Runtime::new();
let report = runtime.discover().await;
let agent = report.require("claude")?;
let (session, mut events) = runtime.open(agent, SessionOptions::in_dir(".")).await?;
session.prompt("explain this repo").await?;
while let Some(event) = events.next().await {
match event?.kind {
EventKind::TextDelta { text, .. } => print!("{text}"),
EventKind::TurnEnded { .. } => break,
_ => {}
}
}
session.close().await?;
That's the whole core flow. Everything else is the same few objects:
Features
| Capability | API |
|---|---|
| Discover installed agents and check login status | runtime.discover(), runtime.probe(agent) |
| Plan quota for the logged-in account | runtime.plan_usage(agent) |
| One-shot text (titles, commit messages) with no session to manage | runtime.generate(agent, options, prompt) |
| Send text, images, slash commands | session.prompt(input) |
| Steer or interrupt a running turn | session.prompt(..) mid-turn, session.cancel() |
| Answer a permission or question the agent raised | session.answer(id, answer) |
| Switch model / mode / any advertised option live | session.configure("model", "sonnet") |
| Resume, fork, or rewind a conversation | SessionOptions::resume / fork_from, session.rollback(..) |
| Add custom MCP Servers | SessionOptions::mcp_server(..) |
| Test your app against a scripted agent, no subprocess | Runtime::with_mock(script) (feature mock) |
Events cover streamed text and reasoning, typed tool calls with diffs, plans,
token usage, permission requests, subagents, and turn boundaries — the sameEventKinds for every agent. Anything provider-specific rides inextensions instead of leaking into the types.
Examples
examples/ is the tour — small, commented programs that run
against the agents on your machine:
chat.rs— the core loop: prompt, stream events,
answer permissions. Typing mid-turn steers the running turn.sessions.rs— several sessions at once, then
resuming one by token.probe.rs— discover installed agents and probe
their login state, models, commands, and capabilities.
Supported agents
| Agent | Wire |
|---|---|
| Claude Code | native (stream-json) |
| Codex | native (app-server) |
| Antigravity | native (stream-json), or ACP through its optional server |
| pi | native (pi RPC) |
| opencode | native (HTTP + SSE) |
| Cursor CLI, Grok, Hermes Agent, Kiro CLI, Qwen Code | ACP |
Any other ACP agent works without a catalog entry viaAgentInstallation::acp(name, path, args).
Docs
Using an AI agent to build on anyagent? Point it at one of these:
| Source | Use |
|---|---|
docs/skill.md |
Agent skill: drop into .claude/skills/anyagent/SKILL.md (or your agent's skills dir) |
| llms.txt / llms-full.txt | Whole docs site as plain text |
| Context7 | use context7 in Cursor, Claude Code, etc. |
| Page | What it covers |
|---|---|
| Quickstart | Install, discover, open, prompt, stream |
| Core API | Runtime, Session, SessionOptions, every EventKind, requests, errors |
| Features | Each feature: what, how, what confirms it, what gates it |
| Agents | Catalog, capability matrix, per-agent quirks, custom ACP agents |
| Building an app | Step-by-step chat app: threads, permissions, settings, persistence, usage |
| Architecture | Layers, the engine/adapter seam, adding an agent |
Generated API reference, every type and signature: docs.rs/anyagent.
Contributions
Contributions are welcome! Please be sure to open an issue first. Upon approval you may create a pr. Please avoid contributing AI-Slop :) ... unless fable wrote it. Read the contributing guide for the test tiers and what a PR needs.
License
MIT or Apache-2.0.
Reviews (0)
Sign in to leave a review.
Leave a reviewNo results found