Python: Updated instructions/system_message logic in GitHub Copilot agent#3625
Merged
dmytrostruk merged 4 commits intomicrosoft:mainfrom Feb 3, 2026
Merged
Conversation
Member
Member
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds an instructions parameter to the GitHubCopilotAgent constructor and implements configurable system_message mode (append/replace) for the GitHub Copilot agent integration. The changes align the API with other agents in the framework (like ClaudeAgent) and resolve issue #3571.
Changes:
- Added
instructionsparameter toGitHubCopilotAgentconstructor that maps tosystem_message.content - Updated
GitHubCopilotOptionsto usesystem_messagewith configurable mode instead of plaininstructionsstring - Implemented runtime options support in session creation to allow overriding system_message per request
- Updated all sample code to use the new API pattern with
instructionsas a direct parameter - Added comprehensive test coverage for the new functionality including precedence rules and runtime overrides
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| python/packages/github_copilot/agent_framework_github_copilot/_agent.py | Core implementation: added instructions parameter, _prepare_system_message() method, runtime options support in session creation, and updated GitHubCopilotOptions TypedDict |
| python/packages/github_copilot/tests/test_github_copilot_agent.py | Added comprehensive tests for instructions parameter, system_message configuration, precedence rules, and runtime options |
| python/samples/getting_started/agents/github_copilot/github_copilot_basic.py | Updated to use instructions parameter and added runtime_options_example demonstrating system_message override |
| python/samples/getting_started/agents/github_copilot/github_copilot_with_session.py | Updated to use instructions parameter and removed unnecessary GitHubCopilotOptions import |
| python/samples/getting_started/agents/github_copilot/github_copilot_with_mcp.py | Updated to use instructions parameter with mcp_servers in default_options |
| python/samples/getting_started/agents/github_copilot/github_copilot_with_url.py | Updated to use instructions parameter and simplified agent initialization |
| python/samples/getting_started/agents/github_copilot/github_copilot_with_shell.py | Updated to use instructions parameter and simplified agent initialization |
| python/samples/getting_started/agents/github_copilot/github_copilot_with_file_operations.py | Updated to use instructions parameter and simplified agent initialization |
| python/samples/getting_started/agents/github_copilot/github_copilot_with_multiple_permissions.py | Updated to use instructions parameter and simplified agent initialization |
TaoChenOSU
approved these changes
Feb 2, 2026
giles17
approved these changes
Feb 2, 2026
github-merge-queue bot
pushed a commit
that referenced
this pull request
Feb 2, 2026
…gent (#3625) * Updated instructions handling * Small improvement * Included runtime options in session creation logic
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation and Context
Resolves: #3571
instructionsparameter toGitHubCopilotAgentconstructor (alignment with other agents), which maps tosystem_message.contentpropertysystem_messageparameter toGitHubCopilotOptionswith the ability to configuresystem_message.modeContribution Checklist