Demonstrates order processing with:
- Structured output from LLM agent (action, action_details, action_requested)
- Conditional fraud review for orders > $1000
- Human-in-the-loop suspend/resume
Amount <= $1000:
- Agent charges customer via Stripe
- Agent immediately sends confirmation email
- Done
Amount > $1000:
- Agent charges customer via Stripe
- Agent returns
action_requested: "fraud_review" - Workflow suspends for human review
- If approved: Agent sends confirmation email
- If rejected: Order cancelled
# Terminal 1: Start worker
python worker.py
# Terminal 2: Run workflow
python main.py
# Enter amount: 500 (no fraud review) or 1500 (fraud review)When a workflow suspends for fraud review, use the utility:
# Approve
python approve_order.py <execution_id>
# Reject
python approve_order.py <execution_id> --rejectThe execution ID is printed in the worker output when fraud review is required.
schemas.py- Structured output schema (OrderAgentOutput)agents.py- LLM agent with output_schematools.py- charge_stripe, send_confirmation_emailworkflows.py- Order processing with conditional fraud reviewapprove_order.py- Utility to approve/reject pending orders