---
type: email
from: Mazz_Ather <notifications@github.com>
subject: [openai/openai-agents-python] Fix TypeError when instantiating

 ChatCompletionMessageToolCallParam due to typing.Union (PR #1419)
received: 2026-03-05 09:58:05
date_header: Mon, 11 Aug 2025 03:06:30 -0700
priority: high
status: awaiting_approval
uid: 27153
---

## Email Content

**From:** Mazz_Ather <notifications@github.com>
**Subject:** [openai/openai-agents-python] Fix TypeError when instantiating

 ChatCompletionMessageToolCallParam due to typing.Union (PR #1419)
**Date:** Mon, 11 Aug 2025 03:06:30 -0700

### Body (preview)

This fixes the error &quot;TypeError: Cannot instantiate typing.Union&quot; that happens in recent openai-python versions (e.g., 1.99.3+). The param type is a Union, so it can&#39;t be created directly. Changed to use a dict, which works with the API.



Tested with my own agent code that was failing—now it runs fine without downgrading openai.



Related to openai/openai-python issues like #2529 or #2541 (if they exist; I couldn&#39;t find exact matches, but similar problems reported).



Thanks!

You can view, comment on, or merge this pull request online at:



  https://github.com/openai/openai-agents-python/pull/1419



-- Commit Summary --



  * Fix TypeError: Cannot instantiate typing.Union in ChatCompletionMessageToolCallParam by using dict workaround



-- File Changes --



    M src/agents/models/chatcmpl_converter.py (16)



-- Patch Links --



https://github.com/openai/openai-agents-python/pull/1419.patch

https://github.com/openai/openai-agents-python/pull/1419.diff



-- 

Reply to this email directly or view it on GitHub:

https://github.com/openai/openai-agents-python/pull/1419

You are receiving this because you are subscribed to this thread.



Message ID: &lt;openai/openai-agents-python/pull/1419@github.com&gt;

---

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