examples/

directory
v0.12.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 29, 2025 License: MIT

README ΒΆ

A2A ADK Examples

This directory contains scenario-based examples demonstrating different capabilities of the A2A Agent Development Kit (ADK).

Table of Contents

πŸ“ Structure

Each example is a self-contained scenario with:

  • Server: A2A server implementation with task handlers
  • Client: A2A client that demonstrates sending tasks and receiving responses
  • Configuration: Environment-based config
  • README: Detailed documentation and usage instructions
examples/
β”œβ”€β”€ minimal/              # Basic server/client without AI (echo responses)
β”œβ”€β”€ default-handlers/     # Using built-in default task handlers
β”œβ”€β”€ static-agent-card/    # Loading agent config from JSON file
β”œβ”€β”€ ai-powered/           # Server with LLM integration
β”œβ”€β”€ ai-powered-streaming/ # AI with real-time streaming
β”œβ”€β”€ streaming/            # Real-time streaming responses
β”œβ”€β”€ artifacts-filesystem/ # Artifact storage using local filesystem
└── artifacts-minio/      # Artifact storage using MinIO (S3-compatible)

πŸš€ Quick Start

Running Any Example
  1. Navigate to the example directory:
cd examples/minimal
  1. Run with Docker Compose:
docker-compose up --build
  1. Or run locally:
# Terminal 1 - Server
cd server && go run main.go

# Terminal 2 - Client
cd client && go run main.go

πŸ“š Available Examples

Core Examples
minimal/

The simplest A2A server and client setup with custom echo task handler.

  • Custom TaskHandler implementation
  • Basic request/response pattern
  • No external dependencies
default-handlers/

Server using built-in default task handlers - no need to implement custom handlers.

  • WithDefaultTaskHandlers() for quick setup
  • Automatic mock responses (no LLM required)
  • Optional AI integration when LLM is configured
static-agent-card/

Demonstrates loading agent configuration from JSON files using WithAgentCardFromFile().

  • Agent metadata defined in agent-card.json
  • Runtime field overrides (URLs, ports)
  • Environment-specific configurations
ai-powered/

Custom AI task handler with LLM integration (OpenAI, Anthropic, etc.).

  • Custom AITaskHandler implementation
  • Multiple provider support
  • Environment-based LLM configuration
streaming/

Real-time streaming responses for chat-like experiences.

  • Custom StreamableTaskHandler implementation
  • Character-by-character streaming
  • Event-based communication
ai-powered-streaming/

AI-powered streaming with LLM integration.

  • Real-time AI responses
  • Streaming LLM integration
  • Event-driven architecture
Artifact Examples
artifacts-filesystem/

Demonstrates artifact creation and download using local filesystem storage.

  • Filesystem storage provider
  • HTTP download endpoints
  • Client artifact download integration
artifacts-minio/

Demonstrates artifact creation and download using MinIO (S3-compatible) storage.

  • MinIO storage provider
  • S3-compatible API
  • Production-ready cloud storage

πŸ”§ Configuration

All examples follow a consistent environment variable pattern with the A2A_ prefix:

Common A2A Variables
  • A2A_SERVER_PORT: Server port (default: 8080)
  • A2A_DEBUG: Enable debug logging (default: false)
  • A2A_AGENT_NAME: Agent identifier
  • A2A_AGENT_DESCRIPTION: Agent description
  • A2A_AGENT_VERSION: Agent version
AI/LLM Configuration

For examples with AI integration:

  • A2A_AGENT_CLIENT_PROVIDER: LLM provider (openai, anthropic)
  • A2A_AGENT_CLIENT_MODEL: Model to use (gpt-4, claude-3-haiku-20240307)
  • A2A_AGENT_CLIENT_BASE_URL: Custom gateway URL (optional)

See each example's README for specific configuration details.

πŸ“– Learning Path

Recommended progression:

  1. minimal/ - Understand basic A2A protocol and custom task handlers
  2. default-handlers/ - Learn built-in handlers for rapid development
  3. static-agent-card/ - Externalize agent configuration to JSON files
  4. artifacts-filesystem/ - Add file generation and download capabilities
  5. ai-powered/ - Add LLM integration for intelligent responses
  6. streaming/ - Implement real-time streaming capabilities
  7. ai-powered-streaming/ - Combine AI integration with real-time streaming
  8. artifacts-minio/ - Production-ready artifact storage with MinIO

For detailed setup instructions, configuration options, and troubleshooting, see each example's individual README file.

For more information about the A2A protocol and framework, see the main README or refer to the official documentation.

Directories ΒΆ

Path Synopsis
ai-powered
server module
ai-powered-streaming
server module
artifacts-autonomous-tool
server module
artifacts-with-default-handlers
server module
callbacks
server module
default-handlers
server module
input-required
minimal
server module
queue-storage
redis/server module
static-agent-card
client command
server command
streaming
server module
usage-metadata
server module

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL