Skip to content

Embed adam in your own program ​

adam-rs is a library first (ADR 0001): a host binary composes crates, and the shipped adam-agent and adam-coder are two such compositions. If you only need to serve an agent made of files, do not embed: Write an agent. This page is about a server program; for adam inside an application, with no server at all (a desktop or a phone), read Embed adam in an application.

The generated API of every library crate is on the site: Rust API.

Pick a level ​

You wantDepend onEntry point
a folder's agent inside your processadam-agent (also a library, publish = false) and adam-serviceadam_agent::agents(def, card, workers) then adam_service::serve(&ServiceConfig, agents, shutdown) (adam-agent README)
your own agent with Rust toolsthe adam facadeuse adam::prelude::*: #[tool], tools!, LlmAgent; adam::include_agent!(); features macros and remote (default), a2a, mcp, dev (adam README)
only the process plumbingadam-hostRole and Host: register components with .control_plane(name, f) and .worker(name, f); Host::run(shutdown) starts what the role runs and stops the control plane before the workers (README)
adam inside an application, with no server and nothing on the network of its own (a desktop or a phone)adam-engineEngine::builder(store, agent, model, alias).start().await?, then send, steer, answer, cancel, list, get, events and shutdown, with no A2A type in a signature (ADR 0047 slice 4; the SQLite store is still to come): the host gives the store, the model, the model profiles (and the root's reasoning level) and the secrets (Embed adam in an application). Turn off adam-a2a's server, adam-a2a-runtime's push, adam-assembly's remote (adam's too) and adam-ui's thread-tools on anything else you depend on, or Cargo turns them back on (README)
a different databaseimplement StoreStore adapters

Steps ​

  1. Pin by full commit. The crates are git dependencies on one 40-hex sha, never a branch or tag, all bumped together (two revs mean two copies of the same traits, with errors that name types that look equal).

    toml
    adam-host = { git = "https://github.com/vymalo/another-adam-rs", rev = "<40-hex sha>", default-features = false, features = ["supervisor"] }
    adam-runtime = { git = "https://github.com/vymalo/another-adam-rs", rev = "<same sha>" }
  2. TLS is built in. adam-store-postgres and adam-notify-postgres use rustls on aws-lc-rs; the DATABASE_URL chooses the mode (sslmode, sslrootcert, sslcert, sslkey). There are no TLS Cargo features any more (sqlx left with ADR 0053): a consumer that set tls-rustls or tls-native-tls removes the line.

  3. Configuration is the host's. adam-host never reads the environment. With adam-service the variables are those of Environment; a host of your own owns its names.

  4. Map a failed serve to an exit code with adam_service::exit_code (78 configuration, 69 dependency down, 71 OS, 70 internal), so a supervisor can tell restartable from not.

  5. Leave dev and mcp off unless you need them: a release build must not watch files or start MCP processes unless it opts in.

Pitfalls &ZeroWidthSpace;

  • Role is a closed enum: a new role at a later rev is a compile error in your match, on purpose (runs_control_plane() and runs_workers() avoid it). So are Placement and ClaimScope.
  • A required trait method added at a later rev breaks implementers; the adam-upgrade skill walks through a bump.
  • A tool is a plain async fn as well: unit-test it by calling it. Tools must be safe to repeat.

A worked consumer is vymalo/another-agentic-system: its crate orchestrator/crates/agent-adam hosts adam agents in the orchestrator's process behind the off-by-default feature agent-local.

For an AI assistant doing this, use the adam-embed skill (npx skills add vymalo/another-adam-rs --skill adam-embed).