Skip to content
Back to skills

Docs

ASecurity

Rust crate that drives the coding agents installed on a user's machine (Claude Code, Codex, Cursor, opencode, Kiro, Grok, Hermes, Qwen, pi, Antigravity) through one typed API. Read before writing or changing any code that calls anyagent, whether discovering agents, opening sessions, streaming events, answering permission requests, configuring models, or resuming and forking sessions.

  • 13 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added September 19, 2026
ai-agentsrustgodebuggingapi

Works with

  • claude code
  • cursor
  • cli
  • api
  • mcp

Security analysis

A100/100

Pro scans all 14 files and shows the line behind each finding

Scanned September 19, 2026

npx -y skills add spotta85/anyagent --skill docs --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Docs?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Docs
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/spotta85-docs/badge)](https://www.skillsdirectory.com/skills/spotta85-docs)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: anyagent
description: Rust crate that drives the coding agents installed on a user's machine (Claude Code, Codex, Cursor, opencode, Kiro, Grok, Hermes, Qwen, pi, Antigravity) through one typed API. Read before writing or changing any code that calls anyagent, whether discovering agents, opening sessions, streaming events, answering permission requests, configuring models, or resuming and forking sessions.
license: MIT OR Apache-2.0
compatibility: Rust 1.88+, Tokio runtime. Agents must be installed and logged in on the machine.
metadata:
  author: spotta85
  version: "0.0.5"
---

# anyagent

One crate that finds the coding agents on a machine, speaks each one's
protocol (native or ACP), and exposes them all as three objects. anyagent
owns the processes, the wires, and the turn rules. Your app owns the
transcript, the UI, and the policy behind permission requests.

```text
Runtime::discover()  ->  Runtime::open()  ->  (Session, Events)

  your app ── prompt / answer / configure ──►  Session
                                                  │
                                                  ▼
                                            agent process
                                                  │
  your UI  ◄── text / tools / requests / usage ── Events
```

## Before you code

The docs are the source of truth; this file is the map. Before writing or
changing code that calls anyagent:

1. List the `Runtime` and `Session` calls and the `EventKind`s the change touches.
2. Read the page for each from the table. Fetch the URL (plain markdown), or
   query the Context7 MCP for library `/spotta85/anyagent`. Done when every
   call you will make and every event you will handle has its row read.
3. Write the code, following the rules below.

| Need | Page |
|---|---|
| Install and first turn | https://anyagent.mintlify.site/quickstart.md |
| Every type, event, error, and `SessionOptions` builder | https://anyagent.mintlify.site/core-api.md |
| Each feature with a snippet (resume, fork, rollback, compact, MCP, mock) | https://anyagent.mintlify.site/features.md |
| Catalog, capability matrix, per-agent quirks, custom ACP agents | https://anyagent.mintlify.site/agents.md |
| Threads, streaming, persistence in a real app | https://anyagent.mintlify.site/building-an-app.md |
| Codebase map, adding an agent adapter | https://anyagent.mintlify.site/architecture.md |
| The binary, and the JSON-lines sidecar for apps in other languages | https://anyagent.mintlify.site/sidecar.md |
| Full signatures | https://docs.rs/anyagent |
| Every page, one list | https://anyagent.mintlify.site/llms.txt |

## Rules

1. **Discover, require, open.** `discover()` is instant and read-only; `probe()` launches the agent for real auth, capabilities, and options. `SessionOptions::in_dir(path)` is required.
2. **Gate features on capabilities.** Check `session.info().details.capabilities.supports(Capability::X)` before offering steer, fork, rollback, compact, or images. Unsupported calls fail typed with `UnsupportedFeature`.
3. **Read `Events` from its own task.** A consumer that falls 1024 events behind is dropped and the session closes. Keep a `_ => {}` arm; `EventKind` is `#[non_exhaustive]`.
4. **One turn ends exactly once.** `TurnEnded` is the only turn boundary. `Completed { source: Inferred }` means the wire went quiet; show it as idle.
5. **Answer each request once, clear it on `RequestClosed`.** On `RequestOpened` call `session.answer(id, ..)` with a choice from `r.options`.
6. **Tool updates are snapshots.** `ToolUpdated` is cumulative; replace the stored tool by `id`.
7. **Wait for the confirming event.** `configure` → `SessionUpdated`, `compact` → `ContextCompacted`, `cancel` → `TurnEnded { Cancelled }`.
8. **Models and options come from the agent.** Read `details.config_options` and render what it offers.
9. **`prompt` always accepts.** Its `Delivery.kind` is `Started`, `Steered`, or `Queued`. Handle all three.
10. **One-shot text goes through `Runtime::generate()`.** Titles, commit messages, PR bodies. It opens, prompts, declines tools, and closes for you.
11. **Persist the resume token.** Store `session.info().resume_token`, reopen with `SessionOptions::resume(token)`. `fork_from` branches instead.
12. **Provider data stays in `extensions`.** Match on the shared types; read `Event::extensions` only for provider-specific extras.
13. **`record_wire` output is secret.** Unredacted protocol traffic; delete it after debugging.
14. **Test without agents** using the `mock` feature: `Runtime::with_mock(script)` runs the real engine over a scripted agent.

Files in this skill

  • agents.mdx10.4 KB
  • architecture.mdx10.1 KB
  • building-an-app.mdx12.1 KB
  • contributing.mdx4.2 KB
  • core-api.mdx14.1 KB
  • docs.json1.5 KB
  • favicon.svg241 B
  • features.mdx14.4 KB
  • fields.js8.4 KB
  • index.mdx3.3 KB
  • quickstart.mdx2.6 KB
  • sidecar.mdx10 KB
  • skill.md4.5 KB
  • style.css5.9 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…