This repository contains the completed solution for the Munder Difflin Paper Company Multi-Agent System. It implements a 5-agent architecture using smolagents to automate inventory, quoting, and ordering workflows.
The system is designed to handle customer inquiries via a text-based interface, orchestrating multiple specialized agents to provide accurate quotes, check stock, and process orders.
- Multi-Agent Architecture: Uses 5 distinct agents (Orchestrator, Inventory, Quote, Order, BusinessAdvisor).
- Tool Integration: Wraps SQL database operations and logic helpers as tools.
- Robust Parsing: Handles free-form text requests and extracts line items/dates.
- Business Logic: Implements bulk discounts, delivery estimation, and partial fulfillment.
- Customer-Safe Outputs: Provides transparent explanations without revealing sensitive internal data.
The system follows a hub-and-spoke model managed by an Orchestrator Agent.
- Orchestrator: Central coordinator.
- InventoryAgent: Checks stock levels (
get_all_inventory,get_stock_level). - QuoteAgent: Calculates pricing and discounts (
get_supplier_delivery_date,search_quote_history). - OrderAgent: Books sales transactions (
create_transaction). - BusinessAdvisorAgent: Provides operational summaries (
generate_financial_report). - CustomerAgent: (Helper) Suggests alternatives for unknown items.
See workflow_diagram.md for a visual representation.
project_starter.py: Main implementation file containing all agents and logic.workflow_diagram.md: Mermaid diagram of the agent architecture.reflection_report.md: Detailed report on design decisions and evaluation.test_results.csv: Output from the evaluation harness running against sample requests.munder_difflin.db: SQLite database (generated).
-
Install Dependencies:
pip install -r requirements.txt pip install smolagents
-
Set API Key: Create a
.envfile with your OpenAI-compatible key:UDACITY_OPENAI_API_KEY=your_key_here -
Run the System:
python project_starter.py
This will:
- Initialize the database.
- Run the test scenarios from
quote_requests_sample.csv. - Generate
test_results.csv. - Print agent outputs to the console.
The system has been evaluated against 20 sample requests, demonstrating:
- Successful fulfillment of valid orders.
- Correct handling of stock shortages and delivery constraints.
- Accurate cash balance updates.
See reflection_report.md for a full analysis.
You’ve been hired as an AI consultant by Munder Difflin Paper Company... (rest of original context below)
You’ve been hired as an AI consultant by Munder Difflin Paper Company, a fictional enterprise looking to modernize their workflows. They need a smart, modular multi-agent system to automate:
- Inventory checks and restocking decisions
- Quote generation for incoming sales inquiries
- Order fulfillment including supplier logistics and transactions
Your solution must use a maximum of 5 agents and process inputs and outputs entirely via text-based communication.
This project challenges your ability to orchestrate agents using modern Python frameworks like smolagents, pydantic-ai, or npcsh, and combine that with real data tools like sqlite3, pandas, and LLM prompt engineering.
From the project.zip starter archive, you will find:
project_starter.py: The main Python script you will modify to implement your agent systemquotes.csv: Historical quote data used for reference by quoting agentsquote_requests.csv: Incoming customer requests used to build quoting logicquote_requests_sample.csv: A set of simulated test cases to evaluate your system
All the files have been provided in the VS Code workspace on the Udacity platform. Please install the agent orchestration framework of your choice.
- Install dependencies
Make sure you have Python 3.8+ installed.
You can install all required packages using the provided requirements.txt file:
pip install -r requirements.txt
If you're using smolagents, install it separately:
pip install smolagents
For other options like pydantic-ai or npcsh[lite], refer to their documentation.
- Create .env File
Add your OpenAI-compatible API key:
UDACITY_OPENAI_API_KEY=your_openai_key_here
This project uses a custom OpenAI-compatible proxy hosted at https://openai.vocareum.com/v1.
Start by defining your agents in the "YOUR MULTI AGENT STARTS HERE" section inside template.py. Once your agent team is ready:
- Run the
run_test_scenarios()function at the bottom of the script. - This will simulate a series of customer requests.
- Your system should respond by coordinating inventory checks, generating quotes, and processing orders.
Output will include:
- Agent responses
- Cash and inventory updates
- Final financial report
- A
test_results.csvfile with all interaction logs
- Start by sketching a flow diagram to visualize agent responsibilities and interactions.
- Test individual agent tools before full orchestration.
- Always include dates in customer requests when passing data between agents.
- Ensure every quote includes bulk discounts and uses past data when available.
- Use the exact item names from the database to avoid transaction failures.
Make sure to submit the following files:
- Your completed
template.pyorproject_starter.pywith all agent logic - A workflow diagram describing your agent architecture and data flow
- A
README.txtordesign_notes.txtexplaining how your system works - Outputs from your test run (like
test_results.csv)