A modern, lightweight implementation of the Agent-to-Agent (A2A) communication protocol built with Next.js and TypeScript. This project provides a streamlined approach to agent communication, focusing on essential features while maintaining extensibility.
-
🤖 A2A Protocol Implementation:
- Simplified yet powerful agent-to-agent communication
- JSON-RPC 2.0 based protocol
- Standardized request/response format
- Extensible message structure
-
🚀 Modern Tech Stack:
- Next.js 15 with App Router
- React 19 and TypeScript
- Vercel AI SDK for LLM integration
- Assistant UI for chat interface
-
🎨 UI Components:
- Beautiful and responsive design
- Powered by Radix UI
- Styled with Tailwind CSS
- Markdown support with remark-gfm
-
🔄 Real-time Features:
- Streaming responses
- Dynamic agent routing
- Real-time status updates
- Interactive chat interface
-
🛠️ Developer Experience:
- Comprehensive TypeScript types
- Modern development tools
- Clear project structure
- Easy to extend and customize
- Node.js 18+
- pnpm (recommended) or npm
- OpenAI API key (for LLM integration)
- Clone the repository:
git clone https://github.com/htondro/simple-a2a.git
cd simple-a2a- Install dependencies:
pnpm install- Set up environment variables:
cp .env.example .env.local- Edit
.env.localand add the following environment variables:
# OpenAI Configuration
OPENAI_API_KEY=your_api_key_here
OPENAI_API_BASE=https://api.openai.com/v1
# Application Configuration
NEXT_PUBLIC_URL=http://localhost:3000
# Agent Models (Optional)
CLIENT_AGENT_MODEL=gpt-4o-mini # Model for the triage agent
CODER_AGENT_MODEL=gpt-4o # Model for the code generation agent- Start the development server:
pnpm dev- Open http://localhost:3000 in your browser
src/
├── app/ # Next.js app directory
│ └── api/ # API routes
│ ├── agents/ # Agent implementations
│ │ └── coder/ # Code generation agent
│ └── client/ # Client API endpoints
├── components/ # React components
├── hooks/ # Custom React hooks
├── lib/ # Utility functions and shared code
│ └── llm/ # LLM provider implementations
└── types/ # TypeScript type definitions
| Command | Description |
|---|---|
pnpm dev |
Start development server |
pnpm build |
Build for production |
pnpm start |
Start production server |
pnpm lint |
Run ESLint |
This project implements a simplified version of the A2A protocol with the following components:
-
Client (Triage Agent):
- Analyzes user requests
- Routes to appropriate agents
- Handles response formatting
- Manages tool selection
-
Specialized Agents:
- Code Generation Agent (CodeCrafter)
- More agents can be added dynamically
-
Protocol Layer:
- JSON-RPC 2.0 based communication
- Standardized request/response format
- Extensible message structure
- User sends message to client
- Client analyzes request and selects appropriate agent
- Agent processes request and returns response
- Client formats and streams response to user
-
Agent Auto-Discovery:
- Implement automatic scanning of agents directory
- Dynamic registration of new agents
- No manual configuration needed
-
Enhanced Toolset Creation:
- Parse agent capabilities from agent.json
- Create parameter schemas based on capabilities
- Support multiple response formats
- Implement streaming when available
- Map agent skills to tool functions
-
Additional Features:
- Support for more agent types
- Enhanced error handling
- Better type safety
- Improved documentation
We welcome contributions! Here's how you can help:
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Follow the existing code style
- Add tests for new features
- Update documentation as needed
- Ensure all tests pass
This project is licensed under the MIT License - see the LICENSE file for details.
- Next.js - The React framework for production
- Radix UI - Unstyled, accessible UI components
- Tailwind CSS - A utility-first CSS framework
- OpenAI - Advanced AI models and APIs
- Vercel AI SDK - AI development toolkit for Next.js applications
- Google A2A Protocol - The original A2A protocol specification and implementation
- Next.js Documentation
- React Documentation
- TypeScript Documentation
For support, please open an issue or contact me.