Introduction
Multi-agent workflows let you build sophisticated AI systems where specialized agents collaborate to handle complex customer interactions. Instead of a single agent trying to be an expert at everything, you create a team of agents—each focused on a specific domain like support, billing, sales, or technical issues.
The A2A (Agent-to-Agent) protocol is the communication standard that makes this possible. Think of it as a universal language that allows your agents (and even external third-party agents) to delegate tasks, share context, and coordinate responses seamlessly.
Real-world examples:
- Support escalation: A general support bot detects a billing question and delegates to your specialized billing agent, which has access to invoicing context and payment policies
- Lead qualification pipeline: A lead capture agent scores incoming contacts, then delegates high-value leads to a nurturing agent that initiates personalized follow-up sequences
- Content moderation chain: An intake agent screens messages for policy violations, delegates flagged content to a moderation specialist, which then routes approved messages to your primary response agent
By the end of this guide, you'll have a working multi-agent workflow that routes customer requests to the right specialist automatically.
What You'll Need
- MoltFlow account with A2A protocol enabled (available on Business and Enterprise plans)
- At least 2 AI agents configured in your account (you can create these in the AI Config section of your dashboard)
- Understanding of agent cards and agent capabilities (we'll cover the basics here)
- Optional: OpenClaw API key if you want to use third-party agents
Important: Multi-agent workflows require careful planning. Start with a simple 2-agent chain before building complex multi-agent systems with 3+ specialists.
Step 1: Understand the A2A Protocol Basics
The A2A protocol defines how agents discover each other, negotiate capabilities, and exchange task requests. Here are the core concepts:
Agent Cards: Every agent publishes an "agent card" (similar to a business card) that describes its capabilities, supported skills, input/output formats, and endpoint URL. Other agents read these cards to understand what tasks can be delegated.
Task Requests: When Agent A wants Agent B to handle something, it sends a structured task request containing:
- Task type (e.g., "answer_billing_question", "score_lead", "moderate_content")
- Input data (e.g., the customer's message, conversation history, metadata)
- Expected output format
- Trust level (determines what data the receiving agent can access)
Task Responses: Agent B processes the request and returns a structured response with:
- Status (success, failure, or cannot_handle)
- Output data (the answer, score, decision)
- Confidence score (how certain the agent is about the result)
- Optional: Suggested next steps
Trust Levels: A2A includes built-in security. You assign trust levels to each agent (none/basic/standard/full), which controls what data it can access and what actions it can take.
Learn more: The full A2A specification is available at a2a-protocol.org. MoltFlow implements version 1.2 of the spec.
Step 2: Design Your Multi-Agent Workflow
Before configuring anything, map out your workflow on paper. Ask yourself:
- What's the entry point? (Usually a WhatsApp message received by your primary agent)
- What triggers delegation? (Specific keywords? Topics detected by AI? Customer tier?)
- Which specialist handles what? (Billing questions → Billing Agent, technical issues → Tech Support Agent)
- What happens after the specialist responds? (Does the intake agent relay the answer? Does the specialist respond directly?)
- What's the fallback? (If no specialist can handle it, escalate to human? Send a default message?)
Example workflow: Customer Support with Billing Escalation
1. Customer sends WhatsApp message → Intake Agent (primary support bot)
2. Intake Agent analyzes intent using AI
- If topic = "general support" → Handle directly
- If topic = "billing" → Delegate to Billing Agent
- If topic = "technical issue" → Delegate to Tech Support Agent
3. Billing Agent receives task request
- Queries billing database for customer's invoice history
- Generates response with account details
- Returns response to Intake Agent
4. Intake Agent receives response
- Formats it for WhatsApp
- Sends to customer
- Logs the interactionWhy this structure? The customer only sees the Intake Agent. They get consistent, branded responses. Behind the scenes, specialists handle domain-specific logic without exposing complexity.
Step 3: Configure the First Agent (Intake)
Your intake agent is the front-line agent that customers interact with. It needs to:
- Understand customer messages
- Detect when to delegate
- Format responses from specialists
Go to AI Config → Create New Agent (or edit your existing primary agent):
Agent Name: "Primary Support Agent"
System Prompt:
You are the primary customer support agent for [Your Company].
Your role:
- Analyze incoming customer messages
- Answer general questions directly
- Delegate to specialist agents when needed
Delegation rules:
- For billing questions (invoices, payments, refunds) → delegate to "billing_agent"
- For technical issues (bugs, setup, integrations) → delegate to "tech_support_agent"
- For all other questions → handle directly using your knowledge base
When delegating:
1. Extract the relevant context from the customer's message
2. Create a task request with type "answer_question" and include the original message
3. Wait for the specialist's response
4. Relay the response to the customer in a friendly, conversational tone
Never tell the customer that you're delegating. From their perspective, you're handling everything.Knowledge Base: Upload your general FAQs, company policies, product documentation. This agent should be able to answer 80% of questions without delegation.
Enabled Skills: Check "A2A Task Delegation" in the Skills section.
Save the agent.
Step 4: Configure the Second Agent (Specialist)
Now create your specialist agent. This agent won't interact directly with customers—it only receives task requests from other agents.
Go to AI Config → Create New Agent:
Agent Name: "Billing Specialist Agent"
System Prompt:
You are a billing specialist agent. You only receive task requests from other agents (you do not interact with customers directly).
Your expertise:
- Invoice details and payment status
- Refund policies and procedures
- Subscription management
- Payment method updates
When you receive a task request:
1. Read the customer's question from the task input
2. Query the billing database for relevant account information
3. Generate a clear, accurate answer with specific details (invoice numbers, amounts, dates)
4. Return the answer in the task response
Important:
- Always include invoice/transaction numbers when referencing billing records
- If the customer's account is not found, return status "cannot_handle" with reason "account_not_found"
- Never make up information—if you don't know, return a low confidence scoreKnowledge Base: Upload billing-specific documentation—refund policies, payment processor guides, subscription tier details.
Enabled Skills: Check "Database Query" (if you want this agent to look up customer records), "Billing API Access".
Important: Under "Agent Card Settings", set:
- Supported Task Types:
["answer_question", "lookup_invoice", "process_refund"] - Input Format:
{"message": "string", "customer_id": "string"} - Output Format:
{"answer": "string", "confidence": "number", "references": "array"}
Save the agent.
Step 5: Set Up Agent-to-Agent Task Delegation
Now connect the two agents. In MoltFlow, this is done through agent routing rules.
Go to AI Config → Agent Routing:
-
Create Routing Rule:
- Source Agent: Primary Support Agent
- Condition: Message contains billing keywords OR AI detects "billing" topic
- Target Agent: Billing Specialist Agent
- Task Type:
answer_question - Context to Pass: Original message + customer ID + conversation history (last 5 messages)
-
Configure Task Request Format:
{
"task_type": "answer_question",
"input": {
"message": "{{customer_message}}",
"customer_id": "{{customer_id}}",
"conversation_history": "{{last_5_messages}}"
},
"trust_level": "standard"
}- Configure Response Handling:
- On Success: Primary agent sends specialist's answer to customer
- On Failure: Primary agent sends fallback message: "I'm having trouble accessing billing information. Let me connect you with a team member."
- Timeout: 10 seconds (if specialist doesn't respond, trigger fallback)
Save the routing rule.
How it works: When the primary agent detects a billing question, it automatically creates a task request with the structure above and sends it to the Billing Specialist Agent's endpoint. The specialist processes it, returns a response, and the primary agent relays the answer to the customer—all in under 2 seconds.
Step 6: Handle Responses and Fallbacks
Not all task requests succeed. Your workflow needs to handle:
1. Specialist Can't Handle It: The specialist returns status: "cannot_handle" with a reason. Configure the primary agent to either:
- Try another specialist (if you have multiple billing agents)
- Escalate to human support
- Send a generic fallback message
Example fallback configuration:
if (response.status === "cannot_handle") {
if (response.reason === "account_not_found") {
return "I couldn't find your account in our system. Can you provide your email address or phone number associated with your account?"
} else {
// Generic fallback
return "I'll connect you with a team member who can help with this. One moment..."
escalateToHuman(customerId)
}
}2. Timeout: The specialist doesn't respond within the timeout window (default: 10 seconds). This usually means the agent is overloaded or down. The primary agent should fall back to a safe default:
"I'm experiencing a technical issue. Let me escalate your request to a team member who can assist you directly."3. Low Confidence: The specialist returns a response but with confidence < 0.6. You can configure the primary agent to:
- Send the answer but add a disclaimer: "Here's what I found, though I recommend confirming with our team: [answer]"
- Skip the answer and escalate to human
- Ask clarifying questions before delegating again
Configure these fallbacks in AI Config → Agent Routing → [Your Rule] → Fallback Behavior.
Step 7: Test the Complete Workflow
Time to test end-to-end. Send test messages that should trigger delegation:
Test Case 1: Billing Question
- Send: "What's the status of my last invoice?"
- Expected: Primary agent detects billing topic → delegates to Billing Agent → Billing Agent looks up invoice → returns answer → Primary agent sends answer to customer
- Verify in logs: Go to AI Config → Logs, filter by "Task Delegation". You should see a
task_requestentry with target "Billing Specialist Agent" and atask_responseentry with the answer.
Test Case 2: General Question
- Send: "What are your business hours?"
- Expected: Primary agent answers directly from knowledge base (no delegation)
- Verify: Check logs—no task_request entries for this message
Test Case 3: Specialist Can't Handle
- Send: "Can I get a refund for someone else's account?" (this should fail because the specialist can't access another user's account)
- Expected: Specialist returns
cannot_handle→ Primary agent sends fallback message - Verify: Check logs for
cannot_handlestatus in task_response
Test Case 4: Timeout
- Simulate: Temporarily disable the Billing Agent (go to AI Config → [Billing Agent] → Status: Inactive)
- Send: "What's my invoice status?"
- Expected: Primary agent waits 10 seconds → timeout → fallback message
- Verify: Re-enable the agent after testing
Debugging tips: If delegation isn't working:
- Check that both agents have "A2A Task Delegation" skill enabled
- Verify the routing rule condition (test the keyword/topic detection)
- Check trust levels (if trust is too low, the specialist might reject the request)
- Review agent logs for error messages
Advanced Patterns
Once your basic 2-agent workflow is running, you can expand to more complex patterns:
1. Three-Agent Chains:
- Customer → Intake Agent → Specialist Agent → Approval Agent → Response to customer
- Example: Refund requests that require manager approval
2. Parallel Agent Queries:
- Intake agent delegates the same question to multiple specialists simultaneously
- Waits for all responses
- Chooses the answer with the highest confidence score
- Useful when you have overlapping expertise or want redundancy
3. Conditional Routing Based on Confidence:
- Intake agent attempts to answer directly
- If confidence < 0.7, delegate to specialist
- If specialist confidence < 0.7, escalate to human
- Creates a progressive escalation path
4. External Agent Integration:
- Connect third-party agents via A2A agent discovery (see "How to Connect External AI Agents to MoltFlow via Agent Discovery" guide)
- Example: Use an industry-specific agent from an AI marketplace for specialized questions
5. Agent Learning from Specialist Responses:
- Log all specialist responses
- Periodically add high-confidence Q&A pairs to the intake agent's knowledge base
- Over time, the intake agent learns to handle more questions without delegation
What's Next
You've built a multi-agent workflow with specialist delegation. Here are recommended next steps:
- Secure your agents: Read How to Create an A2A Content Policy for Safe Agent Communication to add content filtering and trust rules
- Connect external agents: See How to Connect External AI Agents to MoltFlow via Agent Discovery to integrate third-party specialists
- Build an AI support bot: Combine multi-agent workflows with auto-reply rules in How to Build a WhatsApp Support Bot with OpenClaw
- Monitor performance: Track agent response times, delegation rates, and confidence scores in your dashboard
Multi-agent workflows unlock sophisticated automation that feels natural to your customers while keeping your backend organized and maintainable. Start simple, test thoroughly, and expand gradually.