-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Description
Please read this first
Have you read the docs? Yes — Agents SDK docs
Have you searched for related issues? Yes — couldn’t find a matching one for this validation error.
Describe the bug
When using Runner.run_streamed() and handling the event as ResponseTextDeltaEvent, I encountered a pydantic validation error due to the logprobs field being missing in the streamed response data.
It seems the model expects logprobs to be present even when the API doesn’t include it in the streamed delta.
I tried using this, but the error still comes.
Debug information
Agents SDK version: v0.2.3
Python version: 3.12.9
Platform: Windows 11
LLM provider: Using gemini compatible API key (OpenAI compatible format)
Repro steps
Here’s a minimal reproducible script:
`bash
from agents import Runner
from openai.types.responses import ResponseTextDeltaEvent
Example agent and query
result = Runner.run_streamed(agent, "What is the capital of France?")
async for event in result.stream_events():
if event.type == "raw_response_event" and isinstance(event.data, ResponseTextDeltaEvent):
print(event.data.delta) # This line triggers the validation error
`
Actual Error
Error: 1 validation error for ResponseTextDeltaEvent
logprobs
Field required [type=missing, input_value={'content_index': 0, 'del...', 'sequence_number': 3}, input_type=dict]
For further information visit https://errors.pydantic.dev/2.11/v/missing
Expected behavior
The SDK should handle streamed delta events gracefully, even when logprobs is not included in the response payload. This field should be marked as optional (Optional[...] = None) in the model to prevent unnecessary validation failures.
Let me know if I can help with debugging or testing a fix — I’m currently studying and exploring the Agents SDK in depth.