How qtalen/multi-agent-customer-service works
Project type and purpose
• This is a Python-based multi-agent orchestration demo built on Chainlit (a chat interface) and LlamaIndex Workflow.
• It shows how to implement an “agent handoff” or “swarm” style chat where multiple AI agents collaborate, as described in the two linked articles.
File structure
• Top-level:
• data/ : static resources (skus, terms).
• requirements.txt : Python dependencies (chainlit, llamaindex, openai, etc.).
• src/ and src_v2/ : two versions of the same app with slight internal structure differences.
• src/ directory:
• app.py : Chainlit entry point (presentation layer).
• workflow_startup.py : bootstraps the LlamaIndex workflow.
• workflow.py : defines the orchestration logic.
• agents.py : agent definitions, roles, prompts.
• models.py : LLM wrappers or model configuration.
• utils.py : helper functions (data loaders, text processing).
• src_v2/ directory:
• a refactored or alternate version (my_agent.py instead of models.py/utils.py).
README insights
• Usage is via chainlit run src/app.py or src_v2/app.py.
• Dependencies and purpose are clearly documented: a multi-agent orchestration example for LlamaIndex Workflow.
Main components and their relationships
a. Presentation Layer
• Chainlit UI (app.py) – accepts user input, displays messages, handles user sessions.
b. Orchestration Layer
• Workflow Startup (workflow_startup.py) – initializes LlamaIndex Workflow, registers agents.
• Workflow Engine (workflow.py) – directs which agent runs on each turn, handles handoff logic.
c. Agent Layer
• Agent Definitions (agents.py / my_agent.py) – each agent’s prompt templates, roles, capabilities.
d. Model Layer
• Model Wrappers (models.py) – functions to call the underlying LLM (OpenAI, etc.).
e. Utility / Data Layer
• Utils (utils.py) – loads static data (data/skus_en.txt, data/terms_en.txt), formatting.
f. External Services
• LLM provider (OpenAI API).
• LlamaIndex Workflow library.
Architectural patterns & design principles
• Layered design: UI → orchestrator → agents → LLM.
• Separation of concerns: data loading, prompt definitions, orchestration, and presentation are decoupled.
Detail
• Every Python module as a node.
• Distinguish startup (workflow_startup.py) from runtime orchestration (workflow.py).
• Data files feeding into utils.py, and the two entry points (src/app.py vs. src_v2/app.py).