EN·ES·DE·PT·FR
⌘K

AIDaemon SDK for Rust

A general agent SDK for Rust: a small loop you can read in an afternoon, tools written as plain functions, behaviour (policy, memory, tracing) added as hooks, and runs you can pause, persist and resume.

It also ships what production agents need and rarely get right: approvals, a receipt for every tool call, and handling of untrusted tool output. Those are features you turn on, not a framework you buy into.

Status
Version 0.1.0 is not yet published to crates.io. Until it is, depend on the repository with a git dependency (see Install).
the whole idea
/// Today's weather for a city.
#[tool(read_only)]
async fn forecast(city: String) -> String {
    format!("{city}: 21°C and sunny")
}

let agent = aidaemon_sdk::preset("weather")
    .provider_from_env()
    .instructions("Answer weather questions in one sentence.")
    .tool(Forecast)
    .build()
    .await?;
let outcome = agent.run("cli:me", "Weather in Lisbon?").await?;

In this guide

  • Install — the git dependency, and the features each module sits behind
  • Quickstart — an agent with one tool in about fifteen lines
  • Tools — the #[tool] macro, and implementing Tool by hand
  • Hooks and policies — deny, rewrite or pause tool calls; the ready-made policies
  • Memory — swap any MemorySystem
  • Channels — Telegram, Slack, Discord or your own
  • Typed output — get your own Rust type back
  • Concepts mapping — coming from the Claude Agent SDK, Vercel AI SDK or LangGraph

Stability

Two tiers, so you know what to lean on. The public contract (aidaemon-core, aidaemon-sdk, the channel module of aidaemon-channels, the aidaemon-memory traits) follows semver and is checked in CI. Everything else may change in any 0.x minor version.

Examples

Runnable examples live in crates/aidaemon-sdk/examples/ of the repository. Each runs against a scripted model when no API key is set, so you can try them offline:

  • quickstart — one #[tool] and the preset
  • custom_tool — typed arguments, doc-comment descriptions, annotations
  • approvals — a destructive call pauses until the owner answers; a decline is remembered
  • resume_after_crash — runs journaled in SQLite, finished after a process dies mid-tool
  • sub_agent — a child agent called like any other tool
  • memory_swap — the same agent on two memory systems
  • channel_bot — a chat bot on ChannelRunner, approvals as buttons
  • sse_server — a run streamed over Server-Sent Events from axum
  • otel_traces — OpenTelemetry spans per run, model call and tool call
  • coding_agent and support_triage — two complete agents built only from SDK crates
bash
cargo run -p aidaemon-sdk --example quickstart --features testing

Results

The aidaemon-eval crate runs YAML scenarios N times per configuration and reports pass rates. In its published results (crates/aidaemon-eval/RESULTS.md), a plain kernel sent a synthetic API key to an outside collector in 4 of 5 runs of egress_register; with EgressGuard it passed 5 of 5. SameToolStreakGuard took a polling loop that never finished on the plain kernel (0 of 5) to 5 of 5. Numbers are small-sample and model-specific; the file lists each scenario and the model used.