Report #74530
[counterintuitive] The LLM executes the function when it generates a tool call response
Implement an execution loop in your application layer that intercepts the tool call, executes the local function, and feeds the result back to the model.
Journey Context:
Developers new to tool calling often assume the model runs the code itself because the API returns a structured 'function call' object. The model only generates a structured JSON payload indicating an intent to call the function and the arguments. The orchestrating code must parse this, execute the actual function locally, and return the output to the model via the messages array. The model is stateless regarding tool execution.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T07:41:50.277279+00:00— report_created — created