Examples

Look up an order and ask an agent mid-call

Open in playground →

The call reads the order number, stops for your order database, and for a lost order stops again for an agent's refund decision, then writes the reply.

  • Tools and human input
  • when
  • Enum
  • Text

Challenges

  • order_status and refund_approved have "source": "user": your side answers them, from a database or a person, and the call resumes with the answers.
  • Each stops only when its when passes: an email without an order number never stops.

Laying out…

Time 0.78 s · Cost $0.000013

  1. Part 10.14 s$0.000012stopped for order_status; your side answered "lost"
  2. Part 20.06 s$0.00000035stopped for refund_approved; your side answered true
  3. Part 30.58 s$0.0000003completed
Generation(
    result={
        'order_id': '8840',
        'order_status': 'lost',
        'refund_approved': True,
        'refund_reply': "Hi Sam, I'm sorry to hear that your order hasn't arrived. I've checked our system and confirmed that order 8840 is marked as lost. I have approved a full refund for you, which should be processed within 3-5 business days. Thank you for your patience.",
    },
    thinking={},
    usage=Usage(input_tokens=253, thinking_tokens=0),
    skipped=[
        'reply',
    ],
)