GitHub Copilot integration for Microsoft Agent Framework.
Actively maintained. Last release 3 weeks ago. A safe choice.
pip install agent-framework-github-copilotGet Started with Microsoft Agent Framework GitHub Copilot
Please install this package via pip:
pip install agent-framework-github-copilot
GitHub Copilot Agent
The GitHub Copilot agent enables integration with GitHub Copilot, allowing you to interact with Copilot's agentic capabilities through the Agent Framework.
The agent requires GitHub Copilot CLI version 1.0.85 or higher. When the agent starts, it checks the CLI version
and raises an error if the version is older or cannot be determined. This applies to the CLI bundled with the
github-copilot-sdk package as well as one selected with cli_path, GITHUB_COPILOT_CLI_PATH, or COPILOT_CLI_PATH.
Context providers and function middleware
Context providers can contribute messages, instructions, and tools to a run.
GitHubCopilotAgent supports agent middleware, but the SDK owns its tool-calling loop
and does not run Agent Framework function middleware. If a context provider contributes
function middleware through SessionContext.extend_middleware(), the run raises
MiddlewareException before creating or resuming an SDK session or registering its tools.
This applies to both response modes and to RawGitHubCopilotAgent.
Use Agent with a chat client when provider-contributed function middleware is required.
Tool approval (approval_mode="always_require")
The GitHub Copilot SDK owns the tool-calling loop for this provider, so approval for custom function tools is enforced through the SDK's native pre-execution hook rather than the standard Agent Framework approval round-trip.
When you register a FunctionTool declared with approval_mode="always_require" and you
do not supply your own on_pre_tool_use hook, GitHubCopilotAgent installs a default
on_pre_tool_use hook that returns "ask" for that tool and defers (None) for all other
tools. The "ask" decision routes to your on_permission_request handler, where you
approve or deny the call. Other session hooks, such as on_post_tool_use or
on_session_start, are preserved alongside this default approval hook:
from agent_framework import tool
from agent_framework.github import GitHubCopilotAgent, GitHubCopilotOptions
from copilot.session import PermissionHandler
@tool(approval_mode="always_require")
def delete_file(path: str) -> str:
"""Delete a file."""
...
agent = GitHubCopilotAgent(
tools=[delete_file],
# The "ask" decision is routed here; approve or deny the call.
default_options=GitHubCopilotOptions(on_permission_request=PermissionHandler.approve_all),
)