Files
agent-framework/python/packages/core/tests
T
Eduard van Valkenburg f94a75daa5 Python: Fix response_format crash on background polling with empty text (#5146)
* Guard against empty text in _parse_structured_response_value (#5145)

When using response_format with background=True (Responses API), polling
an in-progress response produces empty text. _parse_structured_response_value
unconditionally passed this to model_validate_json/json.loads, causing
ValidationError or JSONDecodeError.

Add an early return of None when text is empty, matching the existing
guard for response_format=None. This allows .value to safely return None
for in-progress background responses.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Python: Fix `response_format` crash on background polling with empty text

Fixes #5145

---------

Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
f94a75daa5 ยท 2026-04-07 22:26:03 +00:00
History
..