Skip to content

Lab 02 - Develop an AI agent. Bad parameter in agent delete#71

Open
rob-foulkrod wants to merge 1 commit intoMicrosoftLearning:mainfrom
rob-foulkrod:patch-2
Open

Lab 02 - Develop an AI agent. Bad parameter in agent delete#71
rob-foulkrod wants to merge 1 commit intoMicrosoftLearning:mainfrom
rob-foulkrod:patch-2

Conversation

@rob-foulkrod
Copy link
Contributor

delete method does take agent version

Module: 00

Lab/Demo: 02

Fixes # .

Learners (and confirmed locally) and were getting error

project_client.agents.delete(agent_name=agent.name, agent_version=agent.version)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

...
TypeError: Session.request() got an unexpected keyword argument 'agent_version'

Changes proposed in this pull request:

  • Removed the offending argument and the agent is deleted

delete method does take agent version
@rob-foulkrod rob-foulkrod changed the title Lab02 - Develop an AI agent. Bad parameter in agent delete Lab 02 - Develop an AI agent. Bad parameter in agent delete Jan 22, 2026
@ivorb
Copy link
Collaborator

ivorb commented Jan 28, 2026

@v-vfarias can you take a look at this? We need to lock versions of our packages for these labs to avoid changes like this, if you can test with the latest then lock our pip install. Likely need to lock the rest of the lab versions soon too

@buzahid
Copy link
Contributor

buzahid commented Jan 29, 2026

I'm not able to replicate this. @rob-foulkrod are you still seeing the issue? Are you running the code locally or in the cloud shell?

@rob-foulkrod
Copy link
Contributor Author

rob-foulkrod commented Jan 30, 2026 via email

@rob-foulkrod
Copy link
Contributor Author

rob-foulkrod commented Jan 30, 2026

I'm not able to replicate this. @rob-foulkrod are you still seeing the issue? Are you running the code locally or in the cloud shell?

Learners were in cloudshell. I replicated it local to be sure.

Let's create 5 cool ASCII art representations based on these categories and their costs!

item.content[0].type = input_text
USER: create 5 cool ascii art representations of this data

Conversation deleted
Traceback (most recent call last):
  File "/home/rob/ai-agents/Labfiles/02-build-ai-agent/Python/agent.py", line 117, in <module>
    main()
  File "/home/rob/ai-agents/Labfiles/02-build-ai-agent/Python/agent.py", line 113, in main
    project_client.agents.delete(agent_name=agent.name, agent_version=agent.version)
  File "/home/rob/ai-agents/Labfiles/02-build-ai-agent/Python/labenv/lib/python3.12/site-packages/azure/core/tracing/decorator.py", line 119, in wrapper_use_tracer
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/home/rob/ai-agents/Labfiles/02-build-ai-agent/Python/labenv/lib/python3.12/site-packages/azure/ai/projects/_validation.py", line 62, in wrapper
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/home/rob/ai-agents/Labfiles/02-build-ai-agent/Python/labenv/lib/python3.12/site-packages/azure/ai/projects/operations/_operations.py", line 2621, in delete
    pipeline_response: PipelineResponse = self._client._pipeline.run(  # pylint: disable=protected-access
                                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/rob/ai-agents/Labfiles/02-build-ai-agent/Python/labenv/lib/python3.12/site-packages/azure/core/pipeline/_base.py", line 242, in run
    return first_node.send(pipeline_request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/rob/ai-agents/Labfiles/02-build-ai-agent/Python/labenv/lib/python3.12/site-packages/azure/core/pipeline/_base.py", line 98, in send
    response = self.next.send(request)
               ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/rob/ai-agents/Labfiles/02-build-ai-agent/Python/labenv/lib/python3.12/site-packages/azure/core/pipeline/_base.py", line 98, in send
    response = self.next.send(request)
               ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/rob/ai-agents/Labfiles/02-build-ai-agent/Python/labenv/lib/python3.12/site-packages/azure/core/pipeline/_base.py", line 98, in send
    response = self.next.send(request)
               ^^^^^^^^^^^^^^^^^^^^^^^
  [Previous line repeated 2 more times]
  File "/home/rob/ai-agents/Labfiles/02-build-ai-agent/Python/labenv/lib/python3.12/site-packages/azure/core/pipeline/policies/_redirect.py", line 205, in send
    response = self.next.send(request)
               ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/rob/ai-agents/Labfiles/02-build-ai-agent/Python/labenv/lib/python3.12/site-packages/azure/core/pipeline/policies/_retry.py", line 545, in send
    response = self.next.send(request)
               ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/rob/ai-agents/Labfiles/02-build-ai-agent/Python/labenv/lib/python3.12/site-packages/azure/core/pipeline/policies/_authentication.py", line 161, in send
    response = self.next.send(request)
               ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/rob/ai-agents/Labfiles/02-build-ai-agent/Python/labenv/lib/python3.12/site-packages/azure/core/pipeline/_base.py", line 98, in send
    response = self.next.send(request)
               ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/rob/ai-agents/Labfiles/02-build-ai-agent/Python/labenv/lib/python3.12/site-packages/azure/core/pipeline/_base.py", line 98, in send
    response = self.next.send(request)
               ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/rob/ai-agents/Labfiles/02-build-ai-agent/Python/labenv/lib/python3.12/site-packages/azure/core/pipeline/_base.py", line 98, in send
    response = self.next.send(request)
               ^^^^^^^^^^^^^^^^^^^^^^^
  [Previous line repeated 2 more times]
  File "/home/rob/ai-agents/Labfiles/02-build-ai-agent/Python/labenv/lib/python3.12/site-packages/azure/core/pipeline/_base.py", line 130, in send
    self._sender.send(request.http_request, **request.context.options),
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/rob/ai-agents/Labfiles/02-build-ai-agent/Python/labenv/lib/python3.12/site-packages/azure/core/pipeline/transport/_requests_basic.py", line 375, in send
    response = self.session.request(  # type: ignore
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: Session.request() got an unexpected keyword argument 'agent_version'

Then delete the parameter

image

@ivorb
Copy link
Collaborator

ivorb commented Feb 2, 2026

@buzahid where did you see success, local or in cloudshell?

@rob-foulkrod you saw the same thing in both places, can you check the library version you have installed?

@v-vfarias
Copy link

During my testing, I have faced the same issue as @rob-foulkrod mentioned. Removing the argument works, but also checking that other labs has the same clean-up methods used but no errors are raised, verifying that at the moment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants