This directory contains A2A (Agent-to-Agent) server implementations that expose an elizaOS agent as an HTTP server. This enables agent-to-agent communication, webhooks, and integration with other AI systems.
Uses real elizaOS runtime.
- If
OPENAI_API_KEYis set, the server will use an OpenAI-backed model (and SQL where supported). - If
OPENAI_API_KEYis not set, the server runs in a deterministic “ELIZA classic” mode (no API keys required), backed by@elizaos/plugin-inmemorydbfor ephemeral multi-turn state.
| Framework | Language | Directory |
|---|---|---|
| Express.js | TypeScript | . |
A2A (Agent-to-Agent) is a pattern where AI agents communicate with each other over HTTP. Each agent exposes a simple API that allows:
- Sending messages to the agent
- Receiving responses
- Querying agent capabilities
- Multi-turn conversations with session management
All implementations expose the same REST API:
Returns information about the agent.
curl http://localhost:3000/Response:
{
"name": "Eliza",
"bio": "A helpful AI assistant",
"version": "2.0.0-beta.0",
"capabilities": ["chat", "reasoning", "tool-use"],
"powered_by": "elizaOS"
}Health check endpoint.
curl http://localhost:3000/healthSend a message to the agent and receive a response.
curl -X POST http://localhost:3000/chat \
-H "Content-Type: application/json" \
-d '{"message": "Hello, how are you?", "sessionId": "user-123"}'Response:
{
"response": "Hello! I'm doing well, thank you for asking. How can I help you today?",
"agentId": "eliza-agent-id",
"sessionId": "user-123",
"timestamp": "2024-01-10T12:00:00Z"
}Stream a response from the agent (SSE).
curl -X POST http://localhost:3000/chat/stream \
-H "Content-Type: application/json" \
-H "Accept: text/event-stream" \
-d '{"message": "Tell me a story"}'cd examples/a2a
bun install
bun run startOptional: OpenAI API key (enables OpenAI-backed responses):
export OPENAI_API_KEY=your-keyOptional configuration:
PORT- Server port (default: 3000)OPENAI_BASE_URL- Custom OpenAI-compatible endpointOPENAI_SMALL_MODEL- Model for quick responsesOPENAI_LARGE_MODEL- Model for complex responses
- Multi-Agent Systems: Have multiple agents communicate with each other
- Webhooks: Receive events from external services and have the agent respond
- Chatbots: Deploy agents as backend services for chat applications
- API Integration: Integrate agents into existing API-based workflows
- Testing: Test agent behavior programmatically
cd examples/a2a
bun run test# Agent A calls Agent B
curl -X POST http://agent-b:3000/chat \
-H "Content-Type: application/json" \
-H "X-Agent-Id: agent-a" \
-d '{
"message": "Can you help me analyze this data?",
"context": {"source": "agent-a", "task": "data-analysis"}
}'