Mini-project: Support triage and escalation pipeline
Combine state, route, parallel analysis, and conditional escalation
Put every AgentFlow primitive together in one production-grade pipeline: normalize & tag state -> route to Billing or Tech -> run parallel sentiment + policy checks -> trigger when('URGENT', [escalator]) only when needed.
Example
from praisonai import Agent, AgentFlow, route, parallel, when
def triage_label(ctx):
return 'billing' if 'invoice' in ctx.input.lower() else 'tech'
billing = Agent(name='Billing', instructions='Start reply with URGENT: and confirm duplicate invoice review in one short sentence.', output='silent')
tech = Agent(name='Tech', instructions='Give one troubleshooting step.', output='silent')
tone = Agent(name='ToneCheck', instructions='Reply with Tone OK in 2 words.', output='silent')
sla = Agent(name='SLACheck', instructions='Reply with URGENT SLA: 15m.', output='silent')
escalator = Agent(name='OnCall', instructions='Confirm Billing On-Call paged in one short line.', output='silent')
pipeline = AgentFlow(steps=[
triage_label,
route({'billing': [billing], 'default': [tech]}),
parallel([tone, sla]),
when('URGENT', [escalator]),
])
print('Pipeline result:', pipeline.start('Urgent duplicate charge on invoice #55')['output'])Example explained
- route -> parallel -> when — Combines conditional specialist routing, concurrent QA checks, and urgent escalation in one readable graph.
- when('URGENT', [escalator]) — Runs escalation strictly when prior output carries the URGENT marker.
Next course: RAG
Now that you can orchestrate complex multi-agent graphs, open RAG next to ground your agents in searchable knowledge bases and vector stores.
Reference: documentation