One potential cause of “Item ‘rs_xx’ of type ‘reasoning’ was provided without its required following item.” error. Stateless, using Agents SDK

Overview

I work on an agent which uses the OpenAI Agents SDK and GPT-5.

We manage state ourselves and I recently did some work to make sure we included reasoning items in the chain of previous messages we send to the API. I could not get this to work for quite some time, running into this error and wanted to share what fixed it for me in case anyone else runs into it. Lots of other threads on this but the root cause seems to vary on each.

“Item ‘rs_xx’ of type ‘reasoning’ was provided without its required following item.”

What worked

In order to get the reasoning items we added this to the API call include=["reasoning.encrypted_content"] If using the Agents SDK, you do this as part of the ModelSettings param.

Then started getting the reasoning items back. Key is to store these with the reasoning_id rs_XX.. and the encrypted content.

Then when using these in the future I just needed a message in the chain of this format:

"type": "reasoning",
"id": chat.reasoning_id, #assuming you store this way
"encrypted_content": chat.content,
"summary": [],  # Empty array is valid for replay

But this did not work and I got the error above.

Solution

After a bunch of trial and error, the solution was very simple. In our ModelSettings, I just needed store=False.

We should have had this from the start but it turns out you can still use the responses API statelessly without explicitly setting that - we just sent the array of messages and didn’t send a previous_response_id and it figured it out (not sure if done at the agents sdk or api layer).

However, once the reasoning items were involved, it broke.

So if you are trying to include reasoning items in your message history and you are operating statelessly (storing message history yourself), make sure you set store=False

Note: