This demo showcases the integration of the A2A (Agent-to-Agent) Protocol with Kaibanjs, demonstrating how AI agents can communicate and collaborate using standardized protocols.
- Server: Express.js server with A2A Protocol SDK
- Client: React application with Vite build tool and A2A client
- Agents: Kaibanjs multi-agent system with web search and summarization capabilities
- 🤖 A2A Protocol Integration: Full implementation of Agent-to-Agent communication
- 🔍 Web Search: Real-time web search using Tavily API
- 📝 Content Summarization: AI-powered content summarization
- 📊 Real-time Streaming: Live updates of agent workflow logs
- 🎨 Modern UI: Clean React interface built with Vite and Tailwind CSS
- Node.js 18+
- npm or pnpm
- API keys for OpenAI, and Tavily
-
Clone and install dependencies:
npm run install:all
-
Configure environment variables:
# Copy server environment template cp server/env.example server/.env # Edit server/.env with your API keys: # OPENAI_API_KEY=your_key_here # TAVILY_API_KEY=your_key_here
-
Start the development servers:
npm run dev
This will start:
- A2A Server on http://localhost:4000
- React Client on http://localhost:5173
- Open http://localhost:5173 in your browser
- Click "Connect to Server" to establish A2A connection
- Enter a research query (e.g., "What are the latest developments in AI?")
- Watch real-time logs as agents collaborate
- View the final research results
a2a-kaibanjs-demo/
├── server/ # A2A Protocol Server
│ ├── src/
│ │ ├── index.ts # Express server setup
│ │ ├── agent-executor.ts # A2A AgentExecutor implementation
│ │ ├── agent-card.ts # Agent capabilities definition
│ │ └── kaibanjs-team.ts # Kaibanjs team configuration
│ └── package.json
├── client/ # React A2A Client with Vite
│ ├── src/
│ │ ├── components/ # UI components
│ │ ├── stores/ # Zustand state management
│ │ └── App.tsx # Main application
│ ├── package.json # Dependencies including Vite
│ └── vite.config.ts # Vite configuration
└── package.json # Workspace configuration
- Client connects to server using Agent Card discovery
- Messages sent via A2A Protocol standard
- Real-time streaming of agent status updates
- Scout Agent: Performs web search using Tavily API
- Writer Agent: Creates comprehensive summaries
- Team Coordination: Orchestrates agent collaboration
- Server streams workflow logs to client
- Client displays live progress updates
- Final results delivered via A2A artifacts
GET /.well-known/agent-card.json
- Agent capabilitiesPOST /message
- Send messages to agentGET /health
- Server health check
PORT=4000
BASE_URL=http://localhost:4000
OPENAI_API_KEY=your_openai_key
TAVILY_API_KEY=your_tavily_key
-
Build the project:
npm run build
-
Deploy to Vercel:
- Server: Deploy
server/
as Vercel Functions - Client: Deploy
client/dist/
as static site (built with Vite)
- Server: Deploy
-
Configure environment variables in Vercel dashboard
-
Prepare for deployment:
# Install dependencies npm run install:all # Build the project npm run build
-
Deploy to Vercel:
# Install Vercel CLI npm i -g vercel # Deploy vercel
-
Configure environment variables in Vercel dashboard:
OPENAI_API_KEY
: Your OpenAI API keyTAVILY_API_KEY
: Your Tavily API keyVITE_SERVER_URL
: Your Vercel serverless function URL (auto-generated)
-
Project Structure for Vercel:
- Server: Deployed as serverless functions in
/api/*
- Client: Deployed as static site (built with Vite)
- Routes: Automatically configured via
vercel.json
- Server: Deployed as serverless functions in
-
Push to GitHub:
git add . git commit -m "Ready for Vercel deployment" git push origin main
-
Connect to Vercel:
- Go to vercel.com
- Import your GitHub repository
- Vercel will auto-detect the configuration
-
Environment Variables:
- Add all required API keys in Vercel dashboard
- The
VITE_SERVER_URL
will be automatically set
- A2A Protocol: @a2a-js/sdk
- Kaibanjs: Multi-agent orchestration framework
- Express.js: Server framework
- React: Frontend framework
- Vite: Build tool and development server
- Tailwind CSS: Styling
- Zustand: State management
- Tavily: Web search API
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
MIT License - see LICENSE file for details