This car purchase assistant demonstrates advanced agentic orchestration patterns for complex, multi-phase workflows:
Primary Use Case: Shows how to orchestrate specialized agents (research, shopping, appointment booking) through a single conversational interface, demonstrating end-to-end workflow management.
Context-Aware Orchestration: Demonstrates how to maintain context across different phases, with structured data flow between research results, shopping decisions, financing options, and appointment scheduling.
Comprehensive Workflow: The assistant handles the complete car purchase journey from initial research to final appointment booking, including financial assessment and loan calculations.
The car purchase assistant uses multiple specialized servers and agents to provide a comprehensive car buying experience:
Web Search Server: Provides car research capabilities by:
- Either, connecting to external search APIs (API key required), allowing the assistant to retrieve up-to-date information for real-time car research and decision-making.
- Or, using a static mock dataset.
Appointment Booking Server: Handles appointment scheduling with dealers, providing flexible scheduling options and availability management.
For setup and technical details, see:
Car Shopping Server: Powers the car shopping and purchase workflow. This server provides structured car search and recommendation capabilities, enabling the assistant to help users find vehicles, check availability at dealers, and facilitate car reservations.
For more details on its features and configuration, see the Car Shopping A2A Server README.
The assistant includes several specialized sub-agents:
- Research Agent: Handles web-based car research using the Tavily search API using the Web Search Server.
- Shopping Agent: Manages car shopping workflows through the A2A car shopping server using the Car Shopping Server.
- Appointment Selector: Facilitates appointment booking with dealers using the Appointment Booking Server.
The car purchase assistant provides a comprehensive end-to-end car buying experience with the following capabilities:
- Web-based research: Uses the Tavily search API to find current information about car models, reviews, and specifications
- Intelligent recommendations: Provides personalized car suggestions based on user preferences
- Real-time data: Accesses up-to-date pricing, features, and availability information
- Dealer availability: Checks if specific cars are available at specific dealers
- Similar car recommendations: Suggests alternatives when the exact model isn't available
- Dealer recommendations: Finds dealers that stock the desired car models
- Car reservations: Facilitates the reservation of cars at dealers (not purchases)
- Credit score checking: Validates user identity and retrieves credit scores
- Loan affordability: Calculates debt-to-income ratios and determines loan affordability
- Existing loan analysis: Reviews current loan obligations
- Account balance checking: Verifies available funds
- Loan calculations: Provides detailed financing options with different terms and down payments
- Flexible scheduling: Books appointments with dealers based on user preferences
- Availability management: Handles date and time constraints with intelligent defaults
- Confirmation workflow: Provides confirmation and cancellation options
The car purchase assistant includes E2E testing capabilities using mock Web-Search MCP server.
- Reduce External Dependencies: No need for Tavily API key during testing.
- More consistent Results: Mock data ensures more reproducible test outcomes across different environments
- Cost Effective: Reduces API usage costs during development and testing cycles
- Faster Execution: Mock responses are instant, significantly speeding up test runs
Our tests focus on the assistant's orchestration capabilities rather than external API functionality:
- Flow Management: How the assistant guides users through complex multi-step workflows
- Conversation Patterns: Context maintenance and natural conversation handling
- Agent Coordination: How different specialized agents work together seamlessly
- Error Handling: Graceful handling of user cancellations and digressions
- State Management: Proper tracking of user preferences and conversation state
Important: We are not testing the external search APIs themselves - we're testing how the assistant uses search results to provide intelligent responses and maintain conversation flow.
The mock system uses static dataset (mock_data.json for car research) that provides realistic responses when the MOCK_TAVILY_SEARCH=true environment variable is set. This allows the assistant to demonstrate its full capabilities using predetermined data.
For technical implementation details, see the Web Search MCP Server README.
- Python 3.10 or higher
- pip (Python package installer)
Install dependencies from the pyproject.toml:
pip install -e .Copy the example environment file and fill in your API keys:
-
Copy the example file to create your own
.envfile:cp .env_example .env
-
Open the
.envfile in a text editor and fill in the required values:OPENAI_API_KEY: Your OpenAI API keyRASA_PRO_LICENSE: Your Rasa Pro license keyTAVILY_API_KEY: Your Tavily API key for web search functionalityGOOGLE_API_KEY: Your Google API key for Gemini integration
The OPENAI_API_KEY is required as we are using gpt-4o as the default LLM within
Rasa. If you switch to a different LLM (see
documentation),
the key might not be needed.
Make sure to save the .env file in the root of the car-purchase-assistant
directory.
- Run
docker compose up
To run the car purchase assistant, follow these steps in order:
-
Start the Web Search MCP server
To start the web search MCP server, follow the instructions provided in the Web Search MCP Server README.
-
Start the Appointment Booking MCP server
To start the appointment booking MCP server, follow the instructions provided in the Appointment Booking MCP Server README.
-
Start the Car Shopping A2A server
To start the car shopping A2A server, follow the instructions provided in the Car Shopping A2A Server README.
-
Train the Rasa model In another terminal (from the project root), train the assistant:
rasa train
-
Run the assistant in interactive mode Still in the project root, start the assistant:
rasa inspect
This will launch an interactive shell where you can chat with the assistant.
Note:
Make sure your .env file is set up with the required API keys before starting. You'll need:
TAVILY_API_KEYfor web search functionalityGOOGLE_API_KEYfor the car shopping A2A serverOPENAI_API_KEYfor the main Rasa assistantRASA_PRO_LICENSEfor Rasa Pro