---
type: email
from: Wen-Tien Chang <notifications@github.com>
subject: [openai/openai-agents-python] Make Tool Output dict conversion

 stricter to improve backward compatibility (PR #1965)
received: 2026-03-06 08:11:56
date_header: Tue, 21 Oct 2025 07:14:04 -0700
priority: normal
status: awaiting_approval
uid: 33309
---

## Email Content

**From:** Wen-Tien Chang <notifications@github.com>
**Subject:** [openai/openai-agents-python] Make Tool Output dict conversion

 stricter to improve backward compatibility (PR #1965)
**Date:** Tue, 21 Oct 2025 07:14:04 -0700

### Body (preview)

Resolves https://github.com/openai/openai-agents-python/issues/1930



## Background



Before v0.4.0, all function tool outputs were converted to string.

Starting from v0.4.0 https://github.com/openai/openai-agents-python/pull/1898, function tool outputs can now return a `dict` and the SDK attempts to convert into one of the `ValidToolOutputPydanticModels` = `Union[ToolOutputText, ToolOutputImage, ToolOutputFileContent]`.



## Problem



However, the current dict conversation is **too permissive**: returning **any dict or list** can trigger breaking behavior such as https://github.com/openai/openai-agents-python/issues/1930.



For example, the following function output has **no intention** of returning an image:



```python

{ &quot;msg&quot;: &quot;foobar&quot; }

```



but it gets converted into:



```python

{ &quot;type&quot;: &quot;image&quot;, &quot;image_url&quot;: None, &quot;file_id&quot;: None }

```



Similarly, this list:



```python

[

  { &quot;product_id&quot;: 1 },

  { &quot;product_id&quot;: 2 }

]

```



is also converted into:



```python

[

  { &quot;type&quot;: &quot;image&quot;, &quot;image_url&quot;: None, &quot;file_id&quot;: None },

  { &quot;type&quot;: &quot;image&quot;, &quot;image_url&quot;: None, &quot;file_id&quot;: None }

]

```



All of these cases cause API error:  



```

Error code: 400 - {&#39;error&#39;: {&#39;message&#39;: &quot;Missing mutually exclusive parameters: &#39;input[2].output[0]&#39;. Ensure you are providing exactly one of: &#39;file_id&#39; or &#39;image_url&#39;.&quot;, &#39;type&#39;: &#39;invalid_request_error&#39;, &#39;param&#39;: &#39;input[2].output[0]&#39;, &#39;code&#39;: &#39;missing_mutually_exclusive_parameters&#39;}}

```



## Solution



This PR refines the dict conversion logic to make `_maybe_get_output_as_structured_function_output` more accurate and stricter.



A dict will now only be converted into a structured output if both conditions are met:



1. The dict must include a

---

## Suggested Actions
- [ ] Reply
- [ ] Archive
- [ ] Escalate
