Skip to content

Getting 'unclosed client session' error when deleting agent/thread #40603

Closed
@carlotta94c

Description

@carlotta94c
  • Package Name: azure-ai-projects (agent service)
  • Package Version: 1.0.0b8
  • Operating System:
  • Python Version: 3.13

Describe the bug
Getting 'ERROR:asyncio: Unclosed client session' after deleting thread and agent. When running the agent application in debug mode (F5) the issue doesn't occur. It looks like the destructor for the sdk is not cleaning up properly.
The error doesn't prevent the app to run smoothly.

To Reproduce
Steps to reproduce the behavior:

  1. Open the agent solution in a codespace or dev container https://github.com/microsoft/build-your-first-agent-with-azure-ai-agent-service-workshop
  2. Follow the instructions to enable function calling https://github.com/microsoft/build-your-first-agent-with-azure-ai-agent-service-workshop/blob/main/docs/docs/lab-1-function_calling.md
  3. Execute the app (run src/python/workshop/main.py)
  4. Type exit to cleanup the agent and you'll get the error.
  5. Try executing the app in debug mode (F5) and see the difference.

Expected behavior
I would expect the same behaviour when running the app in debug mode and in 'default mode', which means not getting the error (screenshot below).

Screenshots

Image

Additional context
The application in the linked repo (https://github.com/microsoft/build-your-first-agent-with-azure-ai-agent-service-workshop/) is a sample of an agent built with Azure AI Agent service using Python.

Metadata

Metadata

Assignees

Labels

AI ProjectsClientThis issue points to a problem in the data-plane of the library.Service AttentionWorkflow: This issue is responsible by Azure service team.customer-reportedIssues that are reported by GitHub users external to the Azure organization.needs-team-attentionWorkflow: This issue needs attention from Azure service team or SDK teamquestionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions