---
type: email
from: "chatgpt-codex-connector[bot]" <notifications@github.com>
subject: Re: [openai/openai-agents-python] fix: validate tool types in

 Agent.tools list to prevent runtime AttributeError (fixes #1443) (PR #1974)
received: 2026-03-06 08:13:30
date_header: Wed, 22 Oct 2025 08:20:31 -0700
priority: normal
status: awaiting_approval
uid: 33448
---

## Email Content

**From:** "chatgpt-codex-connector[bot]" <notifications@github.com>
**Subject:** Re: [openai/openai-agents-python] fix: validate tool types in

 Agent.tools list to prevent runtime AttributeError (fixes #1443) (PR #1974)
**Date:** Wed, 22 Oct 2025 08:20:31 -0700

### Body (preview)

@chatgpt-codex-connector[bot] commented on this pull request.





### 💡 Codex Review



Here are some automated review suggestions for this pull request.

    



<details> <summary>ℹ️ About Codex in GitHub</summary>

<br/>



[Your team has set up Codex to review pull requests in this repo](http://chatgpt.com/codex/settings/general). Reviews are triggered when you

- Open a pull request for review

- Mark a draft as ready

- Comment "@codex review".



If Codex has suggestions, it will comment; otherwise it will react with 👍.









Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

            

</details>



> +        # Validate each tool is a valid Tool type

+        for i, tool in enumerate(self.tools):

+            if not isinstance(

+                tool,

+                (

+                    FunctionTool,

+                    FileSearchTool,

+                    WebSearchTool,

+                    ComputerTool,

+                    LocalShellTool,

+                    ImageGenerationTool,

+                    CodeInterpreterTool,

+                    Handoff,

+                ),



**<sub><sub>![P1 Badge](https://img.shields.io/badge/P1-orange?style=flat)</sub></sub>  Allow HostedMCPTool in tools validation**



The new `__post_init__` check enumerates acceptable tool classes but omits `HostedMCPTool`, even though `Agent.tools` is typed as `list[Tool]` and `Tool` already includes `HostedMCPTool`. Any existing agent that supplies a hosted MCP tool (previously valid) will now fail initialization with `UserError`, breaking integrations that rely on hosted MCP servers. Consider either checking `isinstance(tool, Tool)` or adding `HostedMCPTool` to the tuple so valid tools continue to pass.



Useful? React with 👍 / 👎.



-- 

Reply to this email directly or view it on GitHub:

https://github.com/openai/openai-agents-python/pull/1974#pullrequestreview-3366322196

You are receiving this because you a

---

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