ch13_workflow

show:
mock turns=8 · messages=0
live turns=8 · messages=0
scenario single_step
scenario single_step · 0.1ms · 1 step · ended: 6 in stock
step check_stock · kind=function · 0.0ms · given: item=chips · returned: 6
args {"item": "chips"}
result {"value": 6}
ended {"reason": "6 in stock"}
scenario single_step · 0.2ms · 1 step · ended: 6 in stock
step check_stock · kind=function · 0.0ms · given: item=chips · returned: 6
args {"item": "chips"}
result {"value": 6}
ended {"reason": "6 in stock"}
scenario dual_in_sequence
scenario dual_in_sequence · 0.0ms · 2 steps · ended: discounted to 1.08
step get_price · kind=function · 0.0ms · given: item=milk · returned: 1.20
args {"item": "milk"}
result {"value": "1.20"}
step apply_discount · kind=function · 0.0ms · given: price=1.20 · returned: 1.08
args {"price": "1.20"}
result {"value": "1.08"}
ended {"reason": "discounted to 1.08"}
scenario dual_in_sequence · 0.0ms · 2 steps · ended: discounted to 1.08
step get_price · kind=function · 0.0ms · given: item=milk · returned: 1.20
args {"item": "milk"}
result {"value": "1.20"}
step apply_discount · kind=function · 0.0ms · given: price=1.20 · returned: 1.08
args {"price": "1.20"}
result {"value": "1.08"}
ended {"reason": "discounted to 1.08"}
scenario three_steps_reserves
scenario three_steps_reserves · 0.0ms · 2 steps · ended: reserved 2 x milk
step check_stock · kind=function · 0.0ms · given: item=milk · returned: 2
args {"item": "milk"}
result {"value": 2}
step reserve_stock · kind=function · 0.0ms · given: item=milk, quantity=2 · returned: reserved 2 x milk
args {"item": "milk", "quantity": 2}
result {"value": "reserved 2 x milk"}
ended {"reason": "reserved 2 x milk"}
scenario three_steps_reserves · 0.0ms · 2 steps · ended: reserved 2 x milk
step check_stock · kind=function · 0.0ms · given: item=milk · returned: 2
args {"item": "milk"}
result {"value": 2}
step reserve_stock · kind=function · 0.0ms · given: item=milk, quantity=2 · returned: reserved 2 x milk
args {"item": "milk", "quantity": 2}
result {"value": "reserved 2 x milk"}
ended {"reason": "reserved 2 x milk"}
scenario three_steps_backorders
scenario three_steps_backorders · 0.0ms · 2 steps · ended: backordered 5 x milk
step check_stock · kind=function · 0.0ms · given: item=milk · returned: 2
args {"item": "milk"}
result {"value": 2}
step create_backorder · kind=function · 0.0ms · given: item=milk, quantity=5 · returned: backordered 5 x milk
args {"item": "milk", "quantity": 5}
result {"value": "backordered 5 x milk"}
ended {"reason": "backordered 5 x milk"}
scenario three_steps_backorders · 0.0ms · 2 steps · ended: backordered 5 x milk
step check_stock · kind=function · 0.0ms · given: item=milk · returned: 2
args {"item": "milk"}
result {"value": 2}
step create_backorder · kind=function · 0.0ms · given: item=milk, quantity=5 · returned: backordered 5 x milk
args {"item": "milk", "quantity": 5}
result {"value": "backordered 5 x milk"}
ended {"reason": "backordered 5 x milk"}
scenario a_step_can_be_an_agent
scenario a_step_can_be_an_agent · 4.8ms · 1 step · ended: Milk is 1.20 per bottle.
step check_price_via_agent · kind=agent · 4.8ms · given: item=milk · returned: Milk is 1.20 per bottle.
args {"item": "milk"}
turn 1 · 4.6ms · asked for: price_of
model mock · 4.3ms · asked for: price_of
context sent — 2 message(s)
rolecontent
[0]systemYou answer briefly and plainly. Use the tool you are given.
[1]humanHow much is milk?
declared tools (1)
tooldescriptionschema
price_ofThe current shelf price of an item, in pounds. The agent-kind step's only tool.{"$defs": {"GroceryItem": {"enum": ["bread", "butter", "chips", "milk"], "type": "string"}}, "description": "The current shelf price of an item, in pounds. The agent-kind step's only tool.", "properties": {"item": {"$ref": "#/$defs/GroceryItem"}}, "required": ["item"], "title": "price_of", "type": "object"}
tools declared to the mock model {"names": ["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.2ms · given: item=milk · returned: 1.20 for milk
args {"item": "milk"}
result {"value": "1.20 for milk"}
turn 2 · 0.2ms · responded with: Milk is 1.20 per bottle.
model mock · 0.2ms · responded with: Milk is 1.20 per bottle.
context sent — 4 message(s)
rolecontent
[0]systemYou answer briefly and plainly. Use the tool you are given.
[1]humanHow much is milk?
[2]ai
price_of({"item": "milk"})
[3]tool1.20 for milk
declared tools (1)
tooldescriptionschema
price_ofThe current shelf price of an item, in pounds. The agent-kind step's only tool.{"$defs": {"GroceryItem": {"enum": ["bread", "butter", "chips", "milk"], "type": "string"}}, "description": "The current shelf price of an item, in pounds. The agent-kind step's only tool.", "properties": {"item": {"$ref": "#/$defs/GroceryItem"}}, "required": ["item"], "title": "price_of", "type": "object"}
tools declared to the mock model {"names": ["price_of"], "consulted": false}
context ignored by the mock model {"messages": 4, "roles": ["system", "human", "ai", "tool"]}
reply
rolecontent
[0]aiMilk is 1.20 per bottle.
result {"value": "Milk is 1.20 per bottle."}
ended {"reason": "Milk is 1.20 per bottle."}
scenario a_step_can_be_an_agent · 1440.4ms · 1 step · ended: Milk is £1.20.
step check_price_via_agent · kind=agent · 1440.4ms · given: item=milk · returned: Milk is £1.20.
args {"item": "milk"}
turn 1 · 855.5ms · 336 in / 48 out · asked for: price_of
model live · 854.5ms (model provider 670.4 · library 184.1) · 336 in / 48 out · asked for: price_of
context sent — 2 message(s)
rolecontent
[0]systemYou answer briefly and plainly. Use the tool you are given.
[1]humanHow much is milk?
declared tools (1)
tooldescriptionschema
price_ofThe current shelf price of an item, in pounds. The agent-kind step's only tool.{"$defs": {"GroceryItem": {"enum": ["bread", "butter", "chips", "milk"], "type": "string"}}, "description": "The current shelf price of an item, in pounds. The agent-kind step's only tool.", "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-length479
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 tool you are given.",
      "role": "system"
    },
    {
      "content": "How much is milk?",
      "role": "user"
    }
  ],
  "model": "deepseek-flash",
  "stream": false,
  "tools": [
    {
      "type": "function",
      "function": {
        "name": "price_of",
        "description": "The current shelf price of an item, in pounds. The agent-kind step's only tool.",
        "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:41 GMT
serverelb
strict-transport-securitymax-age=31536000; includeSubDomains; preload
transfer-encodingchunked
varyorigin, access-control-request-method, access-control-request-headers
via1.1 422414d66021e4e123bcb2b5087f7042.cloudfront.net (CloudFront)
x-amz-cf-idZK4pabzUvgg7Cl7vEPzEQGVRa2jOmnozYuka2NaWbSTT4dal_nZiSA==
x-amz-cf-popDEN52-P2
x-cacheMiss from cloudfront
x-content-type-optionsnosniff
x-ds-trace-id28335bb989372ea3840c2ee29656e1e8
{
  "id": "9fedd2fd-54ef-4c82-aa30-b705ad615ad6",
  "object": "chat.completion",
  "created": 1789336361,
  "model": "deepseek-flash",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "",
        "reasoning_content": "User asks price of milk. Call tool.",
        "tool_calls": [
          {
            "index": 0,
            "id": "call_00_IkwCp4Q3bIsmBDoIjM0B1925",
            "type": "function",
            "function": {
              "name": "price_of",
              "arguments": "{\"item\": \"milk\"}"
            }
          }
        ]
      },
      "logprobs": null,
      "finish_reason": "tool_calls"
    }
  ],
  "usage": {
    "prompt_tokens": 336,
    "completion_tokens": 48,
    "total_tokens": 384,
    "prompt_tokens_details": {
      "cached_tokens": 128
    },
    "completion_tokens_details": {
      "reasoning_tokens": 9
    },
    "prompt_cache_hit_tokens": 128,
    "prompt_cache_miss_tokens": 208
  },
  "system_fingerprint": "aeb56401ca74e127821c4f9126dcb669"
}
reply
rolecontent
[0]ai
price_of({"item": "milk"})
tool price_of · 0.9ms · given: item=milk · returned: 1.20 for milk
args {"item": "milk"}
result {"value": "1.20 for milk"}
turn 2 · 584.8ms · 401 in / 9 out · responded with: Milk is £1.20.
model live · 584.8ms (model provider 574.5 · library 10.3) · 401 in / 9 out · responded with: Milk is £1.20.
context sent — 4 message(s)
rolecontent
[0]systemYou answer briefly and plainly. Use the tool you are given.
[1]humanHow much is milk?
[2]ai
price_of({"item": "milk"})
[3]tool1.20 for milk
declared tools (1)
tooldescriptionschema
price_ofThe current shelf price of an item, in pounds. The agent-kind step's only tool.{"$defs": {"GroceryItem": {"enum": ["bread", "butter", "chips", "milk"], "type": "string"}}, "description": "The current shelf price of an item, in pounds. The agent-kind step's only tool.", "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-length806
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 tool you are given.",
      "role": "system"
    },
    {
      "content": "How much is milk?",
      "role": "user"
    },
    {
      "content": null,
      "role": "assistant",
      "tool_calls": [
        {
          "type": "function",
          "id": "call_00_IkwCp4Q3bIsmBDoIjM0B1925",
          "function": {
            "name": "price_of",
            "arguments": "{\"item\": \"milk\"}"
          }
        }
      ],
      "reasoning_content": "User asks price of milk. Call tool."
    },
    {
      "content": "1.20 for milk",
      "role": "tool",
      "tool_call_id": "call_00_IkwCp4Q3bIsmBDoIjM0B1925"
    }
  ],
  "model": "deepseek-flash",
  "stream": false,
  "tools": [
    {
      "type": "function",
      "function": {
        "name": "price_of",
        "description": "The current shelf price of an item, in pounds. The agent-kind step's only tool.",
        "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:42 GMT
serverelb
strict-transport-securitymax-age=31536000; includeSubDomains; preload
transfer-encodingchunked
varyorigin, access-control-request-method, access-control-request-headers
via1.1 a2d53e5681632128f329f3657122d00e.cloudfront.net (CloudFront)
x-amz-cf-idJL57dmx4ohfSpM4pmDWyEuN7tOooP_czzpwLmh-gn8skxaW1x6RROw==
x-amz-cf-popDEN53-P2
x-cacheMiss from cloudfront
x-content-type-optionsnosniff
x-ds-trace-id0386e426123dee0931817fcde498b32e
{
  "id": "88b20340-dd0b-4621-8b38-d50023b4b4fb",
  "object": "chat.completion",
  "created": 1789336362,
  "model": "deepseek-flash",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Milk is \u00a31.20.",
        "reasoning_content": ""
      },
      "logprobs": null,
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 401,
    "completion_tokens": 9,
    "total_tokens": 410,
    "prompt_tokens_details": {
      "cached_tokens": 256
    },
    "completion_tokens_details": {
      "reasoning_tokens": 0
    },
    "prompt_cache_hit_tokens": 256,
    "prompt_cache_miss_tokens": 145
  },
  "system_fingerprint": "aeb56401ca74e127821c4f9126dcb669"
}
reply
rolecontent
[0]aiMilk is £1.20.
result {"value": "Milk is \u00a31.20."}
ended {"reason": "Milk is \u00a31.20."}