Skip to content

fix: export ShellOnApprovalFunction and ShellOnApprovalFunctionResult from public API#3450

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

fix: export ShellOnApprovalFunction and ShellOnApprovalFunctionResult from public API#3450
rmotgi1227 wants to merge 1 commit into
openai:mainfrom
rmotgi1227:fix/export-shell-approval-types

Conversation

@rmotgi1227
Copy link
Copy Markdown

Summary

ShellTool accepts an on_approval callback typed as ShellOnApprovalFunction, and that callback must return ShellOnApprovalFunctionResult. Neither type was exported from the agents package — callers had to import directly from the private agents.tool module.

Before (workaround required):

from agents.tool import ShellOnApprovalFunctionResult  # private module

After:

from agents import ShellOnApprovalFunctionResult  # public API

Changes

  • src/agents/__init__.py: Add ShellOnApprovalFunction and ShellOnApprovalFunctionResult to the imports from .tool and to __all__, alongside the other Shell types already exported there.
  • examples/tools/shell.py: Update the example to import ShellOnApprovalFunctionResult from agents instead of agents.tool.

Why this matters

ShellOnApprovalFunctionResult is a TypedDict that users must construct and return in their on_approval handler. Without a public export, type checkers point users to private internals, and the type does not appear in help(agents) or IDE auto-complete.

… from public API

ShellTool accepts an on_approval callback typed as ShellOnApprovalFunction,
and the callback must return ShellOnApprovalFunctionResult. Neither type was
exported from the agents package, forcing callers to import from the private
agents.tool module.

Export both types from agents.__init__ alongside the other Shell types, and
update examples/tools/shell.py to import from agents instead of agents.tool.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants