-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Open
Labels
Description
Please read this first
- Have you read the docs? Yes, although of minimal use as they point to a nonexistent doc page that it seems like codex just invented, the link at https://openai.github.io/openai-agents-python/sessions/#openai-conversations-api-memory points to https://platform.openai.com/docs/guides/conversational-agents/conversations-api.
- Have you searched for related issues? Yeah, no other mention of the session.
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.
Ema93sh, slyapustin, arjunasokan-bc, MarianaMendanha, quartzjer and 2 more