Module 3 run: type the router, then break it on purpose
==========================================================================
model      : claude-opus-5
max_tokens : 1000 for routing, 3 for the truncated call
limits     : 21 calls, 40000 tokens in total
anthropic  : 1.2.0
pydantic   : 2.13.5
python     : 3.12.16
started    : 2026-11-20T00:14:29+00:00

--------------------------------------------------------------------------
A. untyped route(), ten tickets
--------------------------------------------------------------------------
  [ 1] 'billing'                      in QUEUES: True   stop: end_turn
  [ 2] 'billing'                      in QUEUES: True   stop: end_turn
  [ 3] 'auth'                         in QUEUES: True   stop: end_turn
  [ 4] 'bug'                          in QUEUES: True   stop: end_turn
  [ 5] 'auth'                         in QUEUES: True   stop: end_turn
  [ 6] 'bug'                          in QUEUES: True   stop: end_turn
  [ 7] 'billing'                      in QUEUES: True   stop: end_turn
  [ 8] 'bug'                          in QUEUES: True   stop: end_turn
  [ 9] 'billing'                      in QUEUES: True   stop: end_turn
  [10] 'auth'                         in QUEUES: True   stop: end_turn

--------------------------------------------------------------------------
B. typed route() via messages.parse(), ten tickets
--------------------------------------------------------------------------
  [ 1] returned  'billing'
  [ 2] returned  'billing'
  [ 3] returned  'auth'
  [ 4] returned  'bug'
  [ 5] returned  'auth'
  [ 6] returned  'bug'
  [ 7] returned  'billing'
  [ 8] returned  'bug'
  [ 9] returned  'billing'
  [10] returned  'bug'

--------------------------------------------------------------------------
C. deliberate truncation on TicketRoute (max_tokens=3)
--------------------------------------------------------------------------
  outcome        : raised
  exception_type : ValidationError
    1 validation error for TicketRoute
      Invalid JSON: EOF while parsing a string at line 1 column 5 [type=json_invalid, input_value='{"que', input_type=str]
        For further information visit https://errors.pydantic.dev/2.13/v/json_invalid
  stop_reason    : None
  usage          : None in / None out

--------------------------------------------------------------------------
result
--------------------------------------------------------------------------
  untyped: 10/10 outputs were exactly one of QUEUES with no cleanup
  typed  : 10/10 calls returned a typed queue, 0/10 raised, 0/10 gave None
  same queue in both: 9/10

--------------------------------------------------------------------------
token usage, from the JSONL
--------------------------------------------------------------------------
  before      10 calls (10 with usage)  in    549  out    528
  after       10 calls (10 with usage)  in   2919  out    120
  truncation   1 calls (0 with usage)  in      0  out      0
  output split: thinking tokens not reported on 1 of 21 calls

finished   : 2026-11-20T00:14:56+00:00
wrote      : /home/runner/work/_temp/m3/run.jsonl
Next: python ch03-structured-output/ch3_course_check.py
exit 0
