mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
57fb32efc8
* Upgrade github-copilot-sdk to v1.0.0b1 and implement new features - Bump github-copilot-sdk dependency from 0.2.1 to 1.0.0b1 - Fix breaking type renames: ErrorClass -> ToolExecutionCompleteError, Result -> ToolExecutionCompleteResult - Add instruction_directories support in GitHubCopilotOptions (session-level) - Add copilot_home support in GitHubCopilotSettings (client-level) - Add sample: github_copilot_with_instruction_directories.py - Update README with new env var and sample entry - Add 8 new unit tests covering the new features (103 total, 96% coverage) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * mypy fix * small fix * Address PR feedback: fix resume path, remove copilot_home from Options, bump to beta.2 - Forward runtime_options through _resume_session (fixes silent drop of instruction_directories/model/etc on resumed sessions) - Remove copilot_home from GitHubCopilotOptions (client-level setting only consumed at startup, not per-call) - Bump github-copilot-sdk from 1.0.0b1 to 1.0.0b2 - Add test for instruction_directories override on resumed sessions - Update existing resume test to match new _resume_session signature Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
57fb32efc8
ยท
2026-05-07 21:43:47 +00:00
History
GitHub Copilot Agent Examples
This directory contains examples demonstrating how to use the GitHubCopilotAgent from the Microsoft Agent Framework.
Security Note: These examples demonstrate various permission types (shell, read, write, url). Only enable permissions that are necessary for your use case. Each permission grants the agent additional capabilities that could affect your system.
Prerequisites
- GitHub Copilot CLI: Install and authenticate the Copilot CLI
- GitHub Copilot Subscription: An active GitHub Copilot subscription
- Install the package:
pip install agent-framework-github-copilot --pre
Environment Variables
The following environment variables can be configured:
| Variable | Description | Default |
|---|---|---|
GITHUB_COPILOT_CLI_PATH |
Path to the Copilot CLI executable | copilot |
GITHUB_COPILOT_MODEL |
Model to use (e.g., "gpt-5", "claude-sonnet-4") | Server default |
GITHUB_COPILOT_TIMEOUT |
Request timeout in seconds | 60 |
GITHUB_COPILOT_LOG_LEVEL |
CLI log level | info |
GITHUB_COPILOT_COPILOT_HOME |
Directory for CLI session state and config | ~/.copilot |
Observability
GitHubCopilotAgent has OpenTelemetry tracing built-in. To enable it, call configure_otel_providers() before running the agent:
from agent_framework.observability import configure_otel_providers
from agent_framework.github import GitHubCopilotAgent
configure_otel_providers(enable_console_exporters=True)
async with GitHubCopilotAgent() as agent:
response = await agent.run("Hello!")
See the observability samples for full examples with OTLP exporters.
Examples
| File | Description |
|---|---|
github_copilot_basic.py |
The simplest way to create an agent using GitHubCopilotAgent. Demonstrates both streaming and non-streaming responses with function tools. |
github_copilot_with_session.py |
Shows session management with automatic creation, persistence via session objects, and resuming sessions by ID. |
github_copilot_with_shell.py |
Shows how to enable shell command execution permissions. Demonstrates running system commands like listing files and getting system information. |
github_copilot_with_file_operations.py |
Shows how to enable file read and write permissions. Demonstrates reading file contents and creating new files. |
github_copilot_with_url.py |
Shows how to enable URL fetching permissions. Demonstrates fetching and processing web content. |
github_copilot_with_mcp.py |
Shows how to configure MCP (Model Context Protocol) servers, including local (stdio) and remote (HTTP) servers. |
github_copilot_with_instruction_directories.py |
Shows how to configure custom instruction directories for project-specific or team-shared guidelines. |
github_copilot_with_multiple_permissions.py |
Shows how to combine multiple permission types for complex tasks that require shell, read, and write access. |