agent2agent
A Ruby implementation of Google's Agent-to-Agent (A2A) protocol -- an open standard for interoperable communication between AI agents.
Build A2A-compliant agents that can communicate with any other A2A agent regardless of language or framework. Ships with server and client, both protocol bindings (JSON-RPC 2.0 and HTTP+JSON/REST), SSE streaming, SQLite persistence, and push notifications.
Runs on Falcon + Async -- pure fiber-based concurrency, no threads.
Usage
Please browse the source code index or refer to the guides below.
Getting Started
This guide walks you through installing agent2agent, building a minimal agent, and calling it from both curl and Ruby.
Agent DSL
This guide covers the handler DSL for building agents.
Streaming
This guide covers SSE streaming for real-time task updates and chunked artifact delivery.
Multi-Turn Conversations
This guide covers using TASK_STATE_INPUT_REQUIRED to build confirmation-gated and multi-step conversations.
Async Background Jobs
This guide covers non-blocking background work with returnImmediately and Store::Processor.
Task Stores
This guide covers the in-memory and SQLite task stores and their shared interface.
Schema Validation
This guide covers the 47 A2A protocol types available as validated Ruby objects.
Protocol Operations
This guide covers all 11 A2A operations and task state lifecycle.
Tracing
This guide explains how to add distributed tracing to your A2A agents using the traces gem.
Echo Agent
A minimal A2A agent that echoes messages back. The simplest starting point for understanding the A2A protocol.
Multi-Turn Conversation
Demonstrates the INPUT_REQUIRED state for multi-turn interactions where the agent asks for user confirmation before proceeding.
Async Jobs
Demonstrates non-blocking task processing with background fibers, live progress via SSE, and polling.
Streaming Artifacts
Demonstrates chunked artifact streaming with append/lastChunk semantics, streaming multiple files as separate artifacts over SSE.
Push Notifications
Demonstrates asynchronous task processing with webhook-based push notification delivery for status and artifact updates.
Multi-Agent Orchestration
Three A2A agents communicating via the protocol: an LLM-powered orchestrator discovers remote agents and delegates tasks to the most appropriate one.
Full Echo Agent
Demonstrates all 11 A2A protocol operations in a single agent with Falcon-native SSE streaming and a SQLite-backed persistent task store.
Development
bin/setup # bundle install
bin/console # IRB with A2A loaded
bin/test # run inline tests (scampi)
bin/integration # full protocol test against both bindings (requires Docker)
License
Apache 2.0