Follow-up to #6671 (.NET).
The Python agent-framework-github-copilot provider currently enforces function approval itself: it wraps every FunctionTool in an SDK tool-handler that, for tools declared with approval_mode="always_require", awaits an on_function_approval callback before executing (denying by default when none is configured).
Since the GitHub Copilot SDK already provides a native pre-execution hook (on_pre_tool_use) that can return "ask" and route to on_permission_request, this AF-level callback duplicates SDK functionality. For consistency with the .NET provider (see #6671), Python should adopt the same model:
- Install a default
on_pre_tool_use hook (only when the user hasn't supplied their own) that returns "ask" for approval_mode="always_require" tools and defers otherwise.
- If the user supplies their own
on_pre_tool_use, theirs takes precedence; document it and log a warning when an approval-required tool would go unenforced.
- Remove the bespoke
on_function_approval enforcement path.
Scope
python/packages/github_copilot/agent_framework_github_copilot/_agent.py
- Update tests and the package docs accordingly.
Follow-up to #6671 (.NET).
The Python
agent-framework-github-copilotprovider currently enforces function approval itself: it wraps everyFunctionToolin an SDK tool-handler that, for tools declared withapproval_mode="always_require", awaits anon_function_approvalcallback before executing (denying by default when none is configured).Since the GitHub Copilot SDK already provides a native pre-execution hook (
on_pre_tool_use) that can return"ask"and route toon_permission_request, this AF-level callback duplicates SDK functionality. For consistency with the .NET provider (see #6671), Python should adopt the same model:on_pre_tool_usehook (only when the user hasn't supplied their own) that returns"ask"forapproval_mode="always_require"tools and defers otherwise.on_pre_tool_use, theirs takes precedence; document it and log a warning when an approval-required tool would go unenforced.on_function_approvalenforcement path.Scope
python/packages/github_copilot/agent_framework_github_copilot/_agent.py