{"id":1343,"library":"azure-ai-agents","title":"Azure AI Agents Client Library","description":"The Azure AI Agents Client Library for Python provides tools for building AI agents that can interact with users and other services on the Azure platform. It allows developers to create, configure, and manage conversational AI experiences. The current version is 1.1.0, and it follows the Azure SDK release cadence, with frequent beta updates and less frequent, but regular, stable releases.","status":"active","version":"1.1.0","language":"en","source_language":"en","source_url":"https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/ai/azure-ai-agents","tags":["Azure","AI","Agents","Microsoft","cloud","conversational-ai"],"install":[{"cmd":"pip install azure-ai-agents","lang":"bash","label":"Install stable version"}],"dependencies":[{"reason":"Provides shared primitives, exceptions, and operations for the Azure SDK for Python.","package":"azure-core","optional":false},{"reason":"Used for authenticating with Azure services, including AgentClient, via various credential types.","package":"azure-identity","optional":false}],"imports":[{"symbol":"AgentClient","correct":"from azure.ai.agents import AgentClient"},{"note":"Used for API key authentication; typically used alongside DefaultAzureCredential from azure-identity.","symbol":"AzureKeyCredential","correct":"from azure.core.credentials import AzureKeyCredential"},{"note":"Recommended credential type for production environments, handling various authentication flows.","symbol":"DefaultAzureCredential","correct":"from azure.identity import DefaultAzureCredential"}],"quickstart":{"code":"import os\nfrom azure.ai.agents import AgentClient\nfrom azure.core.credentials import AzureKeyCredential\n\n# Set your Azure AI Agent endpoint and API key as environment variables\n# AZURE_AGENT_ENDPOINT='https://<your-agent-resource-name>.openai.azure.com'\n# AZURE_AGENT_API_KEY='your-api-key'\n\nendpoint = os.environ.get(\"AZURE_AGENT_ENDPOINT\", \"\")\napi_key = os.environ.get(\"AZURE_AGENT_API_KEY\", \"\")\n\nif not endpoint or not api_key:\n    print(\"Please set AZURE_AGENT_ENDPOINT and AZURE_AGENT_API_KEY environment variables.\")\nelse:\n    try:\n        client = AgentClient(endpoint=endpoint, credential=AzureKeyCredential(api_key))\n\n        # Example: Create an agent (if not already created)\n        # For a full agent creation example, refer to official documentation.\n        # This quickstart assumes a basic interaction.\n\n        # Example: Chat with an existing agent or start a new conversation\n        # Note: 'context' with 'thread_id' might be required depending on your agent setup.\n        # This example uses a simplified chat without explicit thread_id for brevity, \n        # but in real applications, manage thread_ids for conversational continuity.\n        chat_response = client.chat(\n            input=\"Hello, what can you do?\",\n            context={}\n        )\n\n        print(f\"Agent Output: {chat_response.output}\")\n\n    except Exception as e:\n        print(f\"An error occurred: {e}\")","lang":"python","description":"This quickstart demonstrates how to initialize the `AgentClient` using an API key and send a basic chat message. It expects the `AZURE_AGENT_ENDPOINT` and `AZURE_AGENT_API_KEY` environment variables to be set for authentication. For more advanced scenarios, including agent creation, thread management, and different authentication methods like `DefaultAzureCredential`, consult the official Azure AI Agents documentation."},"warnings":[{"fix":"Review the official documentation and migration guides for `1.1.0` and update your code to reflect the stable API patterns for `AgentClient`, agent creation, and chat interactions.","message":"The API for `azure-ai-agents` underwent significant changes between its initial beta (`1.0.0b1`) and the stable `1.1.0` release. Code written for beta versions may not be compatible with the stable release.","severity":"breaking","affected_versions":"1.0.0b1"},{"fix":"Set environment variables like `AZURE_AGENT_ENDPOINT` and `AZURE_AGENT_API_KEY` or `AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, `AZURE_CLIENT_SECRET` for `DefaultAzureCredential`. Refer to `azure-identity` documentation for detailed authentication setup.","message":"Proper authentication is mandatory. You must provide an `endpoint` and a `credential` (either `AzureKeyCredential` or a credential from `azure-identity` like `DefaultAzureCredential`). Ensure corresponding environment variables (`AZURE_AGENT_ENDPOINT`, `AZURE_AGENT_API_KEY`, or `AZURE_CLIENT_ID`, etc.) are correctly configured.","severity":"gotcha","affected_versions":"All"},{"fix":"Implement logic to generate and persist `thread_id` values, passing them in the `context` dictionary for `client.chat()` to maintain conversational continuity for your agents.","message":"While the quickstart uses a basic `chat` method, real-world agent interactions often require managing conversation state via `thread_id` within the `context` parameter. Failure to provide a consistent `thread_id` can lead to stateless interactions.","severity":"gotcha","affected_versions":"All"}],"env_vars":null,"last_verified":"2026-04-09T00:00:00.000Z","next_check":"2026-07-08T00:00:00.000Z"}