Skip to content

Validation Error for ResponseTextDeltaEvent – Missing logprobs Field #1276

@Muhammad-Fraooq

Description

@Muhammad-Fraooq

📌 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 always be present — even when the API doesn’t include it in the delta. I tried using this setup, but the error consistently occurs.


🧩 Debug information

  • Agents SDK version: v0.2.3
  • Python version: 3.12.9
  • Platform: Windows 10
  • LLM provider: Using Gemini API (OpenAI compatible format)

🔁 Repro steps

Here’s a minimal reproducible example:

from agents import Runner
from openai.types.responses import ResponseTextDeltaEvent

# Example agent and prompt
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 (e.g., Optional[...] = None) in the Pydantic model to prevent validation failures for missing data.

🙋 Extra Notes

Let me know if I can assist with debugging or testing a fix — I’m currently studying and deeply exploring the OpenAI Agents SDK.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingduplicateThis issue or pull request already exists

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions