Implement generative AI and agentic solutions 2.3 Optimize and operationalize generative AI systems
A reasoning model calls several functions in a row through the Responses API.
Study guide skill: Tune generation behavior, such as prompt engineering and adjusting model parameters
Question B4-026
A reasoning model calls several functions in a row through the Responses API. The app sends back only the function_call_output items in each follow-up request, and the model seems to restart its reasoning every time, using more tokens than expected. What should the app do?
Select one answer.
Answer: B
When a reasoning model calls functions through the Responses API, send every reasoning item, function call item, and function call output since the last user message; passing all output items with previous_response_id is the simplest way, and the model then continues the same line of reasoning in fewer tokens. Higher effort generally produces more reasoning tokens. Extracting raw reasoning outside the reasoning summary parameter isn't supported, and a low output cap can return an incomplete response.
Deep dive
How it works
Reasoning models produce reasoning items alongside their output. The reasoning text stays opaque (the API never returns it), but the items matter: when a reasoning model calls functions through the Responses API, Microsoft says to pass the reasoning items from the previous response back along with your function output.
The rule for chains of calls is specific: if the model called several functions in a row, send every reasoning item, function call item and function call output item since the last user message. The model then continues the same line of reasoning instead of starting over, and reaches a good answer in fewer tokens. That's the symptom the app has: sending only outputs makes the model rebuild its reasoning each time.
The simplest way is to pass all output items from the previous response into the next request, either with previous_response_id (when you store responses) or by copying the items into the next input array. In stateless mode, reasoning items include encrypted_content, so you can replay them without stored responses.
The other options, and when you'd use them
- Raise reasoning effort to high: Higher effort generally produces more reasoning tokens, and it doesn't restore the lost context.
- Ask the model to print its reasoning: Extracting raw reasoning other than through the reasoning summary parameter isn't supported, and may violate the Acceptable Use Policy.
- Lower max_output_tokens: If generation hits the cap, the response comes back incomplete, possibly before any visible output.
Exam tip
Reasoning model + function calls = send back reasoning items, function calls and outputs since the last user message (previous_response_id is easiest).
References
Last reviewed: