Skip to content

OpenAIConversationSession doesn't work with reasoning models #1709

@jacksonrnewhouse

Description

@jacksonrnewhouse

Please read this first

Describe the bug

You get an opaque error like

Error: Error code: 400 - {'error': {'message': 'Invalid item', 'type': 'invalid_request_error', 'param': 'item', 'code': 'invalid_item'}}

It turns out to be due to sending reasoning contents, which the conversation API does not like. I patched the library to print out the items and this was problematic

[{'content': 'Hello', 'role': 'user'}, {'id': 'rs_68c1c3694bf88195bbb478a8bc9b059f07382c9e416afbdf', 'summary': [], 'type': 'reasoning'}, {'id': 'msg_68c1c36a1b88819593c15df26da4a17007382c9e416afbdf', 'content': [{'annotations': [], 'text': 'Hello! How can I help you today?', 'type': 'output_text', 'logprobs': []}], 'role': 'assistant', 'status': 'completed', 'type': 'message'}]

Debug information

  • Agents SDK version: v0.2.11
  • Python version Python 3.12.6

Repro steps

#!/usr/bin/env python
import asyncio
from agents import Agent, Runner, OpenAIConversationsSession

async def test():
    agent = Agent(name="test", model="gpt-5", instructions="You are a helpful assistant.")
    session = OpenAIConversationsSession()
    runner = Runner()
    
    try:
        result = await runner.run(agent, "Hello", session=session)
        print(f"Success: {result.final_output}")
    except Exception as e:
        print(f"Error: {e}")

asyncio.run(test())

Expected behavior

It should work like the other sessions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions