Description
- Have you searched for related issues? Others may have faced similar issues.
These issues are related, but don't have a resolution:
Error code: 400 "No tool output found for function call" #673
Does StopAtTools returns tool result directly to user instead of to LLM? #632
Describe the bug
Agent runs using previous_response_id fail unexpectedly and sporadically following a tool call, with an error such as "Error code: 400 - {'error': {'message': 'No tool output found for function call call_WdnUUKXKvwy3jksn4I9ERdRT.', 'type': 'invalid_request_error', 'param': 'input', 'code': None}}"
Here's how the error looks in the trace console:

The error seems to originate in the previous trace when the output from tool call is not posted back to the OpenAI API

This is also shown in logging, where there is no post to the /v1/responses
endpoint after 3: Tool data_collection_consent ended
:
2025-07-11 12:16:39.717 | INFO | farmwise.hooks:on_agent_start:18 - ### 1: Agent Onboarding Agent started. Usage: 0 requests, 0 input tokens, 0 output tokens, 0 total tokens
2025-07-11 12:16:40.318 | INFO | httpx._client:_send_handling_redirects:1695 - HTTP Request: POST https://api.openai.com/v1/responses "HTTP/1.1 200 OK"
2025-07-11 12:16:42.414 | INFO | httpx._client:_send_handling_redirects:980 - HTTP Request: POST https://api.openai.com/v1/traces/ingest "HTTP/1.1 204 No Content"
2025-07-11 12:16:46.042 | INFO | farmwise.hooks:on_tool_start:28 - ### 2: Tool data_collection_consent started. Usage: 1 requests, 2669 input tokens, 97 output tokens, 2766 total tokens
2025-07-11 12:16:46.079 | INFO | httpx._client:_send_handling_redirects:1695 - HTTP Request: POST http://127.0.0.1:8000/api/v1/default/contacts/11/consent "HTTP/1.1 200 OK"
2025-07-11 12:16:46.081 | INFO | farmwise.hooks:on_tool_end:32 - ### 3: Tool data_collection_consent ended with result consent_type='data_collection' consent_given=True consent_version='v1' id=3 contact_id=11. Usage: 1 requests, 2669 input tokens, 97 output tokens, 2766 total tokens
2025-07-11 12:16:46.081 | INFO | farmwise.hooks:on_agent_end:22 - ### 4: Agent Onboarding Agent ended with output content='Thank you for agreeing, Mark!\n\nTo get to know you better, could you tell me what best describes your main work?' actions=[] buttons=[Button(title='Farmer', callback_data='role_farmer'), Button(title='Extension Officer', callback_data='role_extension_officer'), Button(title='Other', callback_data='role_other')] section_list=None. Usage: 1 requests, 2669 input tokens, 97 output tokens, 2766 total tokens
2025-07-11 12:16:47.940 | INFO | httpx._client:_send_handling_redirects:980 - HTTP Request: POST https://api.openai.com/v1/traces/ingest "HTTP/1.1 204 No Content"
Contrast this with a working example, where there is a subsequent post to /v1/responses following the completion of the data_collection_consent tool:

2025-07-11 12:14:01.826 | INFO | farmwise.hooks:on_agent_start:18 - ### 1: Agent Onboarding Agent started. Usage: 0 requests, 0 input tokens, 0 output tokens, 0 total tokens
2025-07-11 12:14:02.454 | INFO | httpx._client:_send_handling_redirects:1695 - HTTP Request: POST https://api.openai.com/v1/responses "HTTP/1.1 200 OK"
2025-07-11 12:14:03.383 | INFO | farmwise.hooks:on_tool_start:28 - ### 2: Tool data_collection_consent started. Usage: 1 requests, 2668 input tokens, 13 output tokens, 2681 total tokens
2025-07-11 12:14:03.429 | INFO | httpx._client:_send_handling_redirects:1695 - HTTP Request: POST http://127.0.0.1:8000/api/v1/default/contacts/10/consent "HTTP/1.1 200 OK"
2025-07-11 12:14:03.430 | INFO | farmwise.hooks:on_tool_end:32 - ### 3: Tool data_collection_consent ended with result consent_type='data_collection' consent_given=True consent_version='v1' id=2 contact_id=10. Usage: 1 requests, 2668 input tokens, 13 output tokens, 2681 total tokens
2025-07-11 12:14:04.032 | INFO | httpx._client:_send_handling_redirects:1695 - HTTP Request: POST https://api.openai.com/v1/responses "HTTP/1.1 200 OK"
2025-07-11 12:14:06.967 | INFO | farmwise.hooks:on_agent_end:22 - ### 4: Agent Onboarding Agent ended with output content='Thank .... Usage: 2 requests, 5382 input tokens, 110 output tokens, 5492 total tokens
2025-07-11 12:14:07.798 | INFO | httpx._client:_send_handling_redirects:980 - HTTP Request: POST https://api.openai.com/v1/traces/ingest "HTTP/1.1 204 No Content"
2025-07-11 12:14:08.872 | INFO | httpx._client:_send_handling_redirects:980 - HTTP Request: POST https://api.openai.com/v1/traces/ingest "HTTP/1.1 204 No Content"
nb. I'm not using any tool_use_behavior
settings (ie. none of stop_on_first_tool, stop_at_tool_names or ToolsToFinalOutputResult)
Debug information
- Agents SDK version: -
v0.1.0
- Python version - Python 3.12
Repro steps
Ideally provide a minimal python script that can be run to reproduce the bug.
- Sorry, it's tricky to create a minimal reproducible example at this stage, but I will update if I can narrow down the problem.
Expected behavior
Subsequent agent runs using previous_response_id following a tool call should succeed.