Skip to content

fix: export ApplyPatchTool and CustomTool approval callback types from top-level package#3491

Closed
rmotgi1227 wants to merge 1 commit into
openai:mainfrom
rmotgi1227:fix/export-tool-approval-types
Closed

fix: export ApplyPatchTool and CustomTool approval callback types from top-level package#3491
rmotgi1227 wants to merge 1 commit into
openai:mainfrom
rmotgi1227:fix/export-tool-approval-types

Conversation

@rmotgi1227
Copy link
Copy Markdown
Contributor

ApplyPatchTool and CustomTool each accept an on_approval callback, and ComputerTool accepts an on_safety_check callback. The types needed to annotate those callbacks are not exported from the top-level agents package:

  • ApplyPatchOnApprovalFunction / ApplyPatchOnApprovalFunctionResult
  • CustomToolOnApprovalFunction / CustomToolOnApprovalFunctionResult
  • ComputerToolSafetyCheckData

The equivalent MCP types (MCPToolApprovalFunction, MCPToolApprovalFunctionResult) are already exported. This extends that to the remaining tool types.

# currently breaks — have to reach into private agents.tool module:
from agents import ComputerToolSafetyCheckData   # ImportError
from agents import ApplyPatchOnApprovalFunction  # ImportError
from agents import CustomToolOnApprovalFunction  # ImportError

Related to #3450 which exports the Shell equivalents.

@seratch
Copy link
Copy Markdown
Member

seratch commented May 22, 2026

hmm, we'd like to hold off adding these as they are not commonly used plus developers can still import from agents.tool.

@seratch seratch closed this May 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants