ch40_capstone

show:
mock turns=0 · messages=0
live turns=0 · messages=0
scenario a_small_order_streams_straight_through_no_pause
scenario a_small_order_streams_straight_through_no_pause · 9.8ms
sse_frame_sent {"event": "run_started"}
order 1 · 5.4ms
sse_frame_sent {"event": "checking_items", "count": 1}
branch widget · thread=asyncio_0 · 1.1ms
turn 1 · thread=asyncio_0 · 1.1ms · asked for: check_stock
model mock · thread=asyncio_0 · 0.9ms · asked for: check_stock
context sent — 1 message(s)
rolecontent
[0]humanCheck stock for 3x widget.
declared tools (1)
tooldescriptionschema
check_stockCheck stock and price for a quantity of a sku.{"description": "Check stock and price for a quantity of a sku.", "properties": {"sku": {"title": "Sku", "type": "string"}, "quantity": {"title": "Quantity", "type": "integer"}}, "required": ["sku", "quantity"], "title": "check_stock", "type": "object"}
tools declared to the mock model {"names": ["check_stock"], "consulted": false}
context ignored by the mock model {"messages": 1, "roles": ["human"]}
reply
rolecontent
[0]ai
check_stock({"sku": "widget", "quantity": 3})
tool check_stock · thread=asyncio_0 · 0.2ms · given: sku=widget, quantity=3 · returned: widget: 3 in stock at $10.00 each
args {"sku": "widget", "quantity": 3}
hook {"when": "pre", "by": "note_the_dispatch", "note": "dispatching check_stock for widget", "veto": null, "replacement": null}
dispatched {"value": "widget: 3 in stock at $10.00 each"}
result {"value": "widget: 3 in stock at $10.00 each"}
pricing 1.0ms
sse_frame_sent {"event": "pricing_started"}
subgraph_result {"subtotal": 30.0, "total": 30.0}
sse_frame_sent {"event": "order_placed", "total": 30.0}
sse_frame_sent {"event": "run_ended", "approved": true}
the_small_order_never_paused {"events": ["run_started", "checking_items", "pricing_started", "order_placed", "run_ended"], "total": 30.0, "approved_without_a_gate": true, "callback_events": ["model_start", "model_end"]}
scenario a_small_order_streams_straight_through_no_pause · 1477.1ms
sse_frame_sent {"event": "run_started"}
order 1 · 1472.3ms
sse_frame_sent {"event": "checking_items", "count": 1}
branch widget · thread=asyncio_0 · 1466.8ms
turn 1 · thread=asyncio_0 · 1466.8ms · 314 in / 81 out · asked for: check_stock
model live · thread=asyncio_0 · 1466.0ms (model provider 1247.7 · library 218.3) · 314 in / 81 out · asked for: check_stock
context sent — 1 message(s)
rolecontent
[0]humanCheck stock for 3x widget.
declared tools (1)
tooldescriptionschema
check_stockCheck stock and price for a quantity of a sku.{"description": "Check stock and price for a quantity of a sku.", "properties": {"sku": {"title": "Sku", "type": "string"}, "quantity": {"title": "Quantity", "type": "integer"}}, "required": ["sku", "quantity"], "title": "check_stock", "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-length366
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": "Check stock for 3x widget.",
      "role": "user"
    }
  ],
  "model": "deepseek-flash",
  "stream": false,
  "tools": [
    {
      "type": "function",
      "function": {
        "name": "check_stock",
        "description": "Check stock and price for a quantity of a sku.",
        "parameters": {
          "properties": {
            "sku": {
              "type": "string"
            },
            "quantity": {
              "type": "integer"
            }
          },
          "required": [
            "sku",
            "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:59:31 GMT
serverelb
strict-transport-securitymax-age=31536000; includeSubDomains; preload
transfer-encodingchunked
varyorigin, access-control-request-method, access-control-request-headers
via1.1 5ca5d4f769888ca013d817040942ebf2.cloudfront.net (CloudFront)
x-amz-cf-idGTmzB1OrPlytDXh8RT_YdGTv39A8Gq6jcH5u0aDQDbohu13q4lgxvQ==
x-amz-cf-popDEN53-P1
x-cacheMiss from cloudfront
x-content-type-optionsnosniff
x-ds-trace-idb878f19586edfa2de3a093586f06faa8
{
  "id": "0cb0d70b-0df0-487d-bf71-e0161a6ea714",
  "object": "chat.completion",
  "created": 1789336771,
  "model": "deepseek-flash",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "",
        "reasoning_content": "The user wants to check stock for 3x widget. The sku is probably \"widget\". Let me call the tool.",
        "tool_calls": [
          {
            "index": 0,
            "id": "call_00_gVGDYp0DwuKaVrAxKJmH7472",
            "type": "function",
            "function": {
              "name": "check_stock",
              "arguments": "{\"sku\": \"widget\", \"quantity\": 3}"
            }
          }
        ]
      },
      "logprobs": null,
      "finish_reason": "tool_calls"
    }
  ],
  "usage": {
    "prompt_tokens": 314,
    "completion_tokens": 81,
    "total_tokens": 395,
    "prompt_tokens_details": {
      "cached_tokens": 128
    },
    "completion_tokens_details": {
      "reasoning_tokens": 26
    },
    "prompt_cache_hit_tokens": 128,
    "prompt_cache_miss_tokens": 186
  },
  "system_fingerprint": "aeb56401ca74e127821c4f9126dcb669"
}
reply
rolecontent
[0]ai
check_stock({"sku": "widget", "quantity": 3})
tool check_stock · thread=asyncio_0 · 0.7ms · given: sku=widget, quantity=3 · returned: widget: 3 in stock at $10.00 each
args {"sku": "widget", "quantity": 3}
hook {"when": "pre", "by": "note_the_dispatch", "note": "dispatching check_stock for widget", "veto": null, "replacement": null}
dispatched {"value": "widget: 3 in stock at $10.00 each"}
result {"value": "widget: 3 in stock at $10.00 each"}
pricing 1.4ms
sse_frame_sent {"event": "pricing_started"}
subgraph_result {"subtotal": 30.0, "total": 30.0}
sse_frame_sent {"event": "order_placed", "total": 30.0}
sse_frame_sent {"event": "run_ended", "approved": true}
the_small_order_never_paused {"events": ["run_started", "checking_items", "pricing_started", "order_placed", "run_ended"], "total": 30.0, "approved_without_a_gate": true, "callback_events": ["model_start", "model_end"]}
scenario a_large_order_pauses_for_approval_then_resumes_from_checkpoint
scenario a_large_order_pauses_for_approval_then_resumes_from_checkpoint · 8.7ms
sse_frame_sent {"event": "run_started"}
order 1 · 4.0ms
sse_frame_sent {"event": "checking_items", "count": 1}
branch widget · thread=asyncio_0 · 0.5ms
turn 1 · thread=asyncio_0 · 0.5ms · asked for: check_stock
model mock · thread=asyncio_0 · 0.3ms · asked for: check_stock
context sent — 1 message(s)
rolecontent
[0]humanCheck stock for 20x widget.
declared tools (1)
tooldescriptionschema
check_stockCheck stock and price for a quantity of a sku.{"description": "Check stock and price for a quantity of a sku.", "properties": {"sku": {"title": "Sku", "type": "string"}, "quantity": {"title": "Quantity", "type": "integer"}}, "required": ["sku", "quantity"], "title": "check_stock", "type": "object"}
tools declared to the mock model {"names": ["check_stock"], "consulted": false}
context ignored by the mock model {"messages": 1, "roles": ["human"]}
reply
rolecontent
[0]ai
check_stock({"sku": "widget", "quantity": 20})
tool check_stock · thread=asyncio_0 · 0.2ms · given: sku=widget, quantity=20 · returned: widget: 20 in stock at $10.00 each
args {"sku": "widget", "quantity": 20}
hook {"when": "pre", "by": "note_the_dispatch", "note": "dispatching check_stock for widget", "veto": null, "replacement": null}
dispatched {"value": "widget: 20 in stock at $10.00 each"}
result {"value": "widget: 20 in stock at $10.00 each"}
pricing 1.1ms
sse_frame_sent {"event": "pricing_started"}
subgraph_result {"subtotal": 200.0, "total": 180.0}
sse_frame_sent {"event": "awaiting_approval", "total": 180.0}
sse_frame_sent {"event": "resuming", "decision": true}
sse_frame_sent {"event": "order_placed"}
sse_frame_sent {"event": "run_ended", "approved": true}
the_pause_and_resume_were_two_separate_requests {"events": ["run_started", "checking_items", "pricing_started", "awaiting_approval", "resuming", "order_placed", "run_ended"], "paused_before_resuming": true, "approved_after_resume": true, "total": 180.0}
scenario a_large_order_pauses_for_approval_then_resumes_from_checkpoint · 1600.1ms
sse_frame_sent {"event": "run_started"}
order 1 · 1593.2ms
sse_frame_sent {"event": "checking_items", "count": 1}
branch widget · thread=asyncio_0 · 1588.1ms
turn 1 · thread=asyncio_0 · 1588.1ms · 314 in / 164 out · asked for: check_stock
model live · thread=asyncio_0 · 1587.7ms (model provider 1581.5 · library 6.2) · 314 in / 164 out · asked for: check_stock
context sent — 1 message(s)
rolecontent
[0]humanCheck stock for 20x widget.
declared tools (1)
tooldescriptionschema
check_stockCheck stock and price for a quantity of a sku.{"description": "Check stock and price for a quantity of a sku.", "properties": {"sku": {"title": "Sku", "type": "string"}, "quantity": {"title": "Quantity", "type": "integer"}}, "required": ["sku", "quantity"], "title": "check_stock", "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-length367
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": "Check stock for 20x widget.",
      "role": "user"
    }
  ],
  "model": "deepseek-flash",
  "stream": false,
  "tools": [
    {
      "type": "function",
      "function": {
        "name": "check_stock",
        "description": "Check stock and price for a quantity of a sku.",
        "parameters": {
          "properties": {
            "sku": {
              "type": "string"
            },
            "quantity": {
              "type": "integer"
            }
          },
          "required": [
            "sku",
            "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:59:32 GMT
serverelb
strict-transport-securitymax-age=31536000; includeSubDomains; preload
transfer-encodingchunked
varyorigin, access-control-request-method, access-control-request-headers
via1.1 81c07f42f70c1aec766dc553e24f3864.cloudfront.net (CloudFront)
x-amz-cf-id03rKqhHuYkhSU7J3q1A_5ZHQIOLER2y2yLlihGJw6sKzOOw2ZpuSvQ==
x-amz-cf-popDEN53-P1
x-cacheMiss from cloudfront
x-content-type-optionsnosniff
x-ds-trace-idc490c5975669ca1007e2f6b407dcbbc8
{
  "id": "0c09232e-d08f-42dd-b4a3-4f83541cfd5c",
  "object": "chat.completion",
  "created": 1789336772,
  "model": "deepseek-flash",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "",
        "reasoning_content": "The user wants to check stock for 20 units of widget. I need the SKU. The user didn't provide a SKU, just \"widget\". Let me try calling the tool with sku \"widget\"? But SKU is typically a code. Maybe I should just call with \"widget\".\n\nThe tool requires sku and quantity. I'll use \"widget\" as the sku since that's what the user said. It may fail and I can report back.\n\nI think best to just call the tool with the info given.",
        "tool_calls": [
          {
            "index": 0,
            "id": "call_00_EU64AO6Ycq1qbyZXjl0h1179",
            "type": "function",
            "function": {
              "name": "check_stock",
              "arguments": "{\"sku\": \"widget\", \"quantity\": 20}"
            }
          }
        ]
      },
      "logprobs": null,
      "finish_reason": "tool_calls"
    }
  ],
  "usage": {
    "prompt_tokens": 314,
    "completion_tokens": 164,
    "total_tokens": 478,
    "prompt_tokens_details": {
      "cached_tokens": 128
    },
    "completion_tokens_details": {
      "reasoning_tokens": 109
    },
    "prompt_cache_hit_tokens": 128,
    "prompt_cache_miss_tokens": 186
  },
  "system_fingerprint": "aeb56401ca74e127821c4f9126dcb669"
}
reply
rolecontent
[0]ai
check_stock({"sku": "widget", "quantity": 20})
tool check_stock · thread=asyncio_0 · 0.4ms · given: sku=widget, quantity=20 · returned: widget: 20 in stock at $10.00 each
args {"sku": "widget", "quantity": 20}
hook {"when": "pre", "by": "note_the_dispatch", "note": "dispatching check_stock for widget", "veto": null, "replacement": null}
dispatched {"value": "widget: 20 in stock at $10.00 each"}
result {"value": "widget: 20 in stock at $10.00 each"}
pricing 1.6ms
sse_frame_sent {"event": "pricing_started"}
subgraph_result {"subtotal": 200.0, "total": 180.0}
sse_frame_sent {"event": "awaiting_approval", "total": 180.0}
sse_frame_sent {"event": "resuming", "decision": true}
sse_frame_sent {"event": "order_placed"}
sse_frame_sent {"event": "run_ended", "approved": true}
the_pause_and_resume_were_two_separate_requests {"events": ["run_started", "checking_items", "pricing_started", "awaiting_approval", "resuming", "order_placed", "run_ended"], "paused_before_resuming": true, "approved_after_resume": true, "total": 180.0}
scenario the_real_callback_trace_agrees_with_our_own
scenario the_real_callback_trace_agrees_with_our_own · 7.4ms
sse_frame_sent {"event": "run_started"}
order 2 · 3.6ms
sse_frame_sent {"event": "checking_items", "count": 2}
branch gadget · thread=asyncio_1 · 0.5ms
turn 1 · thread=asyncio_1 · 0.4ms · asked for: check_stock
model mock · thread=asyncio_1 · 0.2ms · asked for: check_stock
context sent — 1 message(s)
rolecontent
[0]humanCheck stock for 2x gadget.
declared tools (1)
tooldescriptionschema
check_stockCheck stock and price for a quantity of a sku.{"description": "Check stock and price for a quantity of a sku.", "properties": {"sku": {"title": "Sku", "type": "string"}, "quantity": {"title": "Quantity", "type": "integer"}}, "required": ["sku", "quantity"], "title": "check_stock", "type": "object"}
tools declared to the mock model {"names": ["check_stock"], "consulted": false}
context ignored by the mock model {"messages": 1, "roles": ["human"]}
reply
rolecontent
[0]ai
check_stock({"sku": "gadget", "quantity": 2})
tool check_stock · thread=asyncio_1 · 0.2ms · given: sku=gadget, quantity=2 · returned: gadget: 2 in stock at $10.00 each
args {"sku": "gadget", "quantity": 2}
hook {"when": "pre", "by": "note_the_dispatch", "note": "dispatching check_stock for gadget", "veto": null, "replacement": null}
dispatched {"value": "gadget: 2 in stock at $10.00 each"}
result {"value": "gadget: 2 in stock at $10.00 each"}
branch widget · thread=asyncio_0 · 0.3ms
turn 1 · thread=asyncio_0 · 0.3ms · asked for: check_stock
model mock · thread=asyncio_0 · 0.2ms · asked for: check_stock
context sent — 1 message(s)
rolecontent
[0]humanCheck stock for 1x widget.
declared tools (1)
tooldescriptionschema
check_stockCheck stock and price for a quantity of a sku.{"description": "Check stock and price for a quantity of a sku.", "properties": {"sku": {"title": "Sku", "type": "string"}, "quantity": {"title": "Quantity", "type": "integer"}}, "required": ["sku", "quantity"], "title": "check_stock", "type": "object"}
tools declared to the mock model {"names": ["check_stock"], "consulted": false}
context ignored by the mock model {"messages": 1, "roles": ["human"]}
reply
rolecontent
[0]ai
check_stock({"sku": "widget", "quantity": 1})
tool check_stock · thread=asyncio_0 · 0.1ms · given: sku=widget, quantity=1 · returned: widget: 1 in stock at $10.00 each
args {"sku": "widget", "quantity": 1}
hook {"when": "pre", "by": "note_the_dispatch", "note": "dispatching check_stock for widget", "veto": null, "replacement": null}
dispatched {"value": "widget: 1 in stock at $10.00 each"}
result {"value": "widget: 1 in stock at $10.00 each"}
pricing 0.9ms
sse_frame_sent {"event": "pricing_started"}
subgraph_result {"subtotal": 30.0, "total": 30.0}
sse_frame_sent {"event": "order_placed", "total": 30.0}
sse_frame_sent {"event": "run_ended", "approved": true}
the_callback_sees_every_model_call_but_no_tool_call {"model_calls_the_callback_saw": 2, "model_calls_the_trace_saw": 2, "model_counts_agree": true, "tool_calls_the_trace_saw": 2, "tool_calls_the_callback_could_have_seen": 0}
scenario the_real_callback_trace_agrees_with_our_own · 1448.5ms
sse_frame_sent {"event": "run_started"}
order 2 · 1442.9ms
sse_frame_sent {"event": "checking_items", "count": 2}
branch widget · thread=asyncio_0 · 1436.1ms
turn 1 · thread=asyncio_0 · 1436.1ms · 314 in / 138 out · asked for: check_stock · responded with: I'll check that for you.
model live · thread=asyncio_0 · 1435.5ms (model provider 1428.5 · library 7.0) · 314 in / 138 out · asked for: check_stock · responded with: I'll check that for you.
context sent — 1 message(s)
rolecontent
[0]humanCheck stock for 1x widget.
declared tools (1)
tooldescriptionschema
check_stockCheck stock and price for a quantity of a sku.{"description": "Check stock and price for a quantity of a sku.", "properties": {"sku": {"title": "Sku", "type": "string"}, "quantity": {"title": "Quantity", "type": "integer"}}, "required": ["sku", "quantity"], "title": "check_stock", "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-length366
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": "Check stock for 1x widget.",
      "role": "user"
    }
  ],
  "model": "deepseek-flash",
  "stream": false,
  "tools": [
    {
      "type": "function",
      "function": {
        "name": "check_stock",
        "description": "Check stock and price for a quantity of a sku.",
        "parameters": {
          "properties": {
            "sku": {
              "type": "string"
            },
            "quantity": {
              "type": "integer"
            }
          },
          "required": [
            "sku",
            "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:59:34 GMT
serverelb
strict-transport-securitymax-age=31536000; includeSubDomains; preload
transfer-encodingchunked
varyorigin, access-control-request-method, access-control-request-headers
via1.1 16d72e0791ff01fc4470d27fc024527a.cloudfront.net (CloudFront)
x-amz-cf-idRlY-gQFGkAVtzwaSfAS2ubYRL6pS144I3hbfrO4QJchjt9B7PtpGvA==
x-amz-cf-popDEN52-P2
x-cacheMiss from cloudfront
x-content-type-optionsnosniff
x-ds-trace-id6f733ba75b20a46b1678714bb54c4c3b
{
  "id": "b568dcae-7a5a-4c62-b5ba-744cda5fc572",
  "object": "chat.completion",
  "created": 1789336774,
  "model": "deepseek-flash",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "I'll check that for you.",
        "reasoning_content": "The user wants to check stock for 1x widget. I need a SKU. \"widget\" is ambiguous - is it a SKU? Let me just call with sku \"widget\".\n\nActually, I should consider whether I need to clarify. The tool requires a sku. The user said \"widget\" which could be the SKU literally. I'll call it.",
        "tool_calls": [
          {
            "index": 0,
            "id": "call_00_7H8HegENH3vcYFy7smbZ3582",
            "type": "function",
            "function": {
              "name": "check_stock",
              "arguments": "{\"sku\": \"widget\", \"quantity\": 1}"
            }
          }
        ]
      },
      "logprobs": null,
      "finish_reason": "tool_calls"
    }
  ],
  "usage": {
    "prompt_tokens": 314,
    "completion_tokens": 138,
    "total_tokens": 452,
    "prompt_tokens_details": {
      "cached_tokens": 128
    },
    "completion_tokens_details": {
      "reasoning_tokens": 77
    },
    "prompt_cache_hit_tokens": 128,
    "prompt_cache_miss_tokens": 186
  },
  "system_fingerprint": "aeb56401ca74e127821c4f9126dcb669"
}
reply
rolecontent
[0]aiI'll check that for you.
check_stock({"sku": "widget", "quantity": 1})
tool check_stock · thread=asyncio_0 · 0.6ms · given: sku=widget, quantity=1 · returned: widget: 1 in stock at $10.00 each
args {"sku": "widget", "quantity": 1}
hook {"when": "pre", "by": "note_the_dispatch", "note": "dispatching check_stock for widget", "veto": null, "replacement": null}
dispatched {"value": "widget: 1 in stock at $10.00 each"}
result {"value": "widget: 1 in stock at $10.00 each"}
branch gadget · thread=asyncio_1 · 1093.9ms
turn 1 · thread=asyncio_1 · 1093.9ms · 314 in / 111 out · asked for: check_stock · responded with: I'll check that for you.
model live · thread=asyncio_1 · 1093.4ms (model provider 1085.3 · library 8.1) · 314 in / 111 out · asked for: check_stock · responded with: I'll check that for you.
context sent — 1 message(s)
rolecontent
[0]humanCheck stock for 2x gadget.
declared tools (1)
tooldescriptionschema
check_stockCheck stock and price for a quantity of a sku.{"description": "Check stock and price for a quantity of a sku.", "properties": {"sku": {"title": "Sku", "type": "string"}, "quantity": {"title": "Quantity", "type": "integer"}}, "required": ["sku", "quantity"], "title": "check_stock", "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-length366
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": "Check stock for 2x gadget.",
      "role": "user"
    }
  ],
  "model": "deepseek-flash",
  "stream": false,
  "tools": [
    {
      "type": "function",
      "function": {
        "name": "check_stock",
        "description": "Check stock and price for a quantity of a sku.",
        "parameters": {
          "properties": {
            "sku": {
              "type": "string"
            },
            "quantity": {
              "type": "integer"
            }
          },
          "required": [
            "sku",
            "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:59:34 GMT
serverelb
strict-transport-securitymax-age=31536000; includeSubDomains; preload
transfer-encodingchunked
varyorigin, access-control-request-method, access-control-request-headers
via1.1 64544648f8289d0bd61ef02997afb698.cloudfront.net (CloudFront)
x-amz-cf-idRvw5FfEEx5ckPfrK7687SVHnJwZPt7kHbvV1DJpi5KYizkt2pFOCEQ==
x-amz-cf-popDEN52-P3
x-cacheMiss from cloudfront
x-content-type-optionsnosniff
x-ds-trace-id988e96f8a2d6ab5d744a74b87d0f34de
{
  "id": "50b84e57-d8e0-4737-9a0b-f1d5e70fa99f",
  "object": "chat.completion",
  "created": 1789336774,
  "model": "deepseek-flash",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "I'll check that for you.",
        "reasoning_content": "The user wants to check stock for 2x gadget. I need a SKU. \"gadget\" might be the SKU. Let me call check_stock with sku \"gadget\" and quantity 2.",
        "tool_calls": [
          {
            "index": 0,
            "id": "call_00_mWHA7LKv0xPiZnrsgR5i2891",
            "type": "function",
            "function": {
              "name": "check_stock",
              "arguments": "{\"sku\": \"gadget\", \"quantity\": 2}"
            }
          }
        ]
      },
      "logprobs": null,
      "finish_reason": "tool_calls"
    }
  ],
  "usage": {
    "prompt_tokens": 314,
    "completion_tokens": 111,
    "total_tokens": 425,
    "prompt_tokens_details": {
      "cached_tokens": 128
    },
    "completion_tokens_details": {
      "reasoning_tokens": 48
    },
    "prompt_cache_hit_tokens": 128,
    "prompt_cache_miss_tokens": 186
  },
  "system_fingerprint": "aeb56401ca74e127821c4f9126dcb669"
}
reply
rolecontent
[0]aiI'll check that for you.
check_stock({"sku": "gadget", "quantity": 2})
tool check_stock · thread=asyncio_1 · 0.5ms · given: sku=gadget, quantity=2 · returned: gadget: 2 in stock at $10.00 each
args {"sku": "gadget", "quantity": 2}
hook {"when": "pre", "by": "note_the_dispatch", "note": "dispatching check_stock for gadget", "veto": null, "replacement": null}
dispatched {"value": "gadget: 2 in stock at $10.00 each"}
result {"value": "gadget: 2 in stock at $10.00 each"}
pricing 2.1ms
sse_frame_sent {"event": "pricing_started"}
subgraph_result {"subtotal": 30.0, "total": 30.0}
sse_frame_sent {"event": "order_placed", "total": 30.0}
sse_frame_sent {"event": "run_ended", "approved": true}
the_callback_sees_every_model_call_but_no_tool_call {"model_calls_the_callback_saw": 2, "model_calls_the_trace_saw": 2, "model_counts_agree": true, "tool_calls_the_trace_saw": 2, "tool_calls_the_callback_could_have_seen": 0}