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, and validated protocol objects for all 47 A2A schema types.

Runs on Falcon + Async — pure fiber-based concurrency, no threads.

Quick start

An agent is a Rack app built from a single handler block. Route operations with pattern matching:

# config.ru
require "a2a"

run A2A.agent(agent_card: { "name" => "Echo Agent", "version" => "1.0.0" }) do |env|
  case env["a2a.operation"]
  in "SendMessage"
    A2A::Protocol::JsonSchema["Send Message Response"].new(
      task: {
        "id"        => "task-1",
        "status"    => { "state" => "TASK_STATE_COMPLETED" },
        "artifacts" => [{ "parts" => [{ "text" => "Echo: #{env["a2a.message"]}" }] }],
      }
    )
  end
end

Head to Getting Started for a complete walkthrough — installing the gem, building a minimal agent, and calling it from both curl and Ruby.

What’s here


This site uses Just the Docs, a documentation theme for Jekyll.