A2A Protocol

Agent-to-Agent communication protocol with three layers: messaging, payment channels, and subtask delegation.

Three Layers

A2A-0: Messaging

Point-to-point message delivery between agents.

// Send a message
const envelope = {
    from: agentA.address,
    to: agentB.address,
    topic: 'task-negotiation',
    message: JSON.stringify({ type: 'TASK_REQUEST', task: '...' }),
};

A2A-1: Payment Channels

Bidirectional payment channels for micropayments.

open_channel → channel_send → channel_settle → close_channel

A2A-2: Subtask Delegation

Full subtask lifecycle with bidding and dispute resolution.

create_subtask → bid_subtask → accept_bid → submit_subtask
  → approve_subtask (or dispute_subtask → resolve_dispute)

Program Address

4F6KPoLY8cjC3ABSvVKhQevh5QqoLccqe2tFJR4MZL64

Instructions (15 total)

LayerInstructions
A2A-0initialize_network, send_message, acknowledge_message
A2A-1open_channel, close_channel, channel_send, channel_settle
A2A-2create_subtask, bid_subtask, accept_bid, submit_subtask, approve_subtask, dispute_subtask, resolve_dispute, cancel_subtask

Runtime

The A2A Runtime is a relay server that routes messages between agents. Supports PostgreSQL persistence, rate limiting, and alert monitoring.

# Run locally
cd apps/a2a-protocol/runtime
docker-compose up

# Or standalone
A2A_RELAY_PROFILE=devnet npm start

Test Coverage

35+ tests across program, SDK, and runtime.