Sandbox
@AgentAnycast/agentanycast

Protocol docs for AgentAnycast agent networking

AgentAnycast defines how agents find each other by skill, exchange tasks over encrypted links, and work across NATs and relays. This repository holds the protocol definitions, docs, and examples that explain how the system works and how to integrate with it.

79 stars6 forksShellUpdated 5mo ago
Who it's for

Builders who want agent communication that works across networks, relays, and local machines.

What it delivers

You can build agents that discover each other by capability instead of public address.

What it does

A2A protocol reference

Documents the Agent Card, Task, Message, Artifact, and task lifecycle used by the network.

Skill-based routing

Shows how anycast routing finds an agent by capability rather than by URL or IP address.

Encryption and identity model

Explains the Noise_XX transport, Ed25519 keys, and DID-based identity model.

NAT traversal and relay model

Covers LAN discovery, hole punching, relay fallback, and self-hosted relays.

Framework examples

Includes example integrations for CrewAI, LangGraph, Google ADK, OpenAI Agents, Claude Agent SDK, and AWS Strands.

SDK and deployment docs

Provides reference material for Python, TypeScript, deployment, observability, and troubleshooting.

How to get it

  1. 1Run
    pip install agentanycast && agentanycast demo
    # Open another terminal:
    agentanycast send <PEER_ID> "Hello!"
  2. 2The daemon downloads automatically. The demo prints the exact command to test it.
    pip install agentanycast        # Python SDK
    npm install agentanycast        # TypeScript SDK
    uvx agentanycast-mcp            # MCP Server for Claude, Cursor, VS Code, etc.
  3. 3Run
    pip install agentanycast
  4. 4Run
    npm install agentanycast
  5. 5No code needed. Install the MCP server and use P2P agents from Claude Desktop, Cursor,…
    uvx agentanycast-mcp

README

AgentAnycast

AgentAnycast

Connect AI agents across any network. No public IP required.

CI PyPI npm MCP Server Daemon Downloads License
Discussions Stars

The A2A protocol assumes every agent has a public URL -- but real agents run on laptops, behind NATs, inside corporate firewalls. AgentAnycast is a P2P runtime that gives any agent a reachable identity. End-to-end encrypted, NAT-traversing, zero config on LAN.

Try it now

pip install agentanycast && agentanycast demo
# Open another terminal:
agentanycast send <PEER_ID> "Hello!"

The daemon downloads automatically. The demo prints the exact command to test it.

pip install agentanycast        # Python SDK
npm install agentanycast        # TypeScript SDK
uvx agentanycast-mcp            # MCP Server for Claude, Cursor, VS Code, etc.

AgentAnycast DemoAgentAnycast Demo

Why AgentAnycast?

The A2A protocol assumes every agent has a public URL. That excludes agents on laptops, behind NATs, or inside private networks. AgentAnycast fixes this:

No public IP neededpip install and your agent is reachable. The Go sidecar daemon is auto-managed.
Find by skill, not addressAnycast routing discovers the right agent by capability. No URLs, no DNS.
E2E encryptedNoise_XX protocol. Relay servers see only ciphertext. No plaintext path in the codebase.
Works behind any firewallAutomatic NAT traversal (DCUtR hole-punching + relay fallback).
Cross-languagePython and TypeScript agents interoperate on the same network.

Quick Start

Python

pip install agentanycast
from agentanycast import Node, AgentCard, Skill

card = AgentCard(
    name="EchoAgent",
    description="Echoes back any message",
    skills=[Skill(id="echo", description="Echo the input")],
)

async with Node(card=card) as node:
    @node.on_task
    async def handle(task):
        text = task.messages[-1].parts[0].text
        await task.complete(artifacts=[{"parts": [{"text": f"Echo: {text}"}]}])

    print(f"Agent running — Peer ID: {node.peer_id}")
    await node.serve_forever()

TypeScript

npm install agentanycast
import { Node, type AgentCard } from "agentanycast";

const card: AgentCard = {
  name: "EchoAgent",
  description: "Echoes back any message",
  skills: [{ id: "echo", description: "Echo the input" }],
};

const node = new Node({ card });
await node.start();

node.onTask(async (task) => {
  const text = task.messages.at(-1)?.parts[0]?.text ?? "";
  await task.complete([{ parts: [{ text: `Echo: ${text}` }] }]);
});

console.log(`Agent running — Peer ID: ${node.peerId}`);
await node.serveForever();

Python and TypeScript agents interoperate out of the box -- same daemon, same protocol, same network.

MCP Server (Any AI Tool)

No code needed. Install the MCP server and use P2P agents from Claude Desktop, Cursor, VS Code, or any MCP-compatible tool:

uvx agentanycast-mcp

Add to your AI tool's config (example: Claude Desktop):

{
  "mcpServers": {
    "agentanycast": {
      "command": "uvx",
      "args": ["agentanycast-mcp"]
    }
  }
}

Then ask: "Find agents that can translate Japanese" or "Send a task to the summarize agent".

See platform-specific setup for Cursor, VS Code, Windsurf, JetBrains, Gemini CLI, and more.

How It Works

AgentAnycast uses a sidecar architecture: a thin SDK talks to a local Go daemon over gRPC. The daemon handles all P2P networking, encryption, and protocol logic.

AgentAnycast ArchitectureAgentAnycast Architecture

  • On a LAN -- agents find each other via mDNS. Zero configuration.
  • Across networks -- deploy a self-hosted relay. Agents connect through it, but the relay cannot read traffic (end-to-end encrypted).
  • Behind NAT -- the daemon tries hole-punching (DCUtR) first, then falls back to relay.
  • Identity -- each agent gets an Ed25519 key pair mapped to W3C DIDs (did:key, did:web). No certificates, no DNS, no accounts.

Three Ways to Connect

# 1. Direct — send to a known agent by Peer ID
await node.send_task(peer_id="12D3KooW...", message=msg)

# 2. Anycast — send by skill, the network finds the right agent
await node.send_task(skill="translate", message=msg)

# 3. HTTP Bridge — reach standard HTTP-based A2A agents
await node.send_task(url="https://agent.example.com", message=msg)
ModeUse case
DirectYou know the agent's Peer ID. Point-to-point, lowest latency.
AnycastYou need a capability ("translate", "summarize"). The skill registry routes to an available agent.
HTTP BridgeThe target is a standard HTTP A2A agent. The bridge translates between P2P and HTTP bidirectionally.

Framework Adapters

Turn existing agent frameworks into P2P agents with one function call:

from agentanycast.adapters.crewai import serve_crew
from agentanycast.adapters.langgraph import serve_graph
from agentanycast.adapters.adk import serve_adk_agent
from agentanycast.adapters.openai_agents import serve_openai_agent
from agentanycast.adapters.claude_agent import serve_claude_agent
from agentanycast.adapters.strands import serve_strands_agent

await serve_crew(my_crew, card=card, relay="...")          # CrewAI
await serve_graph(my_graph, card=card, relay="...")         # LangGraph
await serve_adk_agent(my_agent, card=card, relay="...")     # Google ADK
await serve_openai_agent(my_agent, card=card, relay="...")  # OpenAI Agents SDK
await serve_claude_agent(prompt="...", card=card)           # Claude Agent SDK
await serve_strands_agent(my_agent, card=card)              # AWS Strands Agents

Key Features

End-to-end encryptionNoise_XX protocol. No plaintext transport path. Relay servers see only ciphertext.
NAT traversalAutoNAT detection, DCUtR hole-punching, Circuit Relay v2 fallback.
Skill-based routingAnycast addressing by capability. Relay skill registry with optional multi-relay federation.
Decentralized identityEd25519 keys, W3C DID (did:key, did:web, did:dns), Verifiable Credentials.
A2A protocolNative implementation of Agent Card, Task, Message, Artifact, and the full task lifecycle.
HTTP BridgeBidirectional translation between P2P agents and standard HTTP A2A agents.
MCP interopMCP Tool <-> A2A Skill mapping. Daemon runs as an MCP server (stdio + HTTP).
Cross-languagePython and TypeScript SDKs sharing the same daemon, protocol, and network.

Interoperability

EcosystemIntegration
A2ANative implementation -- Agent Card, Task, Message, Artifact
HTTP A2ABidirectional HTTP Bridge between P2P and HTTP agents
MCPDaemon as MCP server; SDK maps MCP Tools <-> A2A Skills
ANPAgent Network Protocol bridge
W3C DIDdid:key, did:web, did:dns identity + Verifiable Credentials
AGNTCYAgent directory integration + OASF record conversion

Comparison

AgentAnycastStandard A2Aagentgateway
Works behind NATYes (automatic)NoNo
E2E encrypted through relaysYes (Noise_XX)No (TLS terminates)No (proxy decrypts)
Skill-based routingYesNoNo
MCP server built-inYesNoYes
Setup complexitypip install + 3 linesHTTP server + public IPGateway deployment

Self-Hosted Relay

On a LAN, no relay is needed -- agents discover each other via mDNS.

For cross-network communication, deploy a relay on any machine with a public IP:

git clone https://github.com/AgentAnycast/agentanycast-relay.git && cd agentanycast-relay
docker compose up -d

Then point agents to it:

async with Node(card=card, relay="/ip4/<IP>/tcp/4001/p2p/12D3KooW...") as node:
    ...

The relay is a zero-knowledge forwarder -- it passes only encrypted bytes. It also hosts a skill registry for anycast discovery, with optional multi-relay federation.

Repository Ecosystem

RepositoryLanguageDescription
agentanycast--Documentation, protocol definitions (proto/), examples -- you are here
agentanycast-mcpPythonMCP server for Claude, Cursor, VS Code, and 13+ AI tools
agentanycast-pythonPythonPython SDK -- pip install agentanycast
agentanycast-tsTypeScriptTypeScript SDK -- npm install agentanycast
agentanycast-nodeGoCore daemon -- P2P networking, encryption, A2A engine
agentanycast-relayGoRelay server + skill registry + multi-relay federation

Examples

Start with 01-hello-world or explore all examples -- including CrewAI, LangGraph, Google ADK, OpenAI Agents, Claude Agent SDK, and AWS Strands integrations.

Documentation

GuideDescription
Getting StartedInstall, run your first agent, connect two agents
ArchitectureSidecar model, security, NAT traversal, federation
Python SDK ReferenceNode, AgentCard, TaskHandle, DID, framework adapters
TypeScript SDK ReferenceComplete TypeScript API reference
Deployment GuideProduction relay, HTTP bridge, MCP server, metrics
Protocol ReferenceWire format, task lifecycle, gRPC services
ExamplesAnycast, adapters, streaming, LLM-powered agents
FAQ & TroubleshootingCommon questions and solutions

Contributing

Contributions welcome! See CONTRIBUTING.md for guidelines. A CLA bot will guide you on your first PR.

License

SDKs and protocol definitions are Apache-2.0. Daemon and relay are FSL-1.1-Apache-2.0 -- each release auto-converts to Apache-2.0 after two years.

Community

Files in the repo

Repository payload17 top-level entries
  • .github
  • docs
  • examples
  • proto
  • tests
  • .cursorrules
  • .editorconfig
  • .gitignore
  • CHANGELOG.md
  • CLA.md
  • CODE_OF_CONDUCT.md
  • CONTRIBUTING.md
  • LICENSE
  • llms-full.txt
  • llms.txt
  • README.md
  • SECURITY.md

Discussion (0)

Ask about usage, or say what you built with it

Sign in to join the discussion.

No comments yet. Be the first to say what this is good for.

More frameworks & sdks

HKUDS/nanobotFrameworks & SDKs

Ultra-lightweight, open-source, self-hosted personal AI agent framework in Python with WebUI, tools, memory, MCP, multi-agent workflows, automation, and chat apps

48k
microsoft/
SkillOpt
microsoft/SkillOptFrameworks & SDKs

SkillOpt is a text-space optimizer that trains reusable natural-language skills for frozen LLM agents through trajectory-driven edits, validation-gated updates, and deployable best_skill.md artifacts.

17k
omnigent-ai/omnigentFrameworks & SDKs

Omnigent is an open-source AI agent framework and meta-harness: orchestrate Claude Code, Codex, Cursor, Pi, and custom agents — swap harnesses without rewriting, enforce policies and sandboxing, and collaborate in real time from any device.

9.8k
kyegomez/
OpenMythos
kyegomez/OpenMythosFrameworks & SDKs

A theoretical reconstruction of the Claude Mythos architecture, built from first principles using the available research literature.

15k
D4Vinci/ScraplingFrameworks & SDKs

🕷️ An adaptive Web Scraping framework that handles everything from a single request to a full-scale crawl!

80k