Skip to main content

Multi-Agent Conversation Example

This example shows a conversation involving multiple specialized agents.

The Scenario

A customer inquiry is handled by a triage agent that routes to a specialized support agent.

JSON

{
  "conversations": [
    {
      "name": "Multi-Agent Support",
      "description": "Customer inquiry handled by multiple agents",
      "agents": [
        {
          "name": "Triage Agent",
          "description": "Initial contact agent that classifies and routes inquiries",
          "tools": {
            "classify_intent": {
              "name": "classify_intent",
              "description": "Classify the customer's intent",
              "parameters": {
                "message": "string"
              }
            },
            "route_to_specialist": {
              "name": "route_to_specialist",
              "description": "Route to a specialized agent",
              "parameters": {
                "specialist_type": "string"
              }
            }
          }
        },
        {
          "name": "Order Support Agent",
          "description": "Specialized agent for order-related inquiries",
          "tools": {
            "lookup_order": {
              "name": "lookup_order",
              "description": "Look up order details",
              "parameters": {
                "order_id": "string"
              }
            },
            "check_shipping": {
              "name": "check_shipping",
              "description": "Check shipping status",
              "parameters": {
                "order_id": "string"
              }
            }
          }
        },
        {
          "name": "Technical Support Agent",
          "description": "Specialized agent for technical issues",
          "tools": {
            "diagnose_issue": {
              "name": "diagnose_issue",
              "description": "Diagnose a technical issue",
              "parameters": {
                "symptoms": "string"
              }
            }
          }
        }
      ],
      "messages": [
        {
          "role": "user",
          "sequence_number": 0,
          "content": "I want to know where my package is"
        },
        {
          "role": "assistant",
          "sequence_number": 1,
          "content": "I'll help you track your package. Let me connect you with our order support specialist who can look up your shipping status.",
          "steps": [
            {
              "model_name": "gpt-4",
              "step_order": 0,
              "thinking": "Customer wants package tracking. Need to classify intent and route appropriately.",
              "tool_call": {
                "name": "classify_intent",
                "arguments": {
                  "message": "I want to know where my package is"
                }
              },
              "tool_result": {
                "intent": "order_tracking",
                "confidence": 0.95,
                "recommended_agent": "order_support"
              }
            },
            {
              "model_name": "gpt-4",
              "step_order": 1,
              "thinking": "High confidence order tracking intent. Routing to order support.",
              "tool_call": {
                "name": "route_to_specialist",
                "arguments": {
                  "specialist_type": "order_support"
                }
              },
              "tool_result": {
                "status": "routed",
                "agent": "Order Support Agent"
              }
            },
            {
              "model_name": "gpt-4",
              "step_order": 2,
              "output_content": "I'll help you track your package. Let me connect you with our order support specialist who can look up your shipping status."
            }
          ],
          "meta": {
            "agent": "Triage Agent"
          }
        },
        {
          "role": "assistant",
          "sequence_number": 2,
          "content": "Hi! I'm the order support specialist. I'd be happy to help you track your package. Could you please provide your order number?",
          "steps": [
            {
              "model_name": "gpt-4",
              "step_order": 0,
              "thinking": "I've been connected to help with package tracking. Need to get the order number first.",
              "output_content": "Hi! I'm the order support specialist. I'd be happy to help you track your package. Could you please provide your order number?"
            }
          ],
          "meta": {
            "agent": "Order Support Agent"
          }
        },
        {
          "role": "user",
          "sequence_number": 3,
          "content": "It's ORD-56789"
        },
        {
          "role": "assistant",
          "sequence_number": 4,
          "content": "I found your order ORD-56789. It was shipped on January 18th and is currently in transit. It's expected to arrive by January 25th. The package is currently at our distribution center in Chicago. Your tracking number is TRACK-12345.",
          "steps": [
            {
              "model_name": "gpt-4",
              "step_order": 0,
              "thinking": "Customer provided order ID. Let me look up the order details.",
              "tool_call": {
                "name": "lookup_order",
                "arguments": {
                  "order_id": "ORD-56789"
                }
              },
              "tool_result": {
                "order_id": "ORD-56789",
                "status": "shipped",
                "order_date": "2024-01-18",
                "tracking_number": "TRACK-12345"
              }
            },
            {
              "model_name": "gpt-4",
              "step_order": 1,
              "thinking": "Order is shipped. Let me get detailed shipping status.",
              "tool_call": {
                "name": "check_shipping",
                "arguments": {
                  "order_id": "ORD-56789"
                }
              },
              "tool_result": {
                "status": "in_transit",
                "estimated_delivery": "2024-01-25",
                "current_location": "Distribution Center, Chicago"
              }
            },
            {
              "model_name": "gpt-4",
              "step_order": 2,
              "thinking": "Have all the shipping details. Let me provide a comprehensive response.",
              "output_content": "I found your order ORD-56789. It was shipped on January 18th and is currently in transit. It's expected to arrive by January 25th. The package is currently at our distribution center in Chicago. Your tracking number is TRACK-12345."
            }
          ],
          "meta": {
            "agent": "Order Support Agent"
          }
        },
        {
          "role": "user",
          "sequence_number": 5,
          "content": "Perfect, thanks!"
        },
        {
          "role": "assistant",
          "sequence_number": 6,
          "content": "You're welcome! If you have any other questions about your order, feel free to ask. Have a great day!",
          "steps": [
            {
              "model_name": "gpt-4",
              "step_order": 0,
              "output_content": "You're welcome! If you have any other questions about your order, feel free to ask. Have a great day!"
            }
          ],
          "meta": {
            "agent": "Order Support Agent"
          }
        }
      ]
    }
  ]
}

Key Points

Multiple Agent Definitions

Three agents are defined, each with their own tools:
  • Triage Agent: Classifies and routes
  • Order Support Agent: Handles order inquiries
  • Technical Support Agent: Available but not used

Agent Tracking via Meta

The meta.agent field on each message tracks which agent responded:
"meta": {
  "agent": "Order Support Agent"
}

Agent Handoff

Message at sequence_number 1 shows the triage agent routing to order support:
  1. Classifies the intent
  2. Routes to specialist
  3. Provides transition message

What This Enables

Multi-agent conversations allow you to evaluate:
  • Routing Accuracy: Did triage route correctly?
  • Handoff Quality: Was the transition smooth?
  • Specialist Effectiveness: Did the specialist resolve the issue?
  • Agent Coordination: Did agents work together effectively?