Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.xhipai.com/llms.txt

Use this file to discover all available pages before exploring further.

A2A Protocol

Agentium provides full support for the Agent-to-Agent (A2A) protocol, enabling interoperability between AI agents built on different frameworks.
A2A is an open standard by Google that defines how AI agents communicate with each other via JSON-RPC 2.0 over HTTP. It includes agent discovery, task management, and streaming.

Capabilities

Agentium supports both sides of A2A:

A2A Server

Expose your Agentium agents as A2A-compliant endpoints. Other frameworks (LangGraph, CrewAI, etc.) can discover and call your agents.

A2A Client

Connect to remote A2A agents. Use them as tools, team members, or call them directly.

How It Works

┌──────────────────┐         ┌──────────────────┐
│  Agentium Agent    │  A2A    │  Remote Agent     │
│  (Server)         │◄───────►│  (Any Framework)  │
│                   │ HTTP/   │                   │
│  /.well-known/    │  SSE    │  /.well-known/    │
│   agent.json      │         │   agent.json      │
└──────────────────┘         └──────────────────┘
  1. Discovery — Agents publish an Agent Card at /.well-known/agent.json describing their capabilities
  2. Communication — JSON-RPC 2.0 messages over HTTP (message/send) or SSE (message/stream)
  3. Task Management — Each interaction creates a task with lifecycle states (submitted → working → completed)

Quick Example

Expose an agent as A2A server

import express from "express";
import { Agent, openai } from "@agentium/core";
import { createA2AServer } from "@agentium/transport";

const app = express();

const agent = new Agent({
  name: "assistant",
  model: openai("gpt-4o"),
  instructions: "You are a helpful assistant.",
});

createA2AServer(app, {
  agents: { assistant: agent },
  provider: { organization: "MyCompany" },
});

app.listen(3001);
// Agent Card: http://localhost:3001/.well-known/agent.json

Call a remote A2A agent

import { A2ARemoteAgent } from "@agentium/core";

const remote = new A2ARemoteAgent({
  url: "http://localhost:3001",
});

await remote.discover();
const result = await remote.run("Hello!");
console.log(result.text);