AI agents collaborate in a multi-agent system to provide effective and personalized insurance support.
The code for the example can be found here.
Users interact with the system through a WebSocket-enabled chat interface.
Agents collaborate with clear defined roles, objectives and skills.
Role: Serve the frontend and bridge WebSocket communication between web frontend and human communication channel.
Objective: Enable seamless interactions between users and agents through a WebSocket-enabled chat interface.
Skill: Frontend service delivery, Real-time communication, session management, message handling, and agent communication bridge.
Role: Classify incoming messages and route them to the appropriate agent based on content.
Objective: Ensure that user inquiries are efficiently assigned to the right agent.
Skill: Content classification and routing.
Role: Handle policy-related inquiries using a mock policies_database.
Objective: Provide accurate and detailed information about user policies.
Skill: Policy management expertise.
Role: Assist customers with billing-related inquiries such as due amounts, billing cycles, and payment statuses.
Objective: Resolve billing-related questions efficiently and provide updates to billing records as needed.
Skill: Billing expertise and data management.
Role: Manage support ticket creation and retrieval for escalated issues that other agents cannot resolve.
Objective: Ensure unresolved issues are properly documented and assigned to the correct human support teams.
Skill: Escalation management and ticket tracking.
sequenceDiagram
participant User
participant FrontendAgent
participant HumanChannel
participant TriageAgent
participant AgentsChannel
participant PoliciesAgent
User->>FrontendAgent: Send greeting (e.g., "hi")
FrontendAgent->>HumanChannel: Forward user input
HumanChannel->>TriageAgent: Forward to TriageAgent
TriageAgent-->>HumanChannel: Respond with initial greeting (e.g., "Hello! How can I assist?")
HumanChannel-->>FrontendAgent: Send response
FrontendAgent-->>User: Display response
User->>FrontendAgent: Ask for help with insurance (e.g., "I want to know what's included in my policy")
FrontendAgent->>HumanChannel: Forward user input
HumanChannel->>TriageAgent: Forward to TriageAgent
TriageAgent->>AgentsChannel: Forward to PoliciesAgent
AgentsChannel->>PoliciesAgent: Forward to PoliciesAgent
PoliciesAgent-->>HumanChannel: Ask for clarification (e.g., "Can you provide your policy number?")
HumanChannel-->>FrontendAgent: Send response
FrontendAgent-->>User: Display response
User->>FrontendAgent: Provide policy number (e.g., A12345)
FrontendAgent->>HumanChannel: Forward user input
HumanChannel->>TriageAgent: Forward to TriageAgent
TriageAgent->>AgentsChannel: Forward to PoliciesAgent
AgentsChannel->>PoliciesAgent: Forward to PoliciesAgent
PoliciesAgent-->>HumanChannel: Return policy details (e.g., "Your insurance with the policy number A12345 includes...")
HumanChannel-->>FrontendAgent: Send response
FrontendAgent-->>User: Display response
Ensure you have the following dependencies installed:
- Python 3.12
- Docker and Docker Compose
Ensure you have a valid OpenAI API key set in your environment:
export OPEN_AI_API_KEY="your-api-key"
export GUARDRAILS_TOKEN="your-guardrails-ai-token" # OptionalClone the EggAI repository:
git clone git@github.com:eggai-tech/EggAI.gitMove into the examples/multi_agent_human_chat folder:
cd examples/multi_agent_human_chatCreate and activate a virtual environment and install required dependencies:
make setupConfigure Guardrails (Optional):
guardrails configure --token $GUARDRAILS_TOKEN
guardrails hub install hub://guardrails/toxic_languageStart Redpanda using Docker Compose:
make docker-upmake start-allUpon running the example and accessing the chat interface at http://localhost:8000, you should see a web-based chat UI.
You can execute tests to validate the behavior of different agents using evluation methods like LLM-as-a-Judge.
To run all tests:
make testRunning Specific Agent Tests:
make test-billing # Runs tests for the Billing Agent
make test-escalation # Runs tests for the Escalation Agent
make test-frontend # Runs tests for the Frontend Agent
make test-policies # Runs tests for the Policies Agent
make test-triage # Runs tests for the Triage AgentYou can optimize agents using DSPy evaluation and optimization techniques. You can find an optimization setup here.
When running the tests for the Triage Agent, a DSPy performance report will be generated in the agents/triage/dspy_modules/evaluation/reports folder (example report).
Stop and remove Docker containers and delete venv:
make docker-down
make clean- Extend Functionality: Add new agents or tools to handle more complex workflows.
- Connect Real Data: Integrate the system with external databases or APIs.
- Enhance UI: Improve the chat interface with features like authentication and message history.
- Learn More: Explore other examples in the
examplesfolder for advanced patterns. - Contribute: Share feedback or improvements with the EggAI community.
