From 5273116953e5dea88d96fc82e8ed51ef9c7de7d0 Mon Sep 17 00:00:00 2001 From: Rishab Motgi Date: Mon, 18 May 2026 12:42:15 -0700 Subject: [PATCH] fix: export ShellOnApprovalFunction and ShellOnApprovalFunctionResult 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. --- examples/tools/shell.py | 2 +- src/agents/__init__.py | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/examples/tools/shell.py b/examples/tools/shell.py index 6fa97af3b0..b4ed4becd4 100644 --- a/examples/tools/shell.py +++ b/examples/tools/shell.py @@ -11,13 +11,13 @@ ShellCallOutcome, ShellCommandOutput, ShellCommandRequest, + ShellOnApprovalFunctionResult, ShellResult, ShellTool, trace, ) from agents.items import ToolApprovalItem from agents.run_context import RunContextWrapper -from agents.tool import ShellOnApprovalFunctionResult SHELL_AUTO_APPROVE = os.environ.get("SHELL_AUTO_APPROVE") == "1" diff --git a/src/agents/__init__.py b/src/agents/__init__.py index ce2f8fbca8..f345edfa2b 100644 --- a/src/agents/__init__.py +++ b/src/agents/__init__.py @@ -150,6 +150,8 @@ ShellCommandOutput, ShellCommandRequest, ShellExecutor, + ShellOnApprovalFunction, + ShellOnApprovalFunctionResult, ShellResult, ShellTool, ShellToolContainerAutoEnvironment, @@ -474,6 +476,8 @@ def enable_verbose_stdout_logging(): "ShellToolHostedEnvironment", "ShellToolEnvironment", "ShellExecutor", + "ShellOnApprovalFunction", + "ShellOnApprovalFunctionResult", "ShellResult", "ShellTool", "ApplyPatchEditor",