Skip to content

Python: Bug: [copilot_studio_skill sample] Copilot Studio skill call fails on argument mismatch #11819

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

Open
sergey124 opened this issue Apr 30, 2025 · 3 comments
Assignees
Labels
bug Something isn't working .NET Issue or Pull requests regarding .NET code python Pull requests for the Python Semantic Kernel

Comments

@sergey124
Copy link

sergey124 commented Apr 30, 2025

Describe the bug
The copilot_studio_skill sample fails to get a response from the skill app.

To Reproduce
Steps to reproduce the behavior:

  1. deploy Copilot Studio agent with Semantic Kernel skill, following the guide in README - steps 1 to 6
  2. in Copilot Studio agent -> Topics -> Greeting, add Action Invoke Semantic Kernel skill after the Trigger
  3. click Test button to open the chat interface
  4. type and send Hi
  5. see error message in response

The skill encountered an error or bug.
To continue to run this bot, please fix the bot source code.
Hello, how can I help you today?

See the error log in the skill Container App:

  File "/usr/local/lib/python3.12/site-packages/teams/app.py", line 903, in _start_long_running_call
    return await func(context)
           ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/teams/app.py", line 763, in _on_turn
    is_ok, matches = await self._on_activity(context, state)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/teams/app.py", line 884, in _on_activity
    if not await route.handler(context, state):
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/bot.py", line 62, in on_message
    sk_response = await agent.get_response(history=chat_history, user_input=user_message)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/semantic_kernel/utils/telemetry/agent_diagnostics/decorators.py", line 69, in wrapper_decorator
    return await get_response_func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/semantic_kernel/agents/chat_completion/chat_completion_agent.py", line 275, in get_response
    async for response in self._inner_invoke(
                          ^^^^^^^^^^^^^^^^^^^
TypeError: ChatCompletionAgent._inner_invoke() got multiple values for argument 'history'
INFO:aiohttp.access:100.100.0.93 [28/Apr/2025:07:25:07 +0000] "POST /api/messages HTTP/1.1" 200 3597 "-" "Microsoft-BotFramework/3.1 BotBuilder/4.23.0.0 .NETCoreAppVersion/v8.0"

Expected behavior
The skill replies with a joke-related phrase.

Screenshots
Error message in Copilot Studio test chat agent reply:
Image

Error log in the skill Container App:
Image

Platform

  • Language: Python
  • Source: main branch of repository
  • AI model: OpenAI:GPT-4o-mini(2024-07-18)

Additional context
I managed to fix the issue with this change, which

  • updates semantic-kernel version to 1.28.1
  • updates agent.get_response usage to new contract
  • uses openAiApiKey parameter provided in copilot_studio_skill/.azure/SKCopilot/.env as AZURE_OPENAI_API_KEY
  • also I had to specify in the SKCopilot/.env the AZURE_OPENAI_MODEL="my-gpt4o-deployment-name", as the sample expects specific deployment name gpt-4o not existing in our OpenAI resource.
@sergey124 sergey124 added the bug Something isn't working label Apr 30, 2025
@markwallace-microsoft markwallace-microsoft added .NET Issue or Pull requests regarding .NET code python Pull requests for the Python Semantic Kernel triage labels Apr 30, 2025
@github-actions github-actions bot changed the title Bug: [copilot_studio_skill sample] Copilot Studio skill call fails on argument mismatch Python: Bug: [copilot_studio_skill sample] Copilot Studio skill call fails on argument mismatch Apr 30, 2025
@github-actions github-actions bot changed the title Python: Bug: [copilot_studio_skill sample] Copilot Studio skill call fails on argument mismatch .Net: Bug: [copilot_studio_skill sample] Copilot Studio skill call fails on argument mismatch Apr 30, 2025
@sergey124 sergey124 changed the title .Net: Bug: [copilot_studio_skill sample] Copilot Studio skill call fails on argument mismatch Python: Bug: [copilot_studio_skill sample] Copilot Studio skill call fails on argument mismatch Apr 30, 2025
@sergey124
Copy link
Author

sergey124 commented Apr 30, 2025

@unsafecode , at the end of the issue description there's a fix suggestion that worked for me:
sergey124@13f387b
There in main.bicep:103 you put

openAiApiKey: '' // Force ManId, otherwise set openAI.listKeys().key1

which I populated with a param from .env, as I couldn't implement the comment - maybe you could implement.

Screenshot:
Image

@moonbox3
Copy link
Contributor

moonbox3 commented May 2, 2025

This issue here is that this demo hasn't been updated to use the thread abstractions we introduced in v1.27.0+. The get_response method no longer takes a chat history, but rather messages and an optional thread.

@sergey124
Copy link
Author

sergey124 commented May 2, 2025

@moonbox3 , also:

  1. openAiApiKey has to be provided by bicep or the user - main.bicep:103
  2. the sample expects deployment naming AZURE_OPENAI_MODEL="gpt-4o", it would be useful to mention, to avoid errors
  3. AZURE_OPENAI_API_VERSION="2024-08-01-preview" is quite old, you suggested in another issue to update - aca.bicep:7, main.parameters.json:27

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working .NET Issue or Pull requests regarding .NET code python Pull requests for the Python Semantic Kernel
Projects
None yet
Development

No branches or pull requests

4 participants