Repository navigation
Python: Fix TypeError in Copilot Studio SK migration samples - #9577
Merged
Eduard van Valkenburg (eavanvalkenburg) merged 1 commit intoOct 22, 2026
Conversation
…n samples agent_framework.microsoft.CopilotStudioAgent connects to an already published Copilot Studio agent and has no `instructions` parameter, so the Agent Framework half of both Copilot Studio migration samples raised TypeError on construction. Remove the argument and note where the agent's instructions live. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Naveen Chatlapalli (1aifanatic)
requested review from
SergeyMenshykh,
Tao Chen (TaoChenOSU),
Eduard van Valkenburg (eavanvalkenburg),
Giles Odigwe (giles17),
Jose Alvarez (jpalvarezl),
Evan Mattson (moonbox3),
Roger Barreto (rogerbarreto),
sophia-ramsey and
westey (westey-m)
as code owners
October 21, 2026 14:22
Naveen Chatlapalli (1aifanatic)
deployed
to
github-app-auth
October 21, 2026 14:22 — with
GitHub Actions
Active
Naveen Chatlapalli (1aifanatic)
deployed
to
github-app-auth
October 21, 2026 14:22 — with
GitHub Actions
Active
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
Both narrowly scoped fixes match the constructor API, and the comments accurately explain instruction configuration.
No open issues 🎉
What changed in this PR
Fixes constructor errors in two Python Copilot Studio migration samples by aligning Agent Framework calls with its supported API.
Changes:
- Removes unsupported
instructionsarguments from both Agent Framework calls. - Explains that instructions are configured in Copilot Studio; Semantic Kernel calls remain unchanged.
| File | Description |
|---|---|
| python/samples/semantic-kernel-migration/copilot_studio/02_copilot_studio_streaming.py | Fixes streaming sample construction and adds configuration guidance. |
| python/samples/semantic-kernel-migration/copilot_studio/01_basic_copilot_studio_agent.py | Fixes basic sample construction and adds configuration guidance. |
Review effort: Balanced
Eduard van Valkenburg (eavanvalkenburg)
approved these changes
Oct 22, 2026
Eduard van Valkenburg (eavanvalkenburg)
left a comment
Member
There was a problem hiding this comment.
Removing the unsupported instructions argument matches the current CopilotStudioAgent constructor, and the migration comments correctly explain that instructions live in the published Copilot Studio agent.
This branch was successfully deployed
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 & Context
The Agent Framework half of both Semantic Kernel → Agent Framework Copilot Studio migration samples fails on construction:
samples/semantic-kernel-migration/copilot_studio/01_basic_copilot_studio_agent.pysamples/semantic-kernel-migration/copilot_studio/02_copilot_studio_streaming.pyagent_framework.microsoft.CopilotStudioAgentconnects to an agent that is already published in Copilot Studio, and its constructor has noinstructionsparameter (and no**kwargs). The SK half keeps itsinstructions=argument because that is the SK API being migrated from.semantic-kernel-migrationis excluded from the samples type-check sweep (SAMPLE_TYPING_EXCLUDES), so CI did not flag this.Description & Review Guide
instructions=from the two AFCopilotStudioAgent(...)calls, and add a short comment noting that the agent's instructions are configured in Copilot Studio rather than passed to the wrapper.samples/02-agents/providers/copilotstudio/README.md.Verified locally: Pyright on the AF calls no longer reports
No parameter named "instructions". With the documentedCOPILOTSTUDIOAGENT__*variables set (token acquisition stubbed),CopilotStudioAgent(name=...)constructs successfully, and without them it now raises the expected "environment ID is required"ValueErrorinstead of aTypeError.ruff check/ruff format --checkpass.Related Issue
N/A - trivial change: the samples pass a keyword argument the constructor does not accept and fail with
TypeError. Removing that argument is the only way to make the AF half run, so the desired result is not in dispute.AI Assistance
AI assistance details: Claude Code helped find the broken samples (by type-checking the excluded migration samples), implement the fix, run the local verification, and draft this description.
Contribution Checklist
breaking changelabel (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.🤖 Generated with Claude Code