Skip to content

Repository files navigation

ATD — Agent Tool Dispatch

CI crates.io docs.rs

The reference implementation of the Agent Tool Dispatch (ATD) protocol.

ATD is a neutral, cross-vendor wire protocol that lets any LLM agent, on any framework, call any tool, on any platform — through a single typed RPC surface. This repository is the Rust source of truth: a wire-type crate, a server runtime, a client SDK, two transports, middleware, built-in tools, an MCP bridge, a CLI, and a conformance suite — plus a Python package mirror.

New here? Read docs/index.md for the documentation map, or docs/atd-architecture.md for the full picture. AI coding agents: start at AGENTS.md.

Why ATD

Dimension Fragmentation today ATD's answer
Any tool CLI, REST, MCP, native SDK — incompatible shapes One ToolDefinition, many bindings
Any platform Linux / macOS / Windows / mobile each differ Binding selection is server-side at dispatch
Any agent Claude Code can't consume OpenAI shapes without a shim All agents call one SDK; adapters render per-provider
Any framework LangChain tool ≠ MCP tool ≠ App Intent One definition, many framework consumers

Every message, in every direction, over every transport, serialises to one machine-readable schema: atd-protocol-schema.json.

Quick start

git clone https://github.com/downsea/atd
cd atd
cargo run --example hello_atd -p atd-examples

The example auto-spawns the reference server and exercises three tools:

[atd] auto-spawning atd-ref-server → /tmp/.../demo.sock
[atd] connected — 10 tools registered

[1/3] ref:echo.say {"text":"hello from ATD"}
      → {"echoed":{"text":"hello from ATD"}}
[2/3] ref:fs.glob {"pattern":"**/*.toml","path":"."}
      → 9 paths: Cargo.toml, crates/atd-cli/Cargo.toml, ...
[3/3] ref:shell.exec {"command":"uname -s"}
      → exit 0, stdout="Linux"

No external daemon — everything runs from this repo, with zero ANOS dependency.

Using the atd crates

Every crate publishes to crates.io under the atd-* prefix at one shared version — pin atd-sdk = "1" and the whole stack stays mutually consistent. Pick by what you're doing:

Call ATD tools from an agent — atd-sdk

cargo add atd-sdk          # Rust   ·   Python:  pip install atd-client
use atd_sdk::{AtdClient, CallOptions, DiscoverFilter, Endpoint};

let atd = AtdClient::connect(Endpoint::unix("/tmp/atd.sock")).await?;
let tools = atd.discover(None, DiscoverFilter::default()).await?;        // discovery
let out = atd.call("ref:echo.say",
    serde_json::json!({ "text": "hello" }), CallOptions::default()).await?;

Full walkthrough — discover / describe / call, the OpenAI · Anthropic · LangChain adapters, error handling: Rust quickstart · Python quickstart.

Build your own ATD server (publish tools) — atd-runtime + a listener

cargo add atd-runtime atd-server        # Unix-socket transport
cargo add atd-runtime atd-server-http   # …or HTTP + MCP JSON-RPC

Implement the Tool trait, register it, hand the registry to a listener:

let mut registry = Registry::new();
registry.register(Arc::new(MyTool::new()));
atd_server::Server::new(registry, ServerConfig::default()).run().await?;

How-to: docs/extending/tool.md. Working skeleton (~80 lines): crates/atd-mock-weather-server. Opt-in egress middleware: atd-middleware-fhir, atd-middleware-pii-redact-medical.

Reach an ATD server from an MCP client — atd-mcp-bridge

cargo install atd-mcp-bridge

Point Claude Desktop / Cursor / Hermes / any MCP client at the bridge binary — config examples in docs/integrations/.

Drive ATD from the command line — atd-cli

cargo install atd-cli
atd --sock /tmp/atd.sock list           # subcommands: list · schema · call · doctor · skills

See docs/cli.md.

Verify a third-party implementation — atd-conformance

Dev-dep on atd-conformance and run the cross-implementation fixture corpus against your server — pass it and you interoperate. See crates/atd-conformance.

Not sure which path fits? docs/integrations/overview.md maps every framework to one of five integration paths; the full 16-crate map is docs/atd-architecture.md §9.

Prompting your coding agent

ATD is agent-native — paste the prompt below into Claude Code · Cursor · Codex, fill in the My task: line at the bottom, and the agent will clone the repo, read the relevant docs, and pick the matching integration path.

ATD (Agent Tool Dispatch) is a neutral cross-vendor wire protocol — any LLM
agent on any framework can call any tool on any platform via one typed RPC
surface. Reference implementation: https://github.com/downsea/atd. Clone it
locally if it isn't already.

Get oriented in this order:
  1. AGENTS.md             — architectural map for AI coding agents
  2. docs/index.md         — documentation map
  3. docs/atd-architecture.md  — dispatch pipeline + 16-crate layout

Then pick the path matching my task:

- Expose <my CLI / REST API / library> as an ATD server
  → docs/extending/tool.md + the ~80-line skeleton at
    crates/atd-mock-weather-server/. Implement Tool, register on a Registry,
    serve via atd-server (Unix socket) or atd-server-http (HTTP + MCP).

- Call ATD tools from <my agent>
  → docs/quickstart/rust.md (or docs/quickstart/python.md). Use atd-sdk:
    discover at startup, render through the OpenAI / Anthropic / LangChain
    adapter, dispatch with AtdClient::call.

- Bridge an ATD server into an MCP-only client
  (Claude Desktop / Cursor / Hermes / …)
  → install atd-mcp-bridge and follow docs/integrations/.

- Verify a third-party ATD server
  → dev-dep atd-conformance and run its fixture corpus per
    crates/atd-conformance. Fix every failing fixture — the suite is the
    interop contract.

Confirm which path my task maps to before writing code; flag ambiguity.

My task: <describe what you want built / changed / verified>

What ships

  • Protocol — length-prefixed JSON over a duplex byte stream; one unified schema; a full AtdError taxonomy.
  • Two transportsatd-server (Unix socket) and atd-server-http (HTTP + MCP JSON-RPC), both routing into one transport-agnostic dispatcher.
  • Dispatch — capability gate, tier-aware deadlines, pluggable bindings, HMAC-signed cursor pagination, an egress middleware pipeline.
  • Security — capability allow-listing, UCAN-lite bearer tokens, multi-tenant secret routing (TokenBroker), structured audit.
  • Reference serveratd-ref-server with 10 built-in tools (ref:echo.say, ref:fs.{read,write,edit,glob,grep}, ref:shell.{exec,pwsh}, ref:web.fetch, ref:external.uname).
  • Medical middleware — FHIR R4 egress validation and HIPAA PHI redaction as opt-in crates.
  • Conformance suiteatd-conformance; pass it and you interoperate.
  • MCP bridgeatd-mcp-bridge connects Claude Desktop, Cursor, Hermes, and any MCP client to any ATD server.

Full inventory: CHANGELOG.md.

Architecture at a glance

┌──────────────┐  length-prefixed JSON   ┌─────────────────────────────────────┐
│   atd-sdk    │ ←────────────────────→  │ atd-ref-server                       │
│  (client)    │   Unix socket / HTTP    │  Hello → capability gate             │
└──────────────┘                         │  registry → tier → binding → mw      │
                                          └─────────────────────────────────────┘
┌──────────────┐   MCP JSON-RPC    ┌────────────────┐      ┌──────────────┐
│  MCP client  │ ← stdio ────────→ │ atd-mcp-bridge │ ←──→ │  ATD server  │
└──────────────┘                   └────────────────┘      └──────────────┘

The full layer model, dispatch pipeline, security model, and crate map are in docs/atd-architecture.md.

Extending ATD

ATD attaches third-party code without forking — every extension point is a pub trait with a how-to guide in docs/extending/: add a tool, binding, middleware, transport, auth scheme, or audit sink.

Documentation

The wire schema is regenerated from the Rust types and gated in CI:

cargo run -p atd-protocol --features schema --bin gen-schema -- --check

Project status

1.0 — the wire format and the public extension traits are frozen for the 1.x line. See docs/release-plan-v1.0.md for the stability contract and CHANGELOG.md for release history.

Contributing

See CONTRIBUTING.md. Issues, PRs, and design feedback welcome.

License

Apache-2.0. See LICENSE.

About

No description, website, or topics provided.

Resources

Contributing

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages