A sophisticated multi-agent system built using the Agent-to-Agent (A2A) protocol with Google's Genkit AI framework. This project demonstrates advanced AI agent coordination capabilities with specialized agents for movie information retrieval, quote generation, and intelligent request routing through a multiagent coordinator.
Screen.Recording.2025-07-30.at.16.06.31.mov
- Multi-Agent Architecture: Coordinated system with specialized agents for different tasks
- Intelligent Movie Search: Advanced movie information retrieval using TMDB API
- Actor & People Search: Comprehensive database of actors, directors, and film industry professionals
- Dedicated Quote Agent: Specialized agent for contextual movie quotes from extensive database
- Smart Request Routing: Multiagent coordinator that intelligently routes requests to appropriate agents
- A2A Protocol Implementation: Modern agent-to-agent communication protocol
- MCP Protocol Support: Model Context Protocol servers and clients for standardized tool access
- Streaming Responses: Real-time message streaming for immediate feedback
- Context Management: Persistent conversation context across multiple interactions
- Command-Line Interface: Terminal-based chat client for easy interaction with any agent
- RESTful APIs: Express.js servers with A2A protocol endpoints for each agent
This multi-agent system consists of three specialized agents:
- Movie Agent (Port 41241) - Handles movie information, actor details, plots, recommendations
- Quotes Agent (Port 41242) - Specialized in finding and providing movie quotes
- Multiagent Coordinator (Port 41240) - Intelligently routes requests between agents and combines responses
- Node.js: Runtime environment with ES modules
- Google Genkit: AI framework with Gemini 2.0 Flash model
- A2A SDK: Agent-to-Agent protocol implementation
- MCP SDK: Model Context Protocol for standardized tool access
- TMDB API: The Movie Database integration for film data
- Quote API: Movie quotes from pythonanywhere.com
- Gemini 2.0 Flash: Large language model for natural conversation
- Function Calling: AI tool integration for dynamic data retrieval
- Streaming Processing: Real-time response generation
- Context Awareness: Multi-turn conversation handling
- Tool Integration: Parallel function execution capabilities
This project implements the Model Context Protocol (MCP), a standardized protocol for connecting AI applications with external tools and data sources. MCP enables secure, controlled access to agent capabilities through a unified interface.
Each agent provides both MCP Server and MCP Client implementations:
- MCP Servers: Expose agent tools as standardized MCP resources that other applications can discover and use
- MCP Clients: Connect to MCP servers to access remote tools and capabilities
- Server Name:
movie-mcp-server
- Available Tools:
searchMovies(query: string)
- Search TMDB database for movies by titlesearchPeople(query: string)
- Find actors, directors, and film professionals
- Transport: stdio (standard input/output)
- Data Sources: TMDB API integration
- Server Name:
quotes-mcp-server
- Available Tools:
searchQuotes(query: string)
- Search for movie quotes by title or actor name
- Transport: stdio (standard input/output)
- Data Sources: Movie quotes API
Start MCP servers independently for integration with other applications:
# Start Movie Agent MCP Server
npm run mcp:movie-server
# Start Quotes Agent MCP Server
npm run mcp:quotes-server
- Standardized Interface: Consistent tool discovery and execution across different applications
- Secure Access: Controlled access to agent capabilities through defined schemas
- Tool Composability: Mix and match tools from different agents in external applications
- Protocol Compliance: Full compatibility with MCP-enabled applications and IDEs
- Node.js (v18 or higher)
- npm or pnpm package manager
- Git
- TMDB API key (free registration at TMDB)
- Google Gemini API key
-
Clone the repository:
git clone <repository-url> cd project_name
-
Install dependencies:
npm install
-
Set up environment variables:
# Rename .env_example file to .env and replace credentials cp .env_example .env # Edit .env file with your API keys: # TMDB_API_KEY=<your-api-key> # GEMINI_API_KEY=<your-api-key>
-
Start the Movie Agent server:
npm run agents:movie-agent
The server will start on
http://localhost:41241
-
Start the Quotes Agent server:
npm run agents:quotes-agent
The server will start on
http://localhost:41242
-
Start the Multiagent Coordinator:
npm run agents:multiagent
The server will start on
http://localhost:41240
-
In a separate terminal, start the CLI client:
npm run a2a:cli
.
├── src/
│ ├── agents/
│ │ ├── movie-agent/
│ │ │ ├── index.ts # Movie agent server implementation
│ │ │ ├── genkit.ts # Google Genkit AI configuration
│ │ │ ├── tools.ts # Movie & people search tools
│ │ │ ├── tmdb.ts # TMDB API integration
│ │ │ ├── mcp-server.ts # MCP server for movie tools
│ │ │ ├── mcp-client.ts # MCP client for external integration
│ │ │ ├── movie_agent.prompt # Movie agent prompt template
│ │ ├── quotes-agent/
│ │ │ ├── index.ts # Quotes agent server implementation
│ │ │ ├── genkit.ts # Google Genkit AI configuration
│ │ │ ├── tools.ts # Quote search tools
│ │ │ ├── mcp-server.ts # MCP server for quote tools
│ │ │ ├── mcp-client.ts # MCP client for external integration
│ │ │ ├── quotes_agent.prompt # Quotes agent prompt template
│ │ ├── multiagent/
│ │ │ ├── index.ts # Multiagent coordinator implementation
│ └── cli.ts # Command-line interface client
├── .env_example # Environment variables template
├── package.json # Node.js dependencies and scripts
├── tsconfig.json # TypeScript configuration
└── README.md # Project documentation
- Movie Information Retrieval: Search for movies by title with detailed information including:
- Plot summaries and release dates
- Cast and crew information
- Ratings and reviews
- Poster and backdrop images
- People Search: Find information about actors, directors, and industry professionals:
- Biographical information
- Filmography and known works
- Profile images and career highlights
- Quote Search: Specialized quote retrieval including:
- Quotes by movie title
- Quotes by actor name
- Themed movie quotes
- Properly attributed quotes with character information
- Intelligent Routing: Smart request distribution based on content analysis
- Multi-Agent Requests: Combines responses from multiple agents
- Context Management: Maintains conversation context across agent interactions
GET /.well-known/agent.json
- Agent card informationPOST /a2a/messages
- Send message to agentGET /a2a/messages/stream
- Streaming message interfacePOST /a2a/tasks/{taskId}/cancel
- Cancel active task
- Movie Agent:
http://localhost:41241
- Quotes Agent:
http://localhost:41242
- Multiagent Coordinator:
http://localhost:41240
- Movie Agent MCP Server: stdio transport (run via
npm run mcp:movie-server
) - Quotes Agent MCP Server: stdio transport (run via
npm run mcp:quotes-server
)
// Movie Agent MCP Tools
{
"searchMovies": {
"description": "Search TMDB for movies by title",
"parameters": { "query": "string" }
},
"searchPeople": {
"description": "Search TMDB for people by name",
"parameters": { "query": "string" }
}
}
// Quotes Agent MCP Tools
{
"searchQuotes": {
"description": "Search for movie quotes by title or actor",
"parameters": { "query": "string" }
}
}
# Movie-specific queries (via Movie Agent or Multiagent)
Movie Agent > You: Tell me about Inception
Movie Agent > You: What movies has Leonardo DiCaprio been in?
# Quote-specific queries (via Quotes Agent or Multiagent)
Quotes Agent > You: Give me quotes from The Matrix
Quotes Agent > You: What are some famous quotes by Tom Hanks?
# Multi-agent queries (via Multiagent Coordinator)
Multiagent > You: Tell me about The Dark Knight and give me quotes from it
Multiagent > You: What are Christopher Nolan's best movies and famous quotes from them?
# Special commands (all agents)
Agent > You: /new # Start new session
Agent > You: /exit # Quit application
# Start MCP servers for external integration
npm run mcp:movie-server # Movie tools via MCP protocol
npm run mcp:quotes-server # Quote tools via MCP protocol
# These servers can be integrated with:
# - Claude Desktop and other MCP-compatible applications
# - Custom applications using MCP SDK
# - Development tools and IDEs with MCP support
// Example: Using Movie MCP Client
import { MovieMCPClient } from './src/agents/movie-agent/mcp-client.js';
const client = new MovieMCPClient();
await client.connect();
// Search for movies
const movieResult = await client.searchMovies('The Dark Knight');
console.log(movieResult);
// Search for people
const peopleResult = await client.searchPeople('Christopher Nolan');
console.log(peopleResult);
client.disconnect();
- Movie Agent Routes: Movie plots, actor filmographies, director information, recommendations
- Quotes Agent Routes: Movie quotes by title, quotes by actor, memorable movie lines
- Multi-Agent Routes: Combined movie information and quotes, comprehensive actor profiles
- Function:
searchMovies(query: string)
- Purpose: Search TMDB database for movies by title
- Returns: Movie details, ratings, cast, images
- Function:
searchPeople(query: string)
- Purpose: Find actors, directors, and film professionals
- Returns: Biographical data, filmography, profile images
- Function:
searchQuotes(query: string)
- Purpose: Find memorable quotes related to movies or actors
- Returns: Curated collection of relevant movie quotes
-
Obtain API Keys:
- Register at TMDB for movie data
- Get Google Gemini API key for AI capabilities
-
Quick Start:
# Install and setup npm install cp .env_example .env # Edit .env with your API keys # Start all agents (in separate terminals) npm run agents:movie-agent npm run agents:quotes-agent npm run agents:multiagent # In new terminal, start CLI npm run a2a:cli:multiagent
-
Try These Examples:
- "What are the most popular movies with Leonardo DiCaprio?"
- "Tell me about The Dark Knight and give me quotes from it"
- "What are Christopher Nolan's films and famous quotes from them?"
- "Give me quotes from Star Wars"
This project is licensed under the MIT License - see the LICENSE file for details.
Created by Oleksandr Samoilenko
Extrawest.com, 2025