Praison AI
Enterprise
Agents
Bot
Use Cases
University
Docs
Handling step failures, fallbacks, and timeouts
Run
from praisonai import Agent, AgentFlow, route def check_inventory_service(ctx): return 'fallback' if 'OUTAGE' in ctx.input else 'ok' live = Agent(name='LiveInventory', instructions='Confirm the item is in stock in one short sentence.', output='silent') fallback = Agent(name='FallbackResponder', instructions='Say live inventory is temporarily unavailable and offer email follow-up in one sentence.', output='silent') flow = AgentFlow(steps=[check_inventory_service, route({'ok': [live], 'default': [fallback]})]) print('Healthy :', flow.start('Check SKU-100')['output']) print('Fallback:', flow.start('Check SKU-OUTAGE')['output'])
Press Run. The result appears here.
Esc
Search in
All
Docs
University