FastATP

FastATP

Private and public composable atproto PDS via symmetric peers, without shared secrets: signed mail for machines (and humans), not remote procedure calls with a login.

tests on main the release on PyPI the latest tag, release candidates included the version on main supported Python versions

fastatp.com


You drop a signed, content-addressed record — authored by your key, addressed by DID, verifiable by anyone, forever — and any peer you have admitted picks it up, acts on its own clock, and drops a signed reply. No authority issues a token. No connection is held open. No message can be forged, and every hop of provenance survives.

The difference from MCP/A2A in one line: a call returns a value and vanishes; a FastATP record is durable evidence that exists or doesn't. There is nothing to time out — only a signed record that anyone, anywhere, later, offline, can verify came from exactly who it claims. That reframe is the whole product.

FastATP implements the identity and signing primitives of the AT Protocol for use outside the social web — it is unaffiliated with Bluesky and avoids social-web assumptions. A pressure sensor, a payroll job, and a language model are the same kind of peer here: identity and signed records for agents, workloads, and IoT, not an AI SDK. The signing core is transport-agnostic — it turns typed records into signed bytes and back, and never opens a socket itself.

Run as a server, a FastATP peer is a personal data server (PDS) you run as a library: it serves its own DID document, hosts signed repos, and speaks the atproto firehose and sync routes, so relays, mirrors and the atproto SDK read it like any other host. It is a PDS at the sync level, by design — no sessions, no login routes, no app.bsky — because the wire is the contract, and a login is the thing the wire replaces.

PHILOSOPHY.md is the canonical statement of what this is and what it forbids. This README is its front door.

Tutorials

Runnable guides, one per pull request, each building on the one before it. Every guide runs against the fastatp in the tree: its machines on a private LAN inside Docker, each a personal data server of its own, read along and typed, watched as a show in the browser, or played headless, so a guide breaks in the same change as the code it teaches. You need Docker with the compose plugin, nothing else.

Asking a coding agent about FastATP? Point it at tutorials/AGENTS.md. It can run the first guide itself with cd tutorials/lab && ./lab.sh test, about five minutes on fresh machines, and answer you from what the machines did.

# Guide What it shows Status
1 GETTING_STARTED.md Three sovereign peers on a private LAN: a PDS on each machine, signed records, verified following, a private channel behind a real WireGuard tunnel runs
2 CONDUCTOR_AND_ORCHESTRA.md The engine that plays guide 1, taken apart, then put to work: a conductor orchestrates three machines with signed records, from one note to a tune, and nobody holds a connection open for a task runs
3 HOOT.md Tool calling as signed records: an agent drops one request, two ride companies bid sealed from each other, a bank holds and pays, a car drives, and alice checks every step back to alice's own words runs
4 GEESE.md A person reaching an app from a browser tab with no secret on the wire: sign up, log in, and let a second device in and out, while the app keeps the account without holding its key runs

To watch the first one as a show, with every machine's terminal, the network diagram and the wire on one screen:

cd tutorials/lab
./lab.sh clean               # start from the first minted identity
./lab.sh conductor           # boots alice, bob and eve with the demo engine

Open http://localhost:8080, pick a chapter and press Next. The show is four chapters of a few minutes each; a question every handful of presses, answered by what the next press shows; a key concept stops the show until Got it. Every step really runs on the machines, and the engine playing it is FastATP too: the score, the code and the pictures are records and blobs in the conductor's own repo. ./lab.sh test plays the same show with nobody watching and exits 0 when the whole guide played. tutorials/README.md has the three ways to run a guide and how to write one.

How it compares

MCP and A2A are, at heart, RPC with a login: reach an endpoint, present a credential some authority issued you, invoke a method, depend on that authority and that connection. They are excellent at that. FastATP removes the authority, makes every message self-verifying evidence, treats long-running and multi-party work as the default, and applies to any workload.

Dimension MCP A2A FastATP
Mental model Client calls a server's tool Agent calls a remote agent Peer drops signed mail; peers act on their own clock
Interaction Synchronous RPC Task RPC (long-running via SSE / push) Async durable signed records
Identity Server URL + OAuth Agent Card at a URL + declared auth DID (did:web, did:key)
Trust root OAuth / token issuer Web auth (OAuth, API keys) in the card None — cryptographic keys, per-record signatures
Message verifiable after the fact? No No (messages not independently signed) Yes — by anyone, offline, across hops
Topology Host–client–server Client-agent ↔ remote-agent Symmetric peers
Authorization / revocation Server-side token scopes App logic + web auth Signed capabilities + WireGuard admission; absence = unreachable; bilateral kill switch
Long-running work Awkward Supported (tasks, SSE, webhooks) Native — no connection held
Discovery Static config Agent Cards + registries User-built, untrusted directory; no privileged registry
Domain LLM tools / context AI agents Any workload — agents, services, IoT
Transport stdio, HTTP+SSE HTTP + JSON-RPC + SSE Transport-agnostic (firehose / HTTP / MQTT / serial)

When MCP or A2A is the better choice

Credibility comes from not overclaiming. Reach for them instead when:

FastATP wins decisively when you need no trusted third party, cryptographic provenance that composes across hops, durable async / long-running work, a bilateral kill switch, or non-AI workloads — any one of which the others cannot give you.

FastATP and the atproto SDK

The atproto SDK (PyPI, MIT, by MarshalX) is the Python ecosystem's standard for AT Protocol — production-grade, battle-tested against the live network, and the right choice for building on Bluesky or talking to existing PDS hosts. FastATP and the SDK are complementary halves of one wire: the SDK is a superb client of hosts; FastATP is a way to be a host — a personal data server (PDS) as a library, a sovereign peer. An SDK application can read a FastATP-hosted repo today (see examples/sensorthings_interop, where an independent SDK-based package flattens a FastATP CAR export unmodified), and a FastATP peer serves SDK users like any other host.

Dimension atproto SDK FastATP
What it is Client library for AT Protocol services Library for being an AT Protocol peer: your own personal data server (PDS)
Primary use case Build on Bluesky; talk to PDS hosts; consume the network Host your own signed repos; agent↔agent and user↔agent workflows
Auth model Sessions / OAuth against a host (as the network's services expect) No login surface: keys sign, capability records authorize, absence is revocation
Lexicon approach Generated models from the official corpus — batteries included User-defined: author any conforming lexicon in Pydantic; export valid lexicon JSON
Firehose role Consume (production-hardened client) Emit AND consume, with full verification (signatures + MST inversion)
Repo role Read via host APIs Sign, host, prove, serve: MST repo, commits, CAR, prove() record proofs
Hosting n/a (clients have hosts) PDS-as-a-library: firehose + sync routes on your own box
Choose it when… You're building an app or bot on the existing network — it's mature, complete, and maintained by the ecosystem's standard-bearer You need to be your own host: no trusted third party, secure SaaS without a login wall, sovereign agents

The sharpest way to see the difference: with FastATP, a secure multi-tenant app needs no login wall — users sign locally, hosts never hold a secret, presence of a signed capability record is authorization and its absence is revocation. And to be precise about auth: OAuth is never in FastATP, but a developer can build OAuth (or any auth UX) on top of it at the edge — examples/bluesky_signup does exactly that, with the OAuth library as the builder's dependency, never FastATP's.

Install

pip install fastatp

FastATP is 0.x: a minor release may break, a patch release never does. 0.2 to 0.3 can change or remove public API; 0.2.0 to 0.2.1 only fixes or adds. To take fixes without surprises, pin the minor line:

pip install "fastatp~=0.3.0"   # at least 0.3.0, below 0.4

Breaking changes are listed under Breaking in the CHANGELOG.md.

FastATP speaks one wire format: atproto's. Records live in a signed, present-state repository; a record travels as a proof slice (signed commit + Merkle path + record) that anyone can verify with nothing but a DID resolver — over a firehose, HTTP, MQTT, or a serial line.

Five-minute prove / verify

A device signs a telemetry record; anyone verifies it later with only a DID resolver — no live connection to the device, no shared secret.

import asyncio
from datetime import datetime, timezone

from fastatp import Peer, Lexicon, build_did_document
from fastatp.crypto import generate_keypair


class PressureReading(Lexicon):
    nsid = "com.example.telemetry.pressureReading"
    pressure_psi: int
    timestamp: datetime


async def main() -> None:
    key = generate_keypair("k256")
    did = "did:web:example.com:device-1"
    doc = build_did_document(did=did, signing_key=key.public_key())

    producer = Peer(did=did, signing_key=key)  # or any fastatp.Signer: a TPM, an HSM
    repo = await producer.create_repo()
    await repo.put_record(
        PressureReading.nsid,
        "boot",
        PressureReading(pressure_psi=1450, timestamp=datetime.now(timezone.utc)),
    )
    proof = repo.prove(PressureReading.nsid, "boot")  # bytes; ride any transport

    # In production the verifier resolves DIDs over HTTPS (web_resolver).
    async def resolver(d: str):
        return doc if d == did else None

    record = await Peer(resolver=resolver).verify(proof, expected_signer=did)
    print(record.pressure_psi)  # 1450 — proven to come from device-1's key


asyncio.run(main())

Dispatch, reply, admit — the PeerApp framework

PeerApp is a FastAPI-shaped layer over the primitives: route any lexicon to a handler, reply with signed records, and admit/evict peers with a bilateral kill switch. It ships mechanism, never application schemas — you define your own request/reply lexicons.

from fastatp import PeerApp

app = PeerApp(server)  # a PeerServer for this peer's DID


@app.on(InspectionRequest)  # your lexicon, in your namespace
async def handle(req, ctx):
    # work happens on your clock — there is no call waiting on the other side
    result = InspectionResult(context_id=req.context_id, finding="within spec")
    await app.emit(InspectionResult.nsid, generate_tid(), result)  # a durable signed reply


# a private, one-shot reply on an ephemeral channel only the requester can read:
#     await app.reply_private(ctx, result, ttl=120)
# consumer side, same call site as the public path:
#     reply = await agent.call(tool_did, req, reply_type=InspectionResult, private=True)

The requester is a sensor, a service, or an agent — the same peer either way. See examples/workorder.py (public request/reply over a WireGuard-admitted firehose) and examples/board_rendezvous.py (a documentless requester and a private service meet at a public board and exchange a private reply, end to end).

What's in the box

Philosophy

Read PHILOSOPHY.md — it is canonical and governs the package. In one question: does this make FastATP more like signed mail between sovereign peers, or more like RPC with a login? The former is the direction; the latter is the thing it is deliberately not.

Development

uv venv && uv pip install -e ".[dev]"
uv run pytest         # conformance vectors are vendored in tests/vectors/
uv run ruff check fastatp tests && uv run mypy fastatp

Clone to develop; a pip install never needs a Rust toolchain (the browser peer ships pre-built). Running the full suite — browser/WASM, WireGuard, and cross-implementation tests — is covered in docs/TESTING.md.

The tutorials are tests too: cd tutorials/lab && ./lab.sh test [GUIDE] plays a guide headless against the fastatp in the tree (GETTING_STARTED unless you name another, such as CONDUCTOR_AND_ORCHESTRA), and uv run pytest fails when a guide's quoted files drift from the files themselves. Every pull request plays every guide in CI, so a tutorial cannot stop working without the change that broke it failing its tests.

See CONTRIBUTING.md before opening a pull request, and SECURITY.md to report a vulnerability privately.

Releases

Releases are built in CI from a version tag: the workflow builds the browser bundle, runs the full suite, builds the sdist and wheel, verifies their contents, and publishes through PyPI trusted publishing. There are no API tokens and no shared secrets anywhere in the pipeline — the same rule the library lives by. Release candidates go to TestPyPI first; each publish waits for maintainer approval. Changes are recorded in CHANGELOG.md; the versioning rule and release routine are in CONTRIBUTING.md.

License

MIT. Copyright Jacob Lapenna.