Assignment: FPT Customer Chatbot - Multi-Agent System#
Assignment Metadata#
Field |
Description |
|---|---|
Assignment Name |
FPT Customer Chatbot - Multi-Agent System |
Course |
LangGraph and Agentic AI |
Project Name |
|
Estimated Time |
240 minutes |
Framework |
Python 3.10+, LangGraph, LangChain, SQLite/PostgreSQL, Tavily API, OpenAI |
Learning Objectives#
By completing this assignment, you will be able to:
Design hierarchical multi-agent architectures with Primary Assistant and specialized agents
Implement dialog stack management for agent transitions
Apply context injection patterns for user information
Build CompleteOrEscalate pattern for agent decision making
Create production-ready tool schemas with Pydantic validation
Problem Description#
Build a customer service chatbot for FPT with the following capabilities:
FAQ Agent: Answer questions about FPT policies using RAG
Ticket Support Agent: Create, track, update, cancel support tickets
IT Support Agent: Troubleshoot technical issues using Tavily search
Booking Agent: Manage meeting room reservations
The Primary Assistant coordinates routing between specialized agents.
Technical Requirements#
Environment Setup#
Python 3.10 or higher
Required packages:
langgraph>= 0.2.0langchain>= 0.1.0sqlalchemy>= 2.0.0pydantic>= 2.0.0tavily-python>= 0.3.0
Database Schema#
Implement the following tables:
Ticket: ticket_id, content, description, customer_name, customer_phone, email (optional), status, time
Booking: booking_id, reason, time, customer_name, customer_phone, email (optional), note, status
Tasks#
Task 1: State & Context Management (20 points)#
Define AgenticState with:
messages: Conversation history with add_messagesdialog_state: Stack tracking agent hierarchyuser_id,email(optional): Context injection fieldsconversation_id: Session tracking
Implement dialog stack functions:
update_dialog_stack: Push/pop agent transitionspop_dialog_state: Return to Primary Assistant
Create context injection that auto-populates user info into tool calls
Task 2: Ticket Support Agent (25 points)#
Define Pydantic schemas for:
CreateTicket: content (required), description, customer_name, phone, email (optional)TrackTicket: ticket_idUpdateTicket: ticket_id (required), optional fields for updates
Implement tools:
create_ticket: Creates ticket with “Pending” statustrack_ticket: Returns ticket informationupdate_ticket: Updates provided fields onlycancel_ticket: Sets status to “Canceled”
Add CompleteOrEscalate tool for returning to Primary Assistant
Task 3: Booking Agent (20 points)#
Define Pydantic schemas with validation for:
BookRoom: reason (required), time (required, must be future)TrackBooking,UpdateBooking,CancelBooking
Implement booking tools with status management:
Status flow: Scheduled → Finished (or Canceled)
Task 4: IT Support & FAQ Agents (15 points)#
IT Support Agent:
Uses Tavily search for troubleshooting information
Returns practical guides from reliable sources
FAQ Agent:
Implements RAG for FPT policy questions
Returns answers with source references
Task 5: Primary Assistant & Routing (20 points)#
Define routing tools for Primary Assistant:
ToTicketAssistant,ToITAssistant,ToBookingAssistantInclude user context injection in tool calls
Implement entry nodes for agent transitions:
Create
create_entry_nodefactory functionPush new agent to dialog_state stack
Build complete graph with:
All agent nodes and their tool nodes
Conditional routing from Primary Assistant
Tool fallback handling for errors
Create tool_node_with_fallback for graceful error handling
Submission Requirements#
Required Deliverables#
Source code with all agents implemented
Database schema (SQLite or PostgreSQL)
README.mdwith setup and usage instructionsTest conversations demonstrating each agent flow
Submission Checklist#
All 4 specialized agents working correctly
Context injection auto-populates email when available
CompleteOrEscalate enables return to Primary Assistant
Tool schemas validate inputs properly
Dialog stack correctly tracks agent hierarchy
Code runs without errors
Evaluation Criteria#
Criteria |
Points |
|---|---|
State & context management |
20 |
Ticket Support Agent |
25 |
Booking Agent |
20 |
IT Support & FAQ Agents |
15 |
Primary Assistant & routing |
15 |
Code quality and documentation |
5 |
Total |
100 |
Hints#
Use
ToolNode(tools).with_fallbacks([...])for error handlingThe
dialog_statestack enables proper agent hierarchy trackingOptional email fields should use
Optional[EmailStr]in Pydantic schemasReference the LangGraph customer support tutorial for architecture patterns