Skip to content

Conversation

ihower
Copy link
Contributor

@ihower ihower commented Sep 16, 2025

Issue

When using store=False without including reasoning.encrypted_content, any function calls (including handoff) that generate reasoning items will result in an error because the server does not persist reasoning items. This makes the Responses API difficult to use in practice.

I believe it would be better if reasoning.encrypted_content were included by default in this case, since in almost all scenarios the agent needs it when working with reasoning models and store=False.

Related issue: openai/openai-agents-python#1668

Reproducible Example

from agents import Agent, Runner, function_tool, ModelSettings

@function_tool
def get_weather(city: str) -> str:
    return "hot"

agent = Agent(
    name="Test store false",
    instructions="You are a helpful assistant.",
    model="gpt-5-mini",
    tools=[get_weather],
    model_settings=ModelSettings(store=False)
)

result = Runner.run_sync(agent, input="What's the weather in Hsinchu?")

print(result.final_output)

This results in:

Error getting response: Error code: 404 - {'error': {'message': "Item with id 'rs_xxx' not found. Items are not persisted when `store` is set to false. Try again with `store` set to true, or remove this item from your input.", 'type': 'invalid_request_error', 'param': 'input', 'code': None}}. 

Fix

  • When model_settings.response_include is None and model_settings.store is False, automatically add "reasoning.encrypted_content" to the include set.
  • This change makes it easier for developers using gpt-5, since they no longer need to worry about missing reasoning data when store=False.

@seratch
Copy link
Member

seratch commented Sep 17, 2025

@codex review this

Copy link
Member

@seratch seratch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the suggestion but I don't think this is robust enough

include_set.update(model_settings.response_include)

if model_settings.store is False and model_settings.response_include is None:
include_set.add("reasoning.encrypted_content")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

non-reasoning models such as gpt-4.1 do not require this (actually it does not work), so always having this does not work. why don't you manually add this option to include?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right, I forgot to consider that GPT-4.1 would throw errors, and this solution will cause breaking changes, which is not good. However, I do hope there’s a better way to help developers realize that when Store=False, they need to include reasoning.encrypted_content, otherwise GitHub issues will keep showing up.

@seratch seratch marked this pull request as draft September 17, 2025 05:07
Copy link

Codex Review: Didn't find any major issues. More of your lovely PRs please.

About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you open a pull request for review, mark a draft as ready, or comment "@codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex fix this CI failure" or "@codex address that feedback".

@ihower ihower closed this Sep 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants