Welcome to the architectural guide for building advanced multi-agent systems. This guide moves beyond single-agent setups to explore powerful patterns for orchestrating teams of AI agents. By delegating tasks to specialized agents, you can build more robust, scalable, and maintainable AI applications.We will explore three distinct architectural patterns using ResponseCX agents (patterns compatible with the OpenAI Agents API):
General Triage Model: A central agent routes diverse tasks to the correct specialist.
Hierarchical Customer Support: A tiered system for handling customer service with clear escalation paths.
Collaborative Operations Team: An internal-facing system where agents act as a team of department heads to run a business.
This is a fundamental pattern where a primary Triage Agent acts as a smart router. It assesses incoming requests and delegates them to a specialist agent with the appropriate tools and expertise.
Ideal for applications that handle a wide variety of tasks, such as a general-purpose assistant that needs to access a knowledge base, manage user-specific memory, or perform business operations.
The TriageAgent is configured with handoffs to the specialist agents. Each specialist has a narrow set of tools and instructions, making them experts at their specific function.
// Define Specialist Agentsconst knowledgeAgent = new Agent({ name: 'Knowledge Base Agent', handoffDescription: 'For questions about our products, services, or policies.', tools: [vectorSearchTool], // ...instructions});const memoryAgent = new Agent({ name: 'Memory Agent', handoffDescription: 'To remember or recall user-specific information.', tools: [memoryTool], // ...instructions});// Define the Triage Agentconst triageAgent = Agent.create({ name: 'Response AI Triage Agent', instructions: 'You are a master router. Your job is to delegate tasks to the correct specialist agent.', handoffs: [knowledgeAgent, memoryAgent /*, ...other specialists */],});// Enable handoffs back to the triage agentknowledgeAgent.handoffs = [triageAgent];memoryAgent.handoffs = [triageAgent];
This pattern builds on the triage model to create a more structured, customer-facing support system. It defines clear roles for different levels of support and includes a dedicated escalation path for complex or sensitive issues.
Perfect for building a scalable, AI-powered customer service department that can handle a high volume of requests while providing expert-level support and a great customer experience for difficult cases.
The key here is the SeniorSupportSpecialist, which has access to a broader set of tools and is given instructions that explicitly grant it authority to override policies or offer compensation.
// Tier 1 Specialistconst orderSupportAgent = new Agent({ name: 'Order Support Specialist', handoffDescription: 'Handles order tracking, modifications, and cancellations.', tools: [orderLookupTool, updateOrderTool], // ...instructions});// Tier 2 Escalation Agentconst escalationAgent = new Agent({ name: 'Senior Support Specialist', handoffDescription: 'For complex issues, policy exceptions, and VIP customer care.', instructions: `You are a Senior Support Specialist with authority to make exceptions and offer compensation. ## Your Enhanced Authority: - Offer discounts or store credit. - Override standard return policies when justified. - Handle complaints with full resolution power.`, tools: [orderLookupTool, updateOrderTool, createReturnTool, createTicketTool], // Has more tools});// Triage Agent with an escalation pathconst triageAgent = Agent.create({ name: 'Customer Service Triage', instructions: `Your job is to route customers to the correct specialist. If the customer is angry or the issue is complex, route to the Senior Support Specialist.`, handoffs: [orderSupportAgent, returnsAgent, faqAgent, escalationAgent],});// Allow Tier 1 agents to escalateorderSupportAgent.handoffs = [triageAgent, escalationAgent];returnsAgent.handoffs = [triageAgent, escalationAgent];
This architecture is designed for internal use, acting as an “agentic operating system” for a business. A Master Orchestrator agent acts as a CEO or project manager, delegating high-level goals to a team of agents representing different departments. These specialists can collaborate and hand off tasks to each other.
An internal tool for business leaders to analyze performance, generate strategies, and optimize operations by interacting with a team of AI department heads.
The main difference is the handoff configuration. Here, specialists can hand off tasks directly to each other, enabling true collaboration to solve multi-faceted problems.
// Define department-specialized agentsconst marketingAgent = new Agent({ name: 'Marketing Specialist', instructions: 'You are an expert in marketing campaigns, analytics, and strategy.', tools: [generateMarketingStrategyTool, campaignManagementTool],});const salesAgent = new Agent({ name: 'Sales Manager', instructions: 'You are an expert in sales performance, forecasting, and pricing.', tools: [salesAnalysisTool],});const operationsAgent = new Agent({ name: 'Operations Director', instructions: 'You are an expert in inventory, fulfillment, and supply chain.', tools: [inventoryAnalysisTool],});// The Orchestrator delegates to any specialistconst orchestratorAgent = Agent.create({ name: 'Master Orchestrator', instructions: 'You are the orchestrator for the business. Delegate tasks to the appropriate department head.', handoffs: [marketingAgent, salesAgent, operationsAgent],});// Configure peer-to-peer handoffs for collaborationmarketingAgent.handoffs = [orchestratorAgent, salesAgent, operationsAgent];salesAgent.handoffs = [orchestratorAgent, marketingAgent, operationsAgent];operationsAgent.handoffs = [orchestratorAgent, marketingAgent, salesAgent];
Multi-agent systems represent the future of AI-powered business operations. By implementing these patterns and best practices, you can build robust, scalable, and intelligent systems that dramatically improve efficiency and customer satisfaction.