Files
Giles Odigwe 6b47cdbf52 Python: Fix broken samples for GitHub Copilot, declarative, and Responses API (#4915)
* Python: Fix broken samples for GitHub Copilot, declarative, and Responses API

- Add missing on_permission_request handler to github_copilot_basic and
  github_copilot_with_session samples (required by copilot SDK)
- Increase timeout for remote MCP query in github_copilot_with_mcp sample
- Soften session isolation claim in github_copilot_with_session sample
- Fix inline_yaml sample: pass project_endpoint via client_kwargs instead
  of relying on YAML connection block (AzureAIClient expects
  project_endpoint, not endpoint)
- Handle raw JSON schemas in Responses client _convert_response_format
  so declarative outputSchema works with the Responses API

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Improve raw JSON schema detection heuristic and add tests

- Broaden raw schema detection to handle anyOf, oneOf, allOf, $ref, $defs
  keywords and JSON Schema primitive types, not just 'properties'
- Apply same raw schema handling to azure-ai _shared.py for consistency
- Add unit tests for both openai and azure-ai response_format conversion

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
6b47cdbf52 · 2026-03-27 16:27:19 +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

  1. GitHub Copilot CLI: Install and authenticate the Copilot CLI
  2. GitHub Copilot Subscription: An active GitHub Copilot subscription
  3. 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

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_multiple_permissions.py Shows how to combine multiple permission types for complex tasks that require shell, read, and write access.