/a2a-demo

Primary LanguageTypeScriptMIT LicenseMIT

A2A-Demo: Cross-Departmental AI Agent Integration

A demonstration project showcasing the integration between AG-UI and A2A protocols, enabling seamless communication between AI agents across different departments and systems.

🎯 Overview

This demo features an HR Agent as the primary interface that can intelligently delegate tasks to specialized departmental agents:

  • πŸ’° Finance Agent - Handles budgets, expenses, payroll, and financial queries
  • πŸ’» IT Agent - Manages technical requests, system access, and IT support
  • 🏒 Buildings Management Agent - Oversees facilities, maintenance, and office resources

The HR agent acts as a central coordinator, automatically routing complex requests to the appropriate specialists and orchestrating multi-departmental workflows.

🎬 Demo

🌐 Try the Live Demo

A2A Demo

See the A2A protocol in action as agents seamlessly communicate across departments

πŸ”— Protocol Integration

AG-UI Protocol

Provides the user interface and conversation management, enabling natural language interactions with the agent system.

A2A (Agent-to-Agent) Protocol

Enables secure, structured communication between different AI agents, allowing them to:

  • Share context and information
  • Delegate specialized tasks
  • Coordinate complex, cross-departmental workflows
  • Maintain conversation continuity across agent handoffs

πŸš€ Key Features

  • 🀝 Cross-Departmental Coordination: HR agent seamlessly communicates with specialized agents
  • πŸ”„ Intelligent Task Routing: Automatically determines which agent(s) can best handle specific requests
  • πŸ“‹ Context Preservation: Maintains conversation context across agent interactions
  • ⚑ Real-time Communication: Live streaming of agent responses and tool calls
  • πŸŽ›οΈ Multi-Agent Orchestration: Handles complex workflows requiring multiple departments

πŸ› οΈ Example Use Cases

Employee Onboarding

User: "Set up a new employee John Doe starting Monday"
HR Agent β†’ IT Agent: "Create user account and email for John Doe"
HR Agent β†’ Buildings: "Assign desk and access card for new hire"
HR Agent β†’ Finance: "Add John Doe to payroll system"

Budget Request with IT Requirements

User: "I need approval for a $5000 software license and server setup"
HR Agent β†’ Finance: "Review budget availability for $5000 expense"
HR Agent β†’ IT: "Assess technical requirements for software deployment"

Facility Issue with Security Implications

User: "The keycard reader is broken in the secure server room"
HR Agent β†’ Buildings: "Schedule repair for keycard reader"
HR Agent β†’ IT: "Implement temporary security measures for server room"

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Web Frontend  β”‚    β”‚   AG-UI Client  β”‚
β”‚    (Next.js)    │◄──►│   Integration   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚                       β”‚
         β–Ό                       β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚            HR Agent                     β”‚
β”‚        (Central Coordinator)            β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚           β”‚           β”‚
         β–Ό           β–Ό           β–Ό
    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”
    β”‚Finance  β”‚ β”‚   IT    β”‚ β”‚Buildingsβ”‚
    β”‚ Agent   β”‚ β”‚ Agent   β”‚ β”‚  Agent  β”‚
    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

🚦 Getting Started

Prerequisites

  • Node.js 18+ and pnpm
  • Python 3.12+
  • OpenAI API Key

1. Start the Web Application

# Install dependencies
pnpm install

# Set your OpenAI API key
export OPENAI_API_KEY=your_openai_api_key_here

# Start the development server
pnpm dev

The application will be available at http://localhost:3000

2. Setup and Run the Agents

# Navigate to agents directory
cd agents

# Create virtual environment (one-time setup)
uv venv .venv --python 3.12
source .venv/bin/activate

# Install dependencies (one-time setup)
uv pip install -r pyproject.toml --all-extras

# Set your OpenAI API key
export OPENAI_API_KEY=your_openai_api_key_here

# Start all agents
./run_agents.sh

This will start all three departmental agents simultaneously:

  • Finance Agent on http://localhost:8001
  • IT Agent on http://localhost:8002
  • Buildings Management Agent on http://localhost:8003

Press Ctrl+C to stop all agents.

3. Try It Out

  1. Open the web application at http://localhost:3000
  2. Start a conversation with the HR agent
  3. Try cross-departmental requests like:
    • "Help me onboard a new employee"
    • "I need to request a budget for new office equipment"
    • "Set up IT access for our new intern"

πŸ§ͺ Development

Adding New Agents

  1. Create a new agent in the agents/ directory
  2. Update run_agents.sh to include the new agent
  3. Configure the agent URL in the frontend integration

Customizing Agent Capabilities

Each agent's capabilities are defined in their respective Python files in the agents/ directory. You can modify or extend their tool definitions to add new functionality.

πŸ“š Learn More

🀝 Contributing

This is a demonstration project showcasing protocol integration. Feel free to explore the code and adapt it for your own agent communication needs.

πŸ“„ License

MIT License - See LICENSE file for details.