ch11_state

show:
mock turns=6 · messages=14
live turns=4 · messages=12
scenario a_running_total_survives_between_calls
scenario a_running_total_survives_between_calls · tools=place_order, price_of · 5.2ms · 3 turns · ended: no_tool_calls
turn 1 · 4.3ms · asked for: place_order
model mock · 4.0ms · asked for: place_order
context sent — 2 message(s)
rolecontent
[0]systemYou answer briefly and plainly. Use the tools you are given.
[1]humanOrder 5 bottles of milk for the cafe, and 3 for the office, separately.
declared tools (2)
tooldescriptionschema
place_orderOrder a quantity of an item. A write: the total counts it, once dispatched.{"$defs": {"GroceryItem": {"enum": ["bread", "butter", "chips", "milk"], "type": "string"}}, "description": "Order a quantity of an item. A write: the total counts it, once dispatched.", "properties": {"item": {"$ref": "#/$defs/GroceryItem"}, "quantity": {"title": "Quantity", "type": "integer"}}, "required": ["item", "quantity"], "title": "place_order", "type": "object"}
price_ofThe current shelf price of an item, in pounds. A read: the total ignores it.{"$defs": {"GroceryItem": {"enum": ["bread", "butter", "chips", "milk"], "type": "string"}}, "description": "The current shelf price of an item, in pounds. A read: the total ignores it.", "properties": {"item": {"$ref": "#/$defs/GroceryItem"}}, "required": ["item"], "title": "price_of", "type": "object"}
tools declared to the mock model {"names": ["place_order", "price_of"], "consulted": false}
context ignored by the mock model {"messages": 2, "roles": ["system", "human"]}
reply
rolecontent
[0]ai
place_order({"item": "milk", "quantity": 5})
tool place_order · 0.3ms · given: item=milk, quantity=5 · returned: ordered 5 x milk
args {"item": "milk", "quantity": 5}
result {"value": "ordered 5 x milk"}
state {"total_ordered": 5}
turn 2 · 0.4ms · asked for: place_order
model mock · 0.3ms · asked for: place_order
context sent — 4 message(s)
rolecontent
[0]systemYou answer briefly and plainly. Use the tools you are given.
[1]humanOrder 5 bottles of milk for the cafe, and 3 for the office, separately.
[2]ai
place_order({"item": "milk", "quantity": 5})
[3]toolordered 5 x milk
declared tools (2)
tooldescriptionschema
place_orderOrder a quantity of an item. A write: the total counts it, once dispatched.{"$defs": {"GroceryItem": {"enum": ["bread", "butter", "chips", "milk"], "type": "string"}}, "description": "Order a quantity of an item. A write: the total counts it, once dispatched.", "properties": {"item": {"$ref": "#/$defs/GroceryItem"}, "quantity": {"title": "Quantity", "type": "integer"}}, "required": ["item", "quantity"], "title": "place_order", "type": "object"}
price_ofThe current shelf price of an item, in pounds. A read: the total ignores it.{"$defs": {"GroceryItem": {"enum": ["bread", "butter", "chips", "milk"], "type": "string"}}, "description": "The current shelf price of an item, in pounds. A read: the total ignores it.", "properties": {"item": {"$ref": "#/$defs/GroceryItem"}}, "required": ["item"], "title": "price_of", "type": "object"}
tools declared to the mock model {"names": ["place_order", "price_of"], "consulted": false}
context ignored by the mock model {"messages": 4, "roles": ["system", "human", "ai", "tool"]}
reply
rolecontent
[0]ai
place_order({"item": "milk", "quantity": 3})
tool place_order · 0.1ms · given: item=milk, quantity=3 · returned: ordered 3 x milk
args {"item": "milk", "quantity": 3}
result {"value": "ordered 3 x milk"}
state {"total_ordered": 8}
turn 3 · 0.2ms · responded with: Ordered 5 for the cafe and 3 for the office -- 8 in total.
model mock · 0.2ms · responded with: Ordered 5 for the cafe and 3 for the office -- 8 in total.
context sent — 6 message(s)
rolecontent
[0]systemYou answer briefly and plainly. Use the tools you are given.
[1]humanOrder 5 bottles of milk for the cafe, and 3 for the office, separately.
[2]ai
place_order({"item": "milk", "quantity": 5})
[3]toolordered 5 x milk
[4]ai
place_order({"item": "milk", "quantity": 3})
[5]toolordered 3 x milk
declared tools (2)
tooldescriptionschema
place_orderOrder a quantity of an item. A write: the total counts it, once dispatched.{"$defs": {"GroceryItem": {"enum": ["bread", "butter", "chips", "milk"], "type": "string"}}, "description": "Order a quantity of an item. A write: the total counts it, once dispatched.", "properties": {"item": {"$ref": "#/$defs/GroceryItem"}, "quantity": {"title": "Quantity", "type": "integer"}}, "required": ["item", "quantity"], "title": "place_order", "type": "object"}
price_ofThe current shelf price of an item, in pounds. A read: the total ignores it.{"$defs": {"GroceryItem": {"enum": ["bread", "butter", "chips", "milk"], "type": "string"}}, "description": "The current shelf price of an item, in pounds. A read: the total ignores it.", "properties": {"item": {"$ref": "#/$defs/GroceryItem"}}, "required": ["item"], "title": "price_of", "type": "object"}
tools declared to the mock model {"names": ["place_order", "price_of"], "consulted": false}
context ignored by the mock model {"messages": 6, "roles": ["system", "human", "ai", "tool", "ai", "tool"]}
reply
rolecontent
[0]aiOrdered 5 for the cafe and 3 for the office -- 8 in total.
state {"total_ordered": 8}
ended {"reason": "no_tool_calls"}
scenario a_running_total_survives_between_calls · tools=place_order, price_of · 3949.4ms · 2 turns · ended: no_tool_calls
turn 1 · 2183.5ms · 438 in / 248 out · asked for: place_order, place_order · responded with: I'll place these as two separate orders, since the tool only records item and quantity — t... (36 more characters)
model live · 2181.6ms (model provider 2000.5 · library 181.1) · 438 in / 248 out · asked for: place_order, place_order · responded with: I'll place these as two separate orders, since the tool only records item and quantity — t... (36 more characters)
context sent — 2 message(s)
rolecontent
[0]systemYou answer briefly and plainly. Use the tools you are given.
[1]humanOrder 5 bottles of milk for the cafe, and 3 for the office, separately.
declared tools (2)
tooldescriptionschema
place_orderOrder a quantity of an item. A write: the total counts it, once dispatched.{"$defs": {"GroceryItem": {"enum": ["bread", "butter", "chips", "milk"], "type": "string"}}, "description": "Order a quantity of an item. A write: the total counts it, once dispatched.", "properties": {"item": {"$ref": "#/$defs/GroceryItem"}, "quantity": {"title": "Quantity", "type": "integer"}}, "required": ["item", "quantity"], "title": "place_order", "type": "object"}
price_ofThe current shelf price of an item, in pounds. A read: the total ignores it.{"$defs": {"GroceryItem": {"enum": ["bread", "butter", "chips", "milk"], "type": "string"}}, "description": "The current shelf price of an item, in pounds. A read: the total ignores it.", "properties": {"item": {"$ref": "#/$defs/GroceryItem"}}, "required": ["item"], "title": "price_of", "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-length850
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": "You answer briefly and plainly. Use the tools you are given.",
      "role": "system"
    },
    {
      "content": "Order 5 bottles of milk for the cafe, and 3 for the office, separately.",
      "role": "user"
    }
  ],
  "model": "deepseek-flash",
  "stream": false,
  "tools": [
    {
      "type": "function",
      "function": {
        "name": "place_order",
        "description": "Order a quantity of an item. A write: the total counts it, once dispatched.",
        "parameters": {
          "properties": {
            "item": {
              "enum": [
                "bread",
                "butter",
                "chips",
                "milk"
              ],
              "type": "string"
            },
            "quantity": {
              "type": "integer"
            }
          },
          "required": [
            "item",
            "quantity"
          ],
          "type": "object"
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "price_of",
        "description": "The current shelf price of an item, in pounds. A read: the total ignores it.",
        "parameters": {
          "properties": {
            "item": {
              "enum": [
                "bread",
                "butter",
                "chips",
                "milk"
              ],
              "type": "string"
            }
          },
          "required": [
            "item"
          ],
          "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:52:22 GMT
serverelb
strict-transport-securitymax-age=31536000; includeSubDomains; preload
transfer-encodingchunked
varyorigin, access-control-request-method, access-control-request-headers
via1.1 be626befb5228a851019aa4b9b0a73fe.cloudfront.net (CloudFront)
x-amz-cf-idVnYFC8ZZCm4ma9yj11NscEtUulz63ladsKv3a9Z2rXgtCb2MSKMyFA==
x-amz-cf-popDEN53-P6
x-cacheMiss from cloudfront
x-content-type-optionsnosniff
x-ds-trace-id682cf73f6b0fd8856374f276052f4da0
{
  "id": "2acc4019-96eb-4f6d-a2ff-170ce1b193b0",
  "object": "chat.completion",
  "created": 1789336342,
  "model": "deepseek-flash",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "I'll place these as two separate orders, since the tool only records item and quantity \u2014 there's no field for the destination.",
        "reasoning_content": "The user wants 5 bottles of milk for the cafe, and 3 for the office, separately. There's no \"location\" parameter or \"recipient\" parameter in the order tool. So I can only place orders of milk quantities. \"Separately\" suggests two separate orders: one of 5 and one of 3.\n\nLet me just place two orders: 5 milk, 3 milk.\n\nI could check price first, but not necessary. Let's just do it.\n\nThe tool only takes item and quantity, so \"separately\" = two orders.\n\nLet me call place_order twice.",
        "tool_calls": [
          {
            "index": 0,
            "id": "call_00_nKAEu1eWjgss2Ct86K403375",
            "type": "function",
            "function": {
              "name": "place_order",
              "arguments": "{\"item\": \"milk\", \"quantity\": 5}"
            }
          },
          {
            "index": 1,
            "id": "call_01_REsX6Dt2U8grtqNwqE9D9497",
            "type": "function",
            "function": {
              "name": "place_order",
              "arguments": "{\"item\": \"milk\", \"quantity\": 3}"
            }
          }
        ]
      },
      "logprobs": null,
      "finish_reason": "tool_calls"
    }
  ],
  "usage": {
    "prompt_tokens": 438,
    "completion_tokens": 248,
    "total_tokens": 686,
    "prompt_tokens_details": {
      "cached_tokens": 256
    },
    "completion_tokens_details": {
      "reasoning_tokens": 123
    },
    "prompt_cache_hit_tokens": 256,
    "prompt_cache_miss_tokens": 182
  },
  "system_fingerprint": "aeb56401ca74e127821c4f9126dcb669"
}
reply
rolecontent
[0]aiI'll place these as two separate orders, since the tool only records item and quantity — there's no field for the destination.
place_order({"item": "milk", "quantity": 5})
place_order({"item": "milk", "quantity": 3})
tool place_order · 1.3ms · given: item=milk, quantity=5 · returned: ordered 5 x milk
args {"item": "milk", "quantity": 5}
result {"value": "ordered 5 x milk"}
tool place_order · 0.4ms · given: item=milk, quantity=3 · returned: ordered 3 x milk
args {"item": "milk", "quantity": 3}
result {"value": "ordered 3 x milk"}
state {"total_ordered": 8}
turn 2 · 1765.7ms · 716 in / 97 out · responded with: Done — two orders placed: 5 milk and 3 milk, totaling 8 bottles. One thing to flag: the or... (229 more characters)
model live · 1765.7ms (model provider 1751.7 · library 14.0) · 716 in / 97 out · responded with: Done — two orders placed: 5 milk and 3 milk, totaling 8 bottles. One thing to flag: the or... (229 more characters)
context sent — 5 message(s)
rolecontent
[0]systemYou answer briefly and plainly. Use the tools you are given.
[1]humanOrder 5 bottles of milk for the cafe, and 3 for the office, separately.
[2]aiI'll place these as two separate orders, since the tool only records item and quantity — there's no field for the destination.
place_order({"item": "milk", "quantity": 5})
place_order({"item": "milk", "quantity": 3})
[3]toolordered 5 x milk
[4]toolordered 3 x milk
declared tools (2)
tooldescriptionschema
place_orderOrder a quantity of an item. A write: the total counts it, once dispatched.{"$defs": {"GroceryItem": {"enum": ["bread", "butter", "chips", "milk"], "type": "string"}}, "description": "Order a quantity of an item. A write: the total counts it, once dispatched.", "properties": {"item": {"$ref": "#/$defs/GroceryItem"}, "quantity": {"title": "Quantity", "type": "integer"}}, "required": ["item", "quantity"], "title": "place_order", "type": "object"}
price_ofThe current shelf price of an item, in pounds. A read: the total ignores it.{"$defs": {"GroceryItem": {"enum": ["bread", "butter", "chips", "milk"], "type": "string"}}, "description": "The current shelf price of an item, in pounds. A read: the total ignores it.", "properties": {"item": {"$ref": "#/$defs/GroceryItem"}}, "required": ["item"], "title": "price_of", "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-length2031
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": "You answer briefly and plainly. Use the tools you are given.",
      "role": "system"
    },
    {
      "content": "Order 5 bottles of milk for the cafe, and 3 for the office, separately.",
      "role": "user"
    },
    {
      "content": "I'll place these as two separate orders, since the tool only records item and quantity \u2014 there's no field for the destination.",
      "role": "assistant",
      "tool_calls": [
        {
          "type": "function",
          "id": "call_00_nKAEu1eWjgss2Ct86K403375",
          "function": {
            "name": "place_order",
            "arguments": "{\"item\": \"milk\", \"quantity\": 5}"
          }
        },
        {
          "type": "function",
          "id": "call_01_REsX6Dt2U8grtqNwqE9D9497",
          "function": {
            "name": "place_order",
            "arguments": "{\"item\": \"milk\", \"quantity\": 3}"
          }
        }
      ],
      "reasoning_content": "The user wants 5 bottles of milk for the cafe, and 3 for the office, separately. There's no \"location\" parameter or \"recipient\" parameter in the order tool. So I can only place orders of milk quantities. \"Separately\" suggests two separate orders: one of 5 and one of 3.\n\nLet me just place two orders: 5 milk, 3 milk.\n\nI could check price first, but not necessary. Let's just do it.\n\nThe tool only takes item and quantity, so \"separately\" = two orders.\n\nLet me call place_order twice."
    },
    {
      "content": "ordered 5 x milk",
      "role": "tool",
      "tool_call_id": "call_00_nKAEu1eWjgss2Ct86K403375"
    },
    {
      "content": "ordered 3 x milk",
      "role": "tool",
      "tool_call_id": "call_01_REsX6Dt2U8grtqNwqE9D9497"
    }
  ],
  "model": "deepseek-flash",
  "stream": false,
  "tools": [
    {
      "type": "function",
      "function": {
        "name": "place_order",
        "description": "Order a quantity of an item. A write: the total counts it, once dispatched.",
        "parameters": {
          "properties": {
            "item": {
              "enum": [
                "bread",
                "butter",
                "chips",
                "milk"
              ],
              "type": "string"
            },
            "quantity": {
              "type": "integer"
            }
          },
          "required": [
            "item",
            "quantity"
          ],
          "type": "object"
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "price_of",
        "description": "The current shelf price of an item, in pounds. A read: the total ignores it.",
        "parameters": {
          "properties": {
            "item": {
              "enum": [
                "bread",
                "butter",
                "chips",
                "milk"
              ],
              "type": "string"
            }
          },
          "required": [
            "item"
          ],
          "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:52:24 GMT
serverelb
strict-transport-securitymax-age=31536000; includeSubDomains; preload
transfer-encodingchunked
varyorigin, access-control-request-method, access-control-request-headers
via1.1 7266a33455d181f3974b454ffa05bcfa.cloudfront.net (CloudFront)
x-amz-cf-idofIb6xtTcIK1ijD3rzoUpPfMSp0r83ulvOUNuT8Xk6SjG__LZU5HtQ==
x-amz-cf-popDEN53-P4
x-cacheMiss from cloudfront
x-content-type-optionsnosniff
x-ds-trace-idb995e4cb056508a2cc9844937e886dc7
{
  "id": "97b09483-074e-44f0-acec-d8878a3df295",
  "object": "chat.completion",
  "created": 1789336344,
  "model": "deepseek-flash",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Done \u2014 two orders placed: 5 milk and 3 milk, totaling 8 bottles.\n\nOne thing to flag: the ordering tool has no field for a destination, so the two orders are identical as recorded \u2014 nothing distinguishes the cafe's 5 from the office's 3. If your system needs that distinction tracked, it'll have to be recorded elsewhere.",
        "reasoning_content": "Done. Note the limitation: the orders can't be labeled, so both are just milk orders totaling 8."
      },
      "logprobs": null,
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 716,
    "completion_tokens": 97,
    "total_tokens": 813,
    "prompt_tokens_details": {
      "cached_tokens": 512
    },
    "completion_tokens_details": {
      "reasoning_tokens": 23
    },
    "prompt_cache_hit_tokens": 512,
    "prompt_cache_miss_tokens": 204
  },
  "system_fingerprint": "aeb56401ca74e127821c4f9126dcb669"
}
reply
rolecontent
[0]aiDone — two orders placed: 5 milk and 3 milk, totaling 8 bottles. One thing to flag: the ordering tool has no field for a destination, so the two orders are identical as recorded — nothing distinguishes the cafe's 5 from the office's 3. If your system needs that distinction tracked, it'll have to be recorded elsewhere.
state {"total_ordered": 8}
ended {"reason": "no_tool_calls"}
scenario reads_do_not_touch_the_total
scenario reads_do_not_touch_the_total · tools=place_order, price_of · 0.9ms · 3 turns · ended: no_tool_calls
turn 1 · 0.4ms · asked for: price_of
model mock · 0.2ms · asked for: price_of
context sent — 2 message(s)
rolecontent
[0]systemYou answer briefly and plainly. Use the tools you are given.
[1]humanHow much is milk, and please order 4 bottles.
declared tools (2)
tooldescriptionschema
place_orderOrder a quantity of an item. A write: the total counts it, once dispatched.{"$defs": {"GroceryItem": {"enum": ["bread", "butter", "chips", "milk"], "type": "string"}}, "description": "Order a quantity of an item. A write: the total counts it, once dispatched.", "properties": {"item": {"$ref": "#/$defs/GroceryItem"}, "quantity": {"title": "Quantity", "type": "integer"}}, "required": ["item", "quantity"], "title": "place_order", "type": "object"}
price_ofThe current shelf price of an item, in pounds. A read: the total ignores it.{"$defs": {"GroceryItem": {"enum": ["bread", "butter", "chips", "milk"], "type": "string"}}, "description": "The current shelf price of an item, in pounds. A read: the total ignores it.", "properties": {"item": {"$ref": "#/$defs/GroceryItem"}}, "required": ["item"], "title": "price_of", "type": "object"}
tools declared to the mock model {"names": ["place_order", "price_of"], "consulted": false}
context ignored by the mock model {"messages": 2, "roles": ["system", "human"]}
reply
rolecontent
[0]ai
price_of({"item": "milk"})
tool price_of · 0.1ms · given: item=milk · returned: 1.20 for milk
args {"item": "milk"}
result {"value": "1.20 for milk"}
state {"total_ordered": 0}
turn 2 · 0.3ms · asked for: place_order
model mock · 0.2ms · asked for: place_order
context sent — 4 message(s)
rolecontent
[0]systemYou answer briefly and plainly. Use the tools you are given.
[1]humanHow much is milk, and please order 4 bottles.
[2]ai
price_of({"item": "milk"})
[3]tool1.20 for milk
declared tools (2)
tooldescriptionschema
place_orderOrder a quantity of an item. A write: the total counts it, once dispatched.{"$defs": {"GroceryItem": {"enum": ["bread", "butter", "chips", "milk"], "type": "string"}}, "description": "Order a quantity of an item. A write: the total counts it, once dispatched.", "properties": {"item": {"$ref": "#/$defs/GroceryItem"}, "quantity": {"title": "Quantity", "type": "integer"}}, "required": ["item", "quantity"], "title": "place_order", "type": "object"}
price_ofThe current shelf price of an item, in pounds. A read: the total ignores it.{"$defs": {"GroceryItem": {"enum": ["bread", "butter", "chips", "milk"], "type": "string"}}, "description": "The current shelf price of an item, in pounds. A read: the total ignores it.", "properties": {"item": {"$ref": "#/$defs/GroceryItem"}}, "required": ["item"], "title": "price_of", "type": "object"}
tools declared to the mock model {"names": ["place_order", "price_of"], "consulted": false}
context ignored by the mock model {"messages": 4, "roles": ["system", "human", "ai", "tool"]}
reply
rolecontent
[0]ai
place_order({"item": "milk", "quantity": 4})
tool place_order · 0.1ms · given: item=milk, quantity=4 · returned: ordered 4 x milk
args {"item": "milk", "quantity": 4}
result {"value": "ordered 4 x milk"}
state {"total_ordered": 4}
turn 3 · 0.2ms · responded with: Milk is 1.20 each; ordered 4 bottles.
model mock · 0.2ms · responded with: Milk is 1.20 each; ordered 4 bottles.
context sent — 6 message(s)
rolecontent
[0]systemYou answer briefly and plainly. Use the tools you are given.
[1]humanHow much is milk, and please order 4 bottles.
[2]ai
price_of({"item": "milk"})
[3]tool1.20 for milk
[4]ai
place_order({"item": "milk", "quantity": 4})
[5]toolordered 4 x milk
declared tools (2)
tooldescriptionschema
place_orderOrder a quantity of an item. A write: the total counts it, once dispatched.{"$defs": {"GroceryItem": {"enum": ["bread", "butter", "chips", "milk"], "type": "string"}}, "description": "Order a quantity of an item. A write: the total counts it, once dispatched.", "properties": {"item": {"$ref": "#/$defs/GroceryItem"}, "quantity": {"title": "Quantity", "type": "integer"}}, "required": ["item", "quantity"], "title": "place_order", "type": "object"}
price_ofThe current shelf price of an item, in pounds. A read: the total ignores it.{"$defs": {"GroceryItem": {"enum": ["bread", "butter", "chips", "milk"], "type": "string"}}, "description": "The current shelf price of an item, in pounds. A read: the total ignores it.", "properties": {"item": {"$ref": "#/$defs/GroceryItem"}}, "required": ["item"], "title": "price_of", "type": "object"}
tools declared to the mock model {"names": ["place_order", "price_of"], "consulted": false}
context ignored by the mock model {"messages": 6, "roles": ["system", "human", "ai", "tool", "ai", "tool"]}
reply
rolecontent
[0]aiMilk is 1.20 each; ordered 4 bottles.
state {"total_ordered": 4}
ended {"reason": "no_tool_calls"}
scenario reads_do_not_touch_the_total · tools=place_order, price_of · 2307.1ms · 2 turns · ended: no_tool_calls
turn 1 · 1056.4ms · 431 in / 93 out · asked for: price_of, place_order · responded with: I'll check the price and place the order.
model live · 1055.1ms (model provider 1042.4 · library 12.7) · 431 in / 93 out · asked for: price_of, place_order · responded with: I'll check the price and place the order.
context sent — 2 message(s)
rolecontent
[0]systemYou answer briefly and plainly. Use the tools you are given.
[1]humanHow much is milk, and please order 4 bottles.
declared tools (2)
tooldescriptionschema
place_orderOrder a quantity of an item. A write: the total counts it, once dispatched.{"$defs": {"GroceryItem": {"enum": ["bread", "butter", "chips", "milk"], "type": "string"}}, "description": "Order a quantity of an item. A write: the total counts it, once dispatched.", "properties": {"item": {"$ref": "#/$defs/GroceryItem"}, "quantity": {"title": "Quantity", "type": "integer"}}, "required": ["item", "quantity"], "title": "place_order", "type": "object"}
price_ofThe current shelf price of an item, in pounds. A read: the total ignores it.{"$defs": {"GroceryItem": {"enum": ["bread", "butter", "chips", "milk"], "type": "string"}}, "description": "The current shelf price of an item, in pounds. A read: the total ignores it.", "properties": {"item": {"$ref": "#/$defs/GroceryItem"}}, "required": ["item"], "title": "price_of", "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-length824
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": "You answer briefly and plainly. Use the tools you are given.",
      "role": "system"
    },
    {
      "content": "How much is milk, and please order 4 bottles.",
      "role": "user"
    }
  ],
  "model": "deepseek-flash",
  "stream": false,
  "tools": [
    {
      "type": "function",
      "function": {
        "name": "place_order",
        "description": "Order a quantity of an item. A write: the total counts it, once dispatched.",
        "parameters": {
          "properties": {
            "item": {
              "enum": [
                "bread",
                "butter",
                "chips",
                "milk"
              ],
              "type": "string"
            },
            "quantity": {
              "type": "integer"
            }
          },
          "required": [
            "item",
            "quantity"
          ],
          "type": "object"
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "price_of",
        "description": "The current shelf price of an item, in pounds. A read: the total ignores it.",
        "parameters": {
          "properties": {
            "item": {
              "enum": [
                "bread",
                "butter",
                "chips",
                "milk"
              ],
              "type": "string"
            }
          },
          "required": [
            "item"
          ],
          "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:52:26 GMT
serverelb
strict-transport-securitymax-age=31536000; includeSubDomains; preload
transfer-encodingchunked
varyorigin, access-control-request-method, access-control-request-headers
via1.1 91881fdae44078e1c95546f3cb1e2366.cloudfront.net (CloudFront)
x-amz-cf-idnzAzlXv6XA7xodCYI0IVM9v47SAfMnLQKxH0a1HaQqrZQJUIJTL2lQ==
x-amz-cf-popDEN53-P1
x-cacheMiss from cloudfront
x-content-type-optionsnosniff
x-ds-trace-idd0e054d21f1b7900eea20f0db8d11181
{
  "id": "c58cb0da-bb9a-4f4c-9672-2ec8badc52bf",
  "object": "chat.completion",
  "created": 1789336345,
  "model": "deepseek-flash",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "I'll check the price and place the order.",
        "reasoning_content": "",
        "tool_calls": [
          {
            "index": 0,
            "id": "call_00_ET_BM9jLYCef01MxRBflFrO4642",
            "type": "function",
            "function": {
              "name": "price_of",
              "arguments": "{\"item\": \"milk\"}"
            }
          },
          {
            "index": 1,
            "id": "call_01_ET_NOAtXDqdPY73N5WjuaUF6237",
            "type": "function",
            "function": {
              "name": "place_order",
              "arguments": "{\"item\": \"milk\", \"quantity\": 4}"
            }
          }
        ]
      },
      "logprobs": null,
      "finish_reason": "tool_calls"
    }
  ],
  "usage": {
    "prompt_tokens": 431,
    "completion_tokens": 93,
    "total_tokens": 524,
    "prompt_tokens_details": {
      "cached_tokens": 256
    },
    "completion_tokens_details": {
      "reasoning_tokens": 0
    },
    "prompt_cache_hit_tokens": 256,
    "prompt_cache_miss_tokens": 175
  },
  "system_fingerprint": "aeb56401ca74e127821c4f9126dcb669"
}
reply
rolecontent
[0]aiI'll check the price and place the order.
price_of({"item": "milk"})
place_order({"item": "milk", "quantity": 4})
tool price_of · 0.7ms · given: item=milk · returned: 1.20 for milk
args {"item": "milk"}
result {"value": "1.20 for milk"}
tool place_order · 0.4ms · given: item=milk, quantity=4 · returned: ordered 4 x milk
args {"item": "milk", "quantity": 4}
result {"value": "ordered 4 x milk"}
state {"total_ordered": 4}
turn 2 · 1250.7ms · 554 in / 49 out · responded with: Milk is £1.20 each (note: bottles, not necessarily litres — I ordered 4 for you). Your ord... (64 more characters)
model live · 1250.6ms (model provider 1235.6 · library 15.0) · 554 in / 49 out · responded with: Milk is £1.20 each (note: bottles, not necessarily litres — I ordered 4 for you). Your ord... (64 more characters)
context sent — 5 message(s)
rolecontent
[0]systemYou answer briefly and plainly. Use the tools you are given.
[1]humanHow much is milk, and please order 4 bottles.
[2]aiI'll check the price and place the order.
price_of({"item": "milk"})
place_order({"item": "milk", "quantity": 4})
[3]tool1.20 for milk
[4]toolordered 4 x milk
declared tools (2)
tooldescriptionschema
place_orderOrder a quantity of an item. A write: the total counts it, once dispatched.{"$defs": {"GroceryItem": {"enum": ["bread", "butter", "chips", "milk"], "type": "string"}}, "description": "Order a quantity of an item. A write: the total counts it, once dispatched.", "properties": {"item": {"$ref": "#/$defs/GroceryItem"}, "quantity": {"title": "Quantity", "type": "integer"}}, "required": ["item", "quantity"], "title": "place_order", "type": "object"}
price_ofThe current shelf price of an item, in pounds. A read: the total ignores it.{"$defs": {"GroceryItem": {"enum": ["bread", "butter", "chips", "milk"], "type": "string"}}, "description": "The current shelf price of an item, in pounds. A read: the total ignores it.", "properties": {"item": {"$ref": "#/$defs/GroceryItem"}}, "required": ["item"], "title": "price_of", "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-length1385
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": "You answer briefly and plainly. Use the tools you are given.",
      "role": "system"
    },
    {
      "content": "How much is milk, and please order 4 bottles.",
      "role": "user"
    },
    {
      "content": "I'll check the price and place the order.",
      "role": "assistant",
      "tool_calls": [
        {
          "type": "function",
          "id": "call_00_ET_BM9jLYCef01MxRBflFrO4642",
          "function": {
            "name": "price_of",
            "arguments": "{\"item\": \"milk\"}"
          }
        },
        {
          "type": "function",
          "id": "call_01_ET_NOAtXDqdPY73N5WjuaUF6237",
          "function": {
            "name": "place_order",
            "arguments": "{\"item\": \"milk\", \"quantity\": 4}"
          }
        }
      ]
    },
    {
      "content": "1.20 for milk",
      "role": "tool",
      "tool_call_id": "call_00_ET_BM9jLYCef01MxRBflFrO4642"
    },
    {
      "content": "ordered 4 x milk",
      "role": "tool",
      "tool_call_id": "call_01_ET_NOAtXDqdPY73N5WjuaUF6237"
    }
  ],
  "model": "deepseek-flash",
  "stream": false,
  "tools": [
    {
      "type": "function",
      "function": {
        "name": "place_order",
        "description": "Order a quantity of an item. A write: the total counts it, once dispatched.",
        "parameters": {
          "properties": {
            "item": {
              "enum": [
                "bread",
                "butter",
                "chips",
                "milk"
              ],
              "type": "string"
            },
            "quantity": {
              "type": "integer"
            }
          },
          "required": [
            "item",
            "quantity"
          ],
          "type": "object"
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "price_of",
        "description": "The current shelf price of an item, in pounds. A read: the total ignores it.",
        "parameters": {
          "properties": {
            "item": {
              "enum": [
                "bread",
                "butter",
                "chips",
                "milk"
              ],
              "type": "string"
            }
          },
          "required": [
            "item"
          ],
          "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:52:27 GMT
serverelb
strict-transport-securitymax-age=31536000; includeSubDomains; preload
transfer-encodingchunked
varyorigin, access-control-request-method, access-control-request-headers
via1.1 4fc932d2ede176ec3a0838233aa83ba4.cloudfront.net (CloudFront)
x-amz-cf-id7o68QO673ASe6s-_1LAvQrFaQDxhcEVbVC4TO2S99oPNvYq-fY_M2w==
x-amz-cf-popDEN53-P1
x-cacheMiss from cloudfront
x-content-type-optionsnosniff
x-ds-trace-id58dee208dc68b750204785d9ac176243
{
  "id": "a105e580-9e1b-4a9c-bff6-6804d3c23c78",
  "object": "chat.completion",
  "created": 1789336347,
  "model": "deepseek-flash",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Milk is \u00a31.20 each (note: bottles, not necessarily litres \u2014 I ordered 4 for you). Your order for 4 bottles of milk has been placed, so that's \u00a34.80 total.",
        "reasoning_content": "Answer briefly."
      },
      "logprobs": null,
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 554,
    "completion_tokens": 49,
    "total_tokens": 603,
    "prompt_tokens_details": {
      "cached_tokens": 384
    },
    "completion_tokens_details": {
      "reasoning_tokens": 3
    },
    "prompt_cache_hit_tokens": 384,
    "prompt_cache_miss_tokens": 170
  },
  "system_fingerprint": "aeb56401ca74e127821c4f9126dcb669"
}
reply
rolecontent
[0]aiMilk is £1.20 each (note: bottles, not necessarily litres — I ordered 4 for you). Your order for 4 bottles of milk has been placed, so that's £4.80 total.
state {"total_ordered": 4}
ended {"reason": "no_tool_calls"}