Prompt Details
Model
Chat - (gpt-5.6)
Token size
2,262
Example input
[What the multi-agent system must accomplish]: Customer requests cancellation of order #ORD-78452 and a full refund.
[Current manual or automated workflow]: Customer Request → Customer Support Checks Order → Operations Checks Shipment Status → Finance Calculates Refund → Risk Team Checks Fraud/Abuse → Manager Approves Exceptional Cases → Support Sends Final Response
[Tasks that must be completed]: Identify the order Verify customer ownership Check payment status Check fulfillment/shipping status Determine cancellation eligibility Calculate refund Check refund-risk conditions Resolve conflicting decisions Obtain approval for exceptional cases Execute refund Notify customer Record audit trail
[Cost / latency / security / accuracy / human approval]: Refund API must not be accessible to every agent. Refunds above $500 require human approval. Sensitive payment information must not be passed between unnecessary agents. Workflow should avoid duplicate API calls. Maximum automated retry count: 2. Final refund decision must be policy-compliant.
[Final output / format / quality criteria]: Order ID Cancellation Decision Refund Amount Reason Risk Status Approval Status Refund Status Customer Message Audit Reference
Example output
🔎 PHASE 1 — OBJECTIVE ANALYSIS
Confirmed
Customer wants cancellation.
Order ID is available.
Refund eligibility must be determined.
Shipping status affects cancellation eligibility.
Risk must be evaluated.
High-value refunds require human approval.
Refund execution must be controlled.
Assumed
Customer is authenticated.
Order #ORD-78452 exists.
Policy database is available.
Shipping and payment APIs are operational.
Unknown
Whether the order has shipped.
Whether payment has settled.
Original order amount.
Customer's cancellation reason.
Whether the account has previous refund-abuse indicators.
---
🧩 PHASE 2 — TASK DECOMPOSITION
Task Purpose Dependency Parallel?
Verify Order Confirm order/customer relationship Customer request Yes
Check Payment Determine paid/authorized state Order ID Yes
Check Shipment Determine fulfillment state Order ID Yes
Check Policy Determine cancellation rules Order type/status Yes
Calculate Refund Determine refundable amount Payment + policy No
Risk Assessment Identify suspicious patterns Order + account Yes
Arbitration Resolve inconsistent decisions Previous outputs No
Approval Authorize high-impact action Refund decision Conditional
Execute Refund Process refund Approval/eligibility No
Notify Customer Communicate outcome Final result No
Audit Record workflow All critical stages Parallel/continuous
Parallel opportunity
These can execute simultaneously:
┌→ Payment Check
│
Customer → Order Verification ─→ Shipment Check
│
├→ Policy Check
│
└→ Risk Assessment
This reduces latency compared with checking everything sequentially.
---
🤖 PHASE 3 — AGENT ROLE DESIGN
Agent 1: Workflow Orchestrator
Role: Workflow controller
Responsibilities:
Start workflow
Assign tasks
Track dependencies
Enforce retry limits
Trigger quality gates
Route failures
Prevent infinite loops
Decision Authority:
Workflow routing only
Cannot independently approve refunds
---
Agent 2: Order Verification Agent
Responsibilities:
Validate order ID
Verify customer ownership
Retrieve order metadata
Tools:
Order database
Customer database
Output:
Order: ORD-78452
Customer Verified: YES
Order Found: YES
Order Status: Processing
Order Amount: $420
---
Agent 3: Fulfillment Agent
Responsibilities:
Check warehouse status
Check shipping status
Determine whether cancellation is operationally possible
Tools:
Shipping API
Fulfillment database
Output:
Shipment Status: NOT_SHIPPED
Cancellation Operationally Possible: YES
---
Agent 4: Refund Agent
Responsibilities:
Calculate eligible refund
Verify payment state
Prepare refund transaction
Important:
This agent can prepare a refund but cannot execute high-value refunds without authorization.
---
Agent 5: Risk Agent
Responsibilities:
Check refund frequency
Identify suspicious account patterns
Flag unusual activity
Output:
Risk Level: LOW
Risk Flags: NONE
It should not make the final cancellation decision.
---
Agent 6: Policy Arbitration Agent
Responsibilities:
Compare policy requirements
Analyze agent outputs
Resolve disagreements
Determine whether the workflow can proceed
Authority:
Policy interpretation and arbitration, not payment execution.
---
Agent 7: Customer Communication Agent
Responsibilities:
Generate customer-facing response
Explain decision
Avoid exposing internal fraud/risk information
Communicate refund status
---
🔗 PHASE 4 — DEPENDENCY MAP
Customer Request
↓
Order Verification
↓
┌─────┼──────────┬────────────┐
↓ ↓ ↓ ↓
Payment Shipment Policy Risk
Check Check Check Check
└─────┬──────────┴────────────┘
↓
Refund Calculation
↓
Quality Gate #1
↓
Policy Arbitration
↓
Quality Gate #2
↓
Refund Approval?
↙ ↘
YES NO
↓ ↓
Execute Human Review
Refund ↓
└──────┬─────┘
↓
Quality Gate #3
↓
Customer Notification
↓
Audit Completion
---
⚡ PHASE 5 — WORKFLOW ORCHESTRATION
Stage 1: Intake
Trigger: Customer cancellation request.
Orchestrator:
Validate required input.
Create workflow ID.
Lock workflow to prevent duplicate execution.
---
Stage 2: Parallel Verification
Run simultaneously:
Order Verification
Payment Check
Shipment Check
Policy Check
Risk Assessment
Condition
All critical checks must return valid results.
If one fails:
Retry → Retry #2 → Fallback/Escalation
---
Stage 3: Refund Calculation
Refund Agent receives only required information:
Order ID
Payment Status
Order Amount
Cancellation Eligibility
Applicable Policy
It does not receive unnecessary sensitive account information.
---
Stage 4: Quality Gate
Check:
Order verified?
Customer verified?
Payment confirmed?
Shipment status known?
Policy satisfied?
Refund amount mathematically correct?
Risk assessment complete?
If all pass:
PROCEED
Otherwise:
REJECT / REVISE / ESCALATE
---
📡 PHASE 6 — COMMUNICATION & HANDOFF
Every agent returns a structured message.
Example
Agent: Fulfillment Agent
Task: Determine cancellation feasibility
Context:
Order ORD-78452
Input:
Order ID
Output:
Shipment Status = NOT_SHIPPED
Cancellation Possible = YES
Evidence:
Shipping API response
Fulfillment database record
Status:
COMPLETED
Next Action:
Send result to Refund Agent and Arbitration Agent
Agents should not repeatedly forward the entire conversation.
Only relevant structured outputs should be transferred.
---
🧪 PHASE 7 — VALIDATION & QUALITY GATES
Quality Gate 1: Data Integrity
Check:
Order exists = TRUE
Customer verified = TRUE
Payment status known = TRUE
Shipment status known = TRUE
Failure:
Retry failed agent
---
Quality Gate 2: Refund Decision
Check:
Cancellation allowed
+
Payment refundable
+
Refund calculation correct
+
Risk acceptable
Failure:
Route to Policy Arbitration
---
Quality Gate 3: Before Refund Execution
Check:
Refund amount matches approved amount
Order has not changed status
No duplicate refund exists
Required approval exists
Only then:
EXECUTE REFUND
---
🚨 PHASE 8 — FAILURE HANDLING
Failure Detection Recovery Final Action
Agent failure No response/invalid response Retry Escalate after 2 retries
Payment API failure API error Retry Manual review
Shipping API timeout Timeout Retry Hold decision
Missing data Required field absent Request/retrieve data Escalate
Invalid refund amount Validation failure Recalculate Block refund
Conflicting agents Inconsistent outputs Arbitration Policy decision
Duplicate refund Transaction check Block transaction Investigate
Repeated failure Retry limit exceeded Stop automation Human escalation
---
⚔️ PHASE 9 — AGENT CONFLICT HANDLING
Example conflict
Fulfillment Agent:
Order has NOT shipped.
Cancellation possible.
Risk Agent:
Order should be blocked due to unusual refund behavior.
The system must not simply choose the agent with higher confidence.
Instead:
Evidence
↓
Agent Role
↓
Policy
↓
Authority
↓
Risk Severity
↓
Arbitration
Resolution
If policy allows cancellation but risk indicates potential abuse:
Cancellation Eligibility = YES
Risk = HIGH
The system may allow cancellation while requiring additional review before refund execution.
This separates:
Customer entitlement from fraud-risk control.
---
👤 PHASE 10 — HUMAN-IN-THE-LOOP
Human approval is required when:
Refund > $500
OR
High-risk fraud signal
OR
Policy conflict
OR
Critical system uncertainty
OR
Repeated workflow failure
Example
Refund amount:
$720
Workflow pauses:
AUTOMATION PAUSED
Reason:
Refund exceeds approval threshold.
Required Context:
Order status
Payment status
Refund calculation
Policy result
Risk summary
Evidence
Approver:
Authorized Operations Manager
Human approves
APPROVED
Workflow resumes at the refund execution gate.
Human rejects
REJECTED
Refund execution is permanently blocked.
---
🛡️ PHASE 11 — SECURITY BOUNDARIES
Agent Database Payment API Refund API External Action
Orchestrator Metadata only No No No
Order Agent Read No No No
Fulfillment Agent Read No No No
Refund Agent Limited read Read Prepare No
Risk Agent Limited account data No No No
Arbitration Agent Required evidence only No No No
Communication Agent Final approved data No No Notification only
Principle
Every agent gets only what it needs.
---
📊 PHASE 12 — EFFICIENCY ANALYSIS
Naive design
Agent A
↓
Agent B
↓
Agent C
↓
Agent D
↓
Agent E
This creates unnecessary latency.
Optimized design
┌→ Payment
├→ Shipment
Order ─────┼→ Policy
└→ Risk
↓
Refund Calculation
↓
Arbitration
↓
Approval Gate
↓
Refund Execution
Optimization techniques
Parallelize independent checks.
Cache order metadata.
Avoid repeated policy lookups.
Pass structured outputs instead of full context.
Limit retries to 2.
Use deterministic validation for monetary calculations.
Prevent duplicate refund execution with idempotency keys.
Use humans only for high-impact exceptions.
---
📈 PHASE 13 — WORKFLOW OBSERVABILITY
Track:
Workflow ID
Order ID
Agent ID
Task ID
Start Time
End Time
Latency
Tool Calls
API Failures
Retries
Validation Failures
Agent Conflicts
Human Approvals
Refund Amount
Final Outcome
Important checkpoints
CHECKPOINT 1
Order Verified
CHECKPOINT 2
Eligibility Determined
CHECKPOINT 3
Refund Validated
CHECKPOINT 4
Approval Completed
CHECKPOINT 5
Refund Executed
CHECKPOINT 6
Customer Notified
This makes debugging and auditing much easier.
---
🧪 PHASE 14 — WORKFLOW TEST PLAN
Test 1: Normal Execution
Input:
Order = ORD-78452
Amount = $420
Shipment = Not Shipped
Payment = Settled
Risk = Low
Expected:
Cancellation = Approved
Refund = $420
Human Approval = Not Required
Refund = Executed
Customer = Notified
Pass Criteria:
All validation gates pass and exactly one refund transaction occurs.
---
Test 2: Missing Shipping Data
Input:
Shipping API = Timeout
Expected:
Retry
→ Retry
→ Still Failed
→ Workflow Paused
→ Human Escalation
Pass Criteria:
No refund is executed without verified shipping status.
---
Test 3: Conflicting Agents
Input:
Fulfillment = Cancellation Allowed
Risk = High Risk
Policy = Refund Requires Review
Expected:
Policy Arbitration
→ Human Review
→ Decision
Pass Criteria:
System does not automatically execute the refund based only on one agent's confidence.
---
Test 4: High-Value Refund
Input:
Refund = $850
Expected:
Eligibility Check
→ Refund Calculation
→ Human Approval
→ Refund Execution
Pass Criteria:
Refund API cannot execute before approval.
---
Test 5: Duplicate Request
Input:
Customer submits the same cancellation request twice.
Expected:
Same Order
+
Existing Workflow
↓
Detect Duplicate
↓
Reuse Existing Decision
Pass Criteria:
Customer receives one refund, not two.
---
Test 6: Human Rejection
Input:
Refund = $900
Human Decision = REJECT
Expected:
Workflow STOPPED
Refund NOT Executed
Customer Notified
Audit Recorded
---
🛠️ PHASE 15 — IMPLEMENTATION BLUEPRINT
Agent Architecture
ORCHESTRATOR
|
┌──────────────┼──────────────┐
↓ ↓ ↓
ORDER FULFILLMENT RISK
AGENT AGENT AGENT
\ | /
\ | /
└─────── POLICY ──────────┘
ARBITRATION
↓
REFUND AGENT
↓
APPROVAL GATE
↓
REFUND API
↓
COMMUNICATION AGENT
---
📦 DATA FLOW
Customer Request
↓
Workflow ID
↓
Order Metadata
↓
Parallel Verification
↓
Eligibility Result
↓
Refund Calculation
↓
Policy Validation
↓
Risk Decision
↓
Approval
↓
Refund Transaction
↓
Customer Notification
↓
Audit Record
---
🚀 MVP
Build only:
Workflow Orchestrator
Order Verification Agent
Fulfillment Agent
Refund Agent
Policy Validation
Human Approval Gate
Customer Communication
Audit Logging
Avoid adding unnecessary specialized agents initially.
---
🔄 PHASE 2
Add:
Dedicated Risk Agent
Advanced conflict arbitration
Automatic anomaly detection
Better retry/fallback strategies
Workflow analytics
Refund-abuse pattern detection
---
🧠 FUTURE OPTIMIZATION
Potential improvements:
Historical Decision Cache
+
Policy Versioning
+
Adaptive Routing
+
Cost-Aware Model Selection
+
Predictive Failure Detection
+
Automated Workflow Optimization
---
🧾 PHASE 16 — FINAL MULTI-AGENT WORKFLOW BLUEPRINT
1. Executive Summary
A hybrid multi-agent architecture is optimal.
Independent verification tasks run in parallel, while refund calculation, arbitration, approval, and execution remain sequential because each depends on validated upstream information.
The design minimizes agent count while maintaining strong reliability and financial controls.
---
2. Core Workflow
CUSTOMER REQUEST
↓
ORCHESTRATOR
↓
PARALLEL CHECKS
┌────┼────┬────┐
↓ ↓ ↓ ↓
Order Payment Shipping Risk
└────┼────┴────┘
↓
Policy Validation
↓
Refund Calculation
↓
QUALITY GATE
↓
ARBITRATION
↓
APPROVAL?
↙ ↘
YES NO/REVIEW
↓ ↓
Execute HUMAN
Refund REVIEW
↓ ↓
└───────┬─────┘
↓
FINAL VALIDATION
↓
CUSTOMER NOTIFICATION
↓
AUDIT
---
3. Key Design Principle
The system should not be designed as:
More Agents = Better Workflow
Instead:
Minimum Necessary Agents
+
Clear Ownership
+
Parallel Execution
+
Strict Quality Gates
+
Least Privilege
+
Controlled Escalation
=
Reliable Multi-Agent Workflow
🎯 Expected Final Result
For a normal $420 cancellation:
Decision: APPROVED
Refund: $420
Risk: LOW
Human Approval: NOT REQUIRED
Refund Status: EXECUTED
Customer Notification: SENT
Audit: COMPLETE
For an $850 or high-risk cancellation:
Decision: ELIGIBLE / REVIEW REQUIRED
Refund: $850
Risk: HIGH or HIGH-VALUE
Human Approval: REQUIRED
Refund Status: BLOCKED UNTIL APPROVAL
Audit: COMPLETE
This test demonstrates the complete pipeline:
OBJECTIVE → TASKS → AGENTS → DEPENDENCIES → PARALLELIZATION → ORCHESTRATION → HANDOFFS → VALIDATION → FAILURE HANDLING → CONFLICT RESOLUTION → HUMAN APPROVAL → SECURITY → OPTIMIZATION → IMPLEMENTATION.
By purchasing this prompt, you agree to our terms of service
GPT-5.6
This prompt designs an optimized multi-agent workflow by breaking down objectives, assigning specialized agents, defining communication and handoffs, and creating reliable execution and failure-handling logic.
🤖 Design specialized agent roles
🧩 Break complex work into agent tasks
🔗 Map dependencies & handoffs
🔄 Design sequential & parallel workflows
📡 Define agent communication protocols
🚨 Add failure & escalation handling
🚀 Turn complex tasks into a coordinated multi-agent workflow.
...more
Added over 1 month ago
