I’m building a system with the Agents SDK using OpenAIConversationsSession, and with some models, the Runner.run() command is throwing a 400 error from the conversations api before returning the run response:
openai.BadRequestError: Error code: 400 - {'error': {'message': 'Invalid item', 'type': 'invalid_request_error', 'param': 'item', 'code': 'invalid_item'}}
I added some hooks with the AgentHooks class, so I can see that the response has already been generated. It does not error with gpt-4o-mini or gpt-4.1 for the model, but with o4-mini and gpt-5 it does error. Maybe it’s erroring for reasoning models only?
Here is my agent code:
agent = Agent(
name="MyAgent",
instructions=instructions,
model=model,
model_settings=ModelSettings(tool_choice="auto"),
)
user_message = f"User prompt:\n<user_input>{user_prompt}</user_input>"
session = OpenAIConversationsSession()
result = await Runner.run(starting_agent=agent, input=user_message, session=session)
Is there some way around this so that we can use gpt-5 or other high-performing reasoning models?