ch35_interrupt

show:
mock turns=0 · messages=0
live turns=0 · messages=0
scenario interrupt_pauses_the_run_and_returns_immediately
scenario interrupt_pauses_the_run_and_returns_immediately · 2.6ms
pause 1.8ms
checkpoint_after_pause {"values": {"order_total": 500, "approved": false}, "pending_node": ["place_order"], "pending_interrupt_value": {"question": "approve this order?", "total": 500}}
the_call_returned_instead_of_raising {"raised": false, "interrupt_present": true, "interrupt_value": {"question": "approve this order?", "total": 500}, "approved_field_untouched": false}
scenario interrupt_pauses_the_run_and_returns_immediately · 2.9ms
pause 2.2ms
checkpoint_after_pause {"values": {"order_total": 500, "approved": false}, "pending_node": ["place_order"], "pending_interrupt_value": {"question": "approve this order?", "total": 500}}
the_call_returned_instead_of_raising {"raised": false, "interrupt_present": true, "interrupt_value": {"question": "approve this order?", "total": 500}, "approved_field_untouched": false}
scenario command_resume_dispatches_straight_to_the_pending_node
scenario command_resume_dispatches_straight_to_the_pending_node · 2.0ms
pause 0.9ms
checkpoint_after_pause {"step_one_run_count": 1, "values": {"order_total": 500, "approved": false}, "pending_node": ["place_order"], "pending_interrupt_value": {"question": "approve?", "total": 500}}
resume 0.5ms
checkpoint_after_resume {"step_one_run_count": 1, "values": {"order_total": 500, "approved": true}, "pending_node": [], "pending_interrupt_value": null}
only_the_pending_node_reran {"step_one_run_count": 1, "final_approved": true}
scenario command_resume_dispatches_straight_to_the_pending_node · 2.2ms
pause 1.1ms
checkpoint_after_pause {"step_one_run_count": 1, "values": {"order_total": 500, "approved": false}, "pending_node": ["place_order"], "pending_interrupt_value": {"question": "approve?", "total": 500}}
resume 0.5ms
checkpoint_after_resume {"step_one_run_count": 1, "values": {"order_total": 500, "approved": true}, "pending_node": [], "pending_interrupt_value": null}
only_the_pending_node_reran {"step_one_run_count": 1, "final_approved": true}
scenario code_before_the_interrupt_call_runs_twice_on_resume
scenario code_before_the_interrupt_call_runs_twice_on_resume · 1.4ms
pause 0.5ms
before_interrupt_runs_so_far {"count": 1}
resume 0.6ms
before_interrupt_runs_so_far {"count": 2}
the_pre_interrupt_line_ran_twice {"before_interrupt_runs": 2}
scenario code_before_the_interrupt_call_runs_twice_on_resume · 1.6ms
pause 0.6ms
before_interrupt_runs_so_far {"count": 1}
resume 0.6ms
before_interrupt_runs_so_far {"count": 2}
the_pre_interrupt_line_ran_twice {"before_interrupt_runs": 2}
scenario an_approval_gate_actually_gates_the_action
scenario an_approval_gate_actually_gates_the_action · 7.1ms
pause approved · 2.3ms
turn 1 · 1.2ms · asked for: place_order
model mock · 1.2ms · asked for: place_order
context sent — 1 message(s)
rolecontent
[0]humanOrder 500 widgets.
declared tools (1)
tooldescriptionschema
place_orderPlace an order for a quantity of an item.{"description": "Place an order for a quantity of an item.", "properties": {"item": {"title": "Item", "type": "string"}, "quantity": {"title": "Quantity", "type": "integer"}}, "required": ["item", "quantity"], "title": "place_order", "type": "object"}
tools declared to the mock model {"names": ["place_order"], "consulted": false}
context ignored by the mock model {"messages": 1, "roles": ["human"]}
reply
rolecontent
[0]ai
place_order({"item": "widget", "quantity": 500})
checkpoint_after_pause {"values": {"messages": [{"role": "human", "content": "Order 500 widgets."}, {"role": "ai", "content": ""}]}, "pending_node": ["approval_gate"], "pending_interrupt_value": {"tool": "place_order", "args": {"item": "widget", "quantity": 500}}}
resume approved · 0.8ms
tool place_order · 0.2ms · given: item=widget, quantity=500 · returned: ordered 500 x widget
args {"item": "widget", "quantity": 500}
result {"value": "ordered 500 x widget"}
orders_placed_so_far {"orders": ["ordered 500 x widget"]}
pause denied · 1.1ms
turn 1 · 0.2ms · asked for: place_order
model mock · 0.2ms · asked for: place_order
context sent — 1 message(s)
rolecontent
[0]humanOrder 500 widgets.
declared tools (1)
tooldescriptionschema
place_orderPlace an order for a quantity of an item.{"description": "Place an order for a quantity of an item.", "properties": {"item": {"title": "Item", "type": "string"}, "quantity": {"title": "Quantity", "type": "integer"}}, "required": ["item", "quantity"], "title": "place_order", "type": "object"}
tools declared to the mock model {"names": ["place_order"], "consulted": false}
context ignored by the mock model {"messages": 1, "roles": ["human"]}
reply
rolecontent
[0]ai
place_order({"item": "widget", "quantity": 500})
checkpoint_after_pause {"values": {"messages": [{"role": "human", "content": "Order 500 widgets."}, {"role": "ai", "content": ""}]}, "pending_node": ["approval_gate"], "pending_interrupt_value": {"tool": "place_order", "args": {"item": "widget", "quantity": 500}}}
resume denied · 0.5ms
orders_placed_so_far {"orders": ["ordered 500 x widget"]}
the_gate_actually_gated_the_order {"orders_placed": ["ordered 500 x widget"], "approved_thread_final": "ordered 500 x widget", "denied_thread_final": "denied by approver"}
scenario an_approval_gate_actually_gates_the_action · 3277.0ms
pause approved · 1519.7ms
turn 1 · 1516.7ms · 308 in / 71 out · asked for: place_order
model live · 1516.7ms (model provider 1282.2 · library 234.5) · 308 in / 71 out · asked for: place_order
context sent — 1 message(s)
rolecontent
[0]humanOrder 500 widgets.
declared tools (1)
tooldescriptionschema
place_orderPlace an order for a quantity of an item.{"description": "Place an order for a quantity of an item.", "properties": {"item": {"title": "Item", "type": "string"}, "quantity": {"title": "Quantity", "type": "integer"}}, "required": ["item", "quantity"], "title": "place_order", "type": "object"}
wire request
attempt
1
method
POST
url
https://api.deepseek.com/v1/chat/completions
defaulted (6)
temperature, max_tokens, top_p, stop, seed, tool_choice
headers (18)
show
acceptapplication/json
accept-encodinggzip, deflate, zstd
authorizationnot recorded
connectionkeep-alive
content-length355
content-typeapplication/json
hostapi.deepseek.com
user-agentOpenAI/Python 3.6.0
x-stainless-archarm64
x-stainless-asyncfalse
x-stainless-langpython
x-stainless-osMacOS
x-stainless-package-version3.6.0
x-stainless-raw-responsetrue
x-stainless-read-timeout60.0
x-stainless-retry-count0
x-stainless-runtimeCPython
x-stainless-runtime-version3.14.7
{
  "messages": [
    {
      "content": "Order 500 widgets.",
      "role": "user"
    }
  ],
  "model": "deepseek-flash",
  "stream": false,
  "tools": [
    {
      "type": "function",
      "function": {
        "name": "place_order",
        "description": "Place an order for a quantity of an item.",
        "parameters": {
          "properties": {
            "item": {
              "type": "string"
            },
            "quantity": {
              "type": "integer"
            }
          },
          "required": [
            "item",
            "quantity"
          ],
          "type": "object"
        }
      }
    }
  ]
}
wire response
status
200
headers (15)
show
access-control-allow-credentialstrue
connectionkeep-alive
content-encodinggzip
content-typeapplication/json
dateSun, 13 Sep 2026 21:58:23 GMT
serverelb
strict-transport-securitymax-age=31536000; includeSubDomains; preload
transfer-encodingchunked
varyorigin, access-control-request-method, access-control-request-headers
via1.1 5d351175d5947d478733fbecdab866f6.cloudfront.net (CloudFront)
x-amz-cf-idvmS6O1gGGByTk-TQZV_CTSIyBzF4J1kl9RTK2NIZbX4pKkE7sK85_Q==
x-amz-cf-popDEN52-P2
x-cacheMiss from cloudfront
x-content-type-optionsnosniff
x-ds-trace-idbd994df396ed16f616b79ec97098cb15
{
  "id": "8e350547-2dbe-41c9-b3e4-062f3fb77139",
  "object": "chat.completion",
  "created": 1789336703,
  "model": "deepseek-flash",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "",
        "reasoning_content": "The user wants to order 500 widgets. Simple task \u2014 place the order.",
        "tool_calls": [
          {
            "index": 0,
            "id": "call_00_Mg9Fy1KzPzegpu4Jzj0w3065",
            "type": "function",
            "function": {
              "name": "place_order",
              "arguments": "{\"item\": \"widgets\", \"quantity\": 500}"
            }
          }
        ]
      },
      "logprobs": null,
      "finish_reason": "tool_calls"
    }
  ],
  "usage": {
    "prompt_tokens": 308,
    "completion_tokens": 71,
    "total_tokens": 379,
    "prompt_tokens_details": {
      "cached_tokens": 128
    },
    "completion_tokens_details": {
      "reasoning_tokens": 16
    },
    "prompt_cache_hit_tokens": 128,
    "prompt_cache_miss_tokens": 180
  },
  "system_fingerprint": "aeb56401ca74e127821c4f9126dcb669"
}
reply
rolecontent
[0]ai
place_order({"item": "widgets", "quantity": 500})
checkpoint_after_pause {"values": {"messages": [{"role": "human", "content": "Order 500 widgets."}, {"role": "ai", "content": ""}]}, "pending_node": ["approval_gate"], "pending_interrupt_value": {"tool": "place_order", "args": {"item": "widgets", "quantity": 500}}}
resume approved · 3.8ms
tool place_order · 1.4ms · given: item=widgets, quantity=500 · returned: ordered 500 x widgets
args {"item": "widgets", "quantity": 500}
result {"value": "ordered 500 x widgets"}
orders_placed_so_far {"orders": ["ordered 500 x widgets"]}
pause denied · 1746.9ms
turn 1 · 1743.3ms · 308 in / 83 out · asked for: place_order · responded with: I'll place that order for you.
model live · 1743.3ms (model provider 1730.9 · library 12.3) · 308 in / 83 out · asked for: place_order · responded with: I'll place that order for you.
context sent — 1 message(s)
rolecontent
[0]humanOrder 500 widgets.
declared tools (1)
tooldescriptionschema
place_orderPlace an order for a quantity of an item.{"description": "Place an order for a quantity of an item.", "properties": {"item": {"title": "Item", "type": "string"}, "quantity": {"title": "Quantity", "type": "integer"}}, "required": ["item", "quantity"], "title": "place_order", "type": "object"}
wire request
attempt
1
method
POST
url
https://api.deepseek.com/v1/chat/completions
defaulted (6)
temperature, max_tokens, top_p, stop, seed, tool_choice
headers (18)
show
acceptapplication/json
accept-encodinggzip, deflate, zstd
authorizationnot recorded
connectionkeep-alive
content-length355
content-typeapplication/json
hostapi.deepseek.com
user-agentOpenAI/Python 3.6.0
x-stainless-archarm64
x-stainless-asyncfalse
x-stainless-langpython
x-stainless-osMacOS
x-stainless-package-version3.6.0
x-stainless-raw-responsetrue
x-stainless-read-timeout60.0
x-stainless-retry-count0
x-stainless-runtimeCPython
x-stainless-runtime-version3.14.7
{
  "messages": [
    {
      "content": "Order 500 widgets.",
      "role": "user"
    }
  ],
  "model": "deepseek-flash",
  "stream": false,
  "tools": [
    {
      "type": "function",
      "function": {
        "name": "place_order",
        "description": "Place an order for a quantity of an item.",
        "parameters": {
          "properties": {
            "item": {
              "type": "string"
            },
            "quantity": {
              "type": "integer"
            }
          },
          "required": [
            "item",
            "quantity"
          ],
          "type": "object"
        }
      }
    }
  ]
}
wire response
status
200
headers (15)
show
access-control-allow-credentialstrue
connectionkeep-alive
content-encodinggzip
content-typeapplication/json
dateSun, 13 Sep 2026 21:58:24 GMT
serverelb
strict-transport-securitymax-age=31536000; includeSubDomains; preload
transfer-encodingchunked
varyorigin, access-control-request-method, access-control-request-headers
via1.1 64f15bfbd33a77e4a1cbe7d2b1e398e2.cloudfront.net (CloudFront)
x-amz-cf-idO6HzcLcbJg2HfDEM0XuQi6ey-PR93XXYTFiE3ne88Y_zo92DE_IUFw==
x-amz-cf-popDEN53-P2
x-cacheMiss from cloudfront
x-content-type-optionsnosniff
x-ds-trace-id6dc4e691133e090712e3f3c322a062a2
{
  "id": "2ca6b727-e713-4215-b50c-5ee4aa4babde",
  "object": "chat.completion",
  "created": 1789336704,
  "model": "deepseek-flash",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "I'll place that order for you.",
        "reasoning_content": "The user wants to order 500 widgets. That's a straightforward request. Let me place the order.",
        "tool_calls": [
          {
            "index": 0,
            "id": "call_00_JhK4NmlMPrU6z4whS3or8161",
            "type": "function",
            "function": {
              "name": "place_order",
              "arguments": "{\"item\": \"widgets\", \"quantity\": 500}"
            }
          }
        ]
      },
      "logprobs": null,
      "finish_reason": "tool_calls"
    }
  ],
  "usage": {
    "prompt_tokens": 308,
    "completion_tokens": 83,
    "total_tokens": 391,
    "prompt_tokens_details": {
      "cached_tokens": 128
    },
    "completion_tokens_details": {
      "reasoning_tokens": 21
    },
    "prompt_cache_hit_tokens": 128,
    "prompt_cache_miss_tokens": 180
  },
  "system_fingerprint": "aeb56401ca74e127821c4f9126dcb669"
}
reply
rolecontent
[0]aiI'll place that order for you.
place_order({"item": "widgets", "quantity": 500})
checkpoint_after_pause {"values": {"messages": [{"role": "human", "content": "Order 500 widgets."}, {"role": "ai", "content": "I'll place that order for you."}]}, "pending_node": ["approval_gate"], "pending_interrupt_value": {"tool": "place_order", "args": {"item": "widgets", "quantity": 500}}}
resume denied · 1.7ms
orders_placed_so_far {"orders": ["ordered 500 x widgets"]}
the_gate_actually_gated_the_order {"orders_placed": ["ordered 500 x widgets"], "approved_thread_final": "ordered 500 x widgets", "denied_thread_final": "denied by approver"}