Skip to content

Python: [Bug]: Every agent response fails with a Pydantic ValidationError #7048

Closed

Description

@subhrm

Description

What happened

Every agent response fails with a Pydantic ValidationError. The aggregate_to_response method in _mapper.py constructs InputTokensDetails(cached_tokens=0) — but openai-python added cache_write_tokens as a required field, so instantiation throws and the entire streaming execution aborts.

1 validation error for InputTokensDetails
cache_write_tokens
  Field required [type=missing, input_value={'cached_tokens': 0}, input_type=dict]

Affected file: agent_framework_devui/_mapper.py lines 402, 415, 1872.

What we expected

Agent responses complete successfully and stream back to the client without error.

Steps to reproduce

  1. Install agent-framework-devui==1.0.0b260709
  2. Run the devui server and submit any agent request
  3. Observe ValidationError: cache_write_tokens Field required in logs, no response returned to client

Code Sample

Error Messages / Stack Traces

Package Versions

agent-framework-devui==1.0.0b260709

Python Version

Python 3.14

Additional Context

No response

Activity

  1. added
    pythonUsage: [Issues, PRs], Target: Python
    triageUsage: [Issues], Target: All issues that still need to be triaged
    on Jul 10, 2026
  2. changed the title [-]Python: [Bug]:[/-] [+]Python: [Bug]: Every agent response fails with a Pydantic ValidationError[/+] on Jul 10, 2026
  3. added
    reproducedUsage: [Issues], Target: all issues that can be reproduced by the triage workflow
    on Jul 10, 2026
  4. github-actions commented on Jul 10, 2026

    @github-actions
    Contributor

    🤖 Automated triage reproduction notes (agent-authored — trust but verify)

    Agent analysis

    Repro: InputTokensDetails(cached_tokens=0) at python/packages/devui/agent_framework_devui/_mapper.py lines 402, 415, and 1872 raises pydantic.ValidationError because openai>=2.45.0 added cache_write_tokens as a required field on openai.types.responses.response_usage.InputTokensDetails. Minimal repro: from openai.types.responses.response_usage import InputTokensDetails; InputTokensDetails(cached_tokens=0) — fix by adding cache_write_tokens=0 at all three sites.

    • Failing test: python/packages/devui/tests/devui/test_input_tokens_details_bug_7048.py
    • Files examined: python/packages/devui/agent_framework_devui/_mapper.py, python/packages/devui/agent_framework_devui/models/init.py, python/packages/devui/pyproject.toml
    • Tests run: python/packages/devui/tests/devui/test_input_tokens_details_bug_7048.py
    • Reported version: 1.0.0b260709
    • Current version: 1.0.0b260709
  5. removed
    triageUsage: [Issues], Target: All issues that still need to be triaged
    on Jul 10, 2026
  6. subhrm commented on Jul 11, 2026

    @subhrm
    Author

    Fixed by #7046

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

pythonUsage: [Issues, PRs], Target: PythonreproducedUsage: [Issues], Target: all issues that can be reproduced by the triage workflow

Type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions