-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Python: Updated instructions/system_message logic in GitHub Copilot agent #3625
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Python: Updated instructions/system_message logic in GitHub Copilot agent #3625
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
…gent (#3625) * Updated instructions handling * Small improvement * Included runtime options in session creation logic
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