I’m experiencing a strange issue with Azure AI Agent Service where it seems to keep references to deleted connections.
Currently, my Azure AI Agents service has no active agents. When I execute client_project.agents.get_agents_list()
, it returns the expected empty response:
{'object': 'list', 'data': [], 'first_id': None, 'last_id': None, 'has_more': False}
The problem occurs after I remove an Azure AI search connection using this CLI command:
az ml connection delete -n search-hub-connection-v2 --resource-group resource-group-01 --workspace-name workspace-hub-main
Once the connection is deleted, the client_project.agents.get_agents_list()
command fails with a JSON decode error:
DecodeError: JSON is invalid: Expecting value: line 1 column 1 (char 0)
ServiceInvocationException: Service invocation failed!
Status Code: 404 NotFound
Error: Connection search-hub-connection-v2 can't be found in this workspace
The issue is that even though I’m not actively using any agents and have created new connections with different names, operations like get_agents_list()
and get_files_list()
still fail because the service tries to reference the deleted connection.
My current workaround is to avoid deleting the original connection entirely. Has anyone encountered this behavior before? Is there a way to clear these phantom references?