← Back to Garden
🌱 Seedling β€” just planted, rough around the edges

AT Protocol as an Agent Network

Pi-powered agents on Cloudflare with atproto-style coordination. Private by default, encrypted by default, self-extending.

Planted 2026-02-07 Updated 2026-02-07
atprotoagentsdecentralizedidentitymemorycoordinationcloudflarepiencryption

The Question

Could the AT Protocol be more than a social network backbone? What if we treated it as a decentralized communication and memory network for AI agents?

This post maps atproto primitives to agent network requirements, explores existing implementations, and sketches a Cloudflare-native path forward.

Prior Art: It Already Exists

Before building anything, study these:

Cirrus handles single-user PDS. The interesting question is: what about N agents talking to each other?

Why Pi as the Agent Runtime?

Pi is what drives the agents. Not OpenClaw, not a custom runtime β€” Pi.

From Armin Ronacher’s deep dive:

β€œPi’s entire idea is that if you want the agent to do something that it doesn’t do yet, you don’t go and download an extension or a skill or something like this. You ask the agent to extend itself.”

What makes Pi special:

OpenClaw is built on Pi. We’re building an agent network on Pi. Each agent extends itself β€” no MCP, no community skills marketplace. The agent maintains its own functionality.

Security: Private by Default

ENCRYPTED BY DEFAULT. PRIVATE BY DEFAULT.

LayerProtection
TransportTLS 1.3 + X25519MLKEM768 (post-quantum)
At-restPer-agent X25519 encryption keys
MemoryEnvelope encryption (DEK per record)
SharingExplicit key exchange for public/shared

Privacy levels:

Every memory is encrypted. Public sharing requires explicit action.

Why AT Protocol for Agents?

Atproto already ships the primitives we need:

Instead of inventing another agent bus, we can assemble an agent network from proven, interoperable building blocks.

Architecture: Cloudflare Edition

Cloudflare’s primitives map surprisingly well to atproto’s architecture:

AT ProtocolCloudflareNotes
DID/IdentityDurable ObjectsOne DO per agent, holds keys and state
Repo (MST)D1 + R2D1 for records, R2 for blobs
LexiconsZod schemasType validation at edge
FirehoseDO WebSockets + QueuesReal-time via DO, async via Queues
RelayWorker + DO coordinationAggregates events, routes messages
PDSThe whole stackD1/R2/DO combined = mini-PDS
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚    Agent A      β”‚     β”‚    Agent B      β”‚
β”‚   DID + Keys    β”‚     β”‚   DID + Keys    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚                       β”‚
         β–Ό                       β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚     PDS A       β”‚     β”‚     PDS B       β”‚
β”‚  Repo + XRPC    β”‚     β”‚  Repo + XRPC    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚                       β”‚
         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                     β–Ό
            β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
            β”‚      Relay      β”‚
            β”‚    Firehose     β”‚
            β”‚   Aggregation   β”‚
            β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                     β”‚
                     β–Ό
            β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
            β”‚  Coordination   β”‚
            β”‚    Workers      β”‚
            β”‚  Queue / Cache  β”‚
            β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                     β”‚
                     β–Ό
              Agent B reacts

Identity: DIDs as Agent IDs

Every agent is a DID. Handles are optional and purely for display. The DID document publishes the repo signing key and PDS endpoint.

For Cloudflare-native identities, we can define did:cf:<durable-object-id> as a lightweight DID method, bridging to did:plc when atproto interop is needed.

Key takeaways:

Memory: Repo as Source of Truth

Atproto repositories are signed, content-addressed Merkle trees (MSTs). Each agent repo is a durable, appendable memory log with a native audit trail.

We model memory as structured records in named collections:

Memory patterns:

For semantic retrieval, pair with Cloudflare Vectorize β€” atproto as source of truth, vector index as derived view.

Lexicons: Agent-to-Agent Messaging Contracts

Lexicons are the schema layer. We define agent.comms.* records for typed agent coordination:

// Zod schemas (compile from Lexicon JSON if needed)
const Message = z.object({
  $type: z.literal('agent.comms.message'),
  sender: z.string(),  // DID
  recipient: z.string(),  // DID
  thread: z.string().optional(),
  content: z.discriminatedUnion('kind', [
    z.object({ kind: z.literal('text'), text: z.string() }),
    z.object({ kind: z.literal('json'), data: z.unknown() }),
    z.object({ kind: z.literal('ref'), uri: z.string() }),
  ]),
  priority: z.number().int().min(1).max(5).default(3),
  createdAt: z.string().datetime(),
})

Core message types:

Coordination: Firehose as the Agent Bus

The firehose streams repo updates in near real time. For coordination, agents filter commit events by collection prefix, then fetch matching records.

  Agent A          PDS A           Relay          Agent B
     β”‚               β”‚               β”‚               β”‚
     │──createRecord─▢               β”‚               β”‚
     β”‚  (agent.comms β”‚               β”‚               β”‚
     β”‚   .message)   β”‚               β”‚               β”‚
     β”‚               β”‚               β”‚               β”‚
     β”‚               │──firehose────▢│               β”‚
     β”‚               β”‚  commit event β”‚               β”‚
     β”‚               β”‚               β”‚               β”‚
     β”‚               β”‚               │──filtered────▢│
     β”‚               β”‚               β”‚  commit event β”‚
     β”‚               β”‚               β”‚               β”‚
     β”‚               │◀──────────────────getRecord───│
     β”‚               β”‚               β”‚   (at://...)  β”‚
     β”‚               β”‚               β”‚               β”‚
     β”‚               │───────────────────record─────▢│
     β”‚               β”‚               β”‚               β”‚
     β”‚               β”‚               β”‚       handle message
     β”‚               β”‚               β”‚               β”‚

What We Steal from moltworker

moltworker runs OpenClaw in Cloudflare Sandbox containers. Key patterns to lift:

The Dockerfile base (cloudflare/sandbox:0.7.0) gives us a container environment for agents that need more than edge compute.

Tradeoffs vs Centralized

Pros:

Cons:

When to use this:

When to use full atproto:

POC Path

Using Pi as the agent runtime (minimal, focused) on Cloudflare primitives:

  1. Single Agent: Pi in Sandbox, identity, D1/R2 storage
  2. Agent Memory: Record schemas, Vectorize semantic search
  3. Multi-Agent: Coordinator DO, message lexicons, WebSocket relay
  4. Firehose: Event streaming, subscriptions, cursors

Full spec: joelhooks/atproto-agent-network

Final Take

AT Protocol gives agents a decentralized identity, a tamper-evident memory log, and a shared coordination stream. Cloudflare gives us the infrastructure to run it at the edge without ops burden.

The most effective architecture is hybrid: atproto concepts for identity and memory, Cloudflare primitives for execution, and specialized systems (Vectorize) for fast retrieval.

Cirrus proves single-user PDS works on Cloudflare. The next step is multi-agent coordination.

Sources

Agent Runtime:

Cloudflare Infrastructure:

Protocol:

Full Spec: