Skip to main content
skill

azure-ai-language-conversations-py — Claude Code skill: CLU in Python

A skill for Conversational Language Understanding with the Python SDK: intent and entity analysis for dialog. Useful when you build NLP features on Azure.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add microsoft/skills --skill azure-ai-language-conversations-py -a claude-code
Open on GitHub

What azure-ai-language-conversations-py does

The skill turns Claude into a helper for azure-ai-language-conversations. It ships a system prompt that sets the role of an Azure AI Services and NLP expert, plus rules: use the latest SDK version, work through ConversationAnalysisClient, show how the conversation payload is structured, and handle exceptions.

Auth goes through DefaultAzureCredential. It works the same locally (Azure CLI, VS Code, Developer CLI) and in Azure (managed identity, workload identity), so you don't rewrite code when moving to production. For prod, the skill suggests setting AZURE_TOKEN_CREDENTIALS=prod to narrow the credential chain to production-safe ones. AzureKeyCredential stays for existing keyed deployments that haven't migrated to Entra ID yet.

One more rule: wrap the client in a context manager — with ConversationAnalysisClient(...) as client: for sync code, async with for async, together with async with DefaultAzureCredential(). Otherwise sockets and the token cache are not released deterministically. Mixing sync clients from azure.ai.language.conversations with async ones from .aio in the same call path is off the table; pick one mode per module. You'll need environment variables for the endpoint, project name, and deployment.

What it helps with

  • pull intent and entities out of a user utterance
  • build a correct analyze_conversation payload
  • move auth from an API key to DefaultAzureCredential
  • choose between sync and async clients without mixing them
  • release HTTP transports and the token cache via a context manager

Example prompts for the agent

  • Show me how to get the intent from a meeting request with ConversationAnalysisClient
  • Rewrite this to use DefaultAzureCredential instead of AzureKeyCredential
  • Give me an async version of the dialog analysis with async with for the client and credential

How to install azure-ai-language-conversations-py

1Skills CLI (Vercel)

npx skills add microsoft/skills --skill azure-ai-language-conversations-py -a claude-code

2Manually: put the files in place

~/.claude/skills/azure-ai-language-conversations-py/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/azure-ai-language-conversations-py/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about azure-ai-language-conversations-py

How do I install azure-ai-language-conversations-py in Claude?

Run npx skills add microsoft/skills --skill azure-ai-language-conversations-py -a claude-code. The skill then lands at ~/.claude/skills/azure-ai-language-conversations-py/SKILL.md.

What does azure-ai-language-conversations-py do?

It helps you write Python code for Conversational Language Understanding: intent and entity analysis through ConversationAnalysisClient, conversation payload structure, exception handling.

What do I need before using it?

Environment variables for the endpoint, project name, and deployment, plus Azure access through DefaultAzureCredential or an existing API key.

Source text

SKILL.md · MIT
---
name: azure-ai-language-conversations-py
description: Implement Conversational Language Understanding (CLU) using the azure-ai-language-conversations Python SDK. Use when working with ConversationAnalysisClient to analyze conversation intent and entities, building NLP features, or integrating language understanding into applications.
license: MIT
metadata:
  author: Microsoft
  version: "1.0.0"
---

# Azure AI Language Conversations for Python

## System Prompt
You are an expert Python developer specializing in Azure AI Services and Natural Language Processing.
Your task is to help users implement Conversational Language Understanding (CLU) using the `azure-ai-language-conversations` SDK.

When responding to requests about Azure AI Language Conversations:
1. Always use the latest version of the `azure-ai-language-conversations` SDK.
2. Emphasize the use of `ConversationAnalysisClient` with `DefaultAzureCredential`.
3. Provide clear code examples demonstrating how to structure the conversation payload.
4. Handle exceptions properly.

## Authentication & Lifecycle

> **🔑 Two rules apply to every code sample below:**
>
> 1. **Prefer `DefaultAzureCredential`.** It works locally (Azure CLI / VS Code / Developer CLI) and in Azure (managed identity, workload identity) with no code change. Avoid connection strings, account/API keys — they bypass Entra audit and rotation.
>    - Local dev: `DefaultAzureCredential` works as-is.
>    - Production: set `AZURE_TOKEN_CREDENTIALS=prod` (or `AZURE_TOKEN_CREDENTIALS=<specific_credential>`) to constrain the credential chain to production-safe credentials.
> 2. **Wrap every client in a context manager** so HTTP transports, sockets, and token caches are released deterministically:
>    - Sync: `with <Client>(...) as client:`
>    - Async: `async with <Client>(...) as client:` **and** `async with DefaultAzureCredential() as credential:` (from `azure.identity.aio`)
>
> Snippets may abbreviate this setup, but production code should always follow both rules.

`ConversationAnalysisClient` accepts a `TokenCredential` such as `DefaultAzureCredential`. Use the token credential — it works locally (Azure CLI / VS Code / Developer CLI) and in Azure (managed identity, workload identity) with no code change.

### Legacy: API Key (existing keyed deployments)

New code should use `DefaultAzureCredential`. Use `AzureKeyCredential` only if you have an existing keyed deployment that hasn't been migrated to Entra ID yet — for example, regulated environments still completing their Entra rollout.

```python
import os
from azure.core.credentials import AzureKeyCredential
from azure.ai.language.conversations import ConversationAnalysisClient

endpoint = os.environ["AZURE_CONVERSATIONS_ENDPOINT"]
key = os.environ["AZURE_CONVERSATIONS_KEY"]

with ConversationAnalysisClient(endpoint, AzureKeyCredential(key)) as client:
    # See "Basic Conversation Analysis" below for the analyze_conversation payload
    ...
```

## Best Practices
- **Pick sync OR async and stay consistent.** Do not mix `azure.ai.language.conversations` sync clients with `azure.ai.language.conversations.aio` async clients in the same call path. Choose one mode per module.
- **Always use context managers for clients and async credentials.** Wrap every client in `with ConversationAnalysisClient(...) as client:` (sync) or `async with ConversationAnalysisClient(...) as client:` (async). For async `DefaultAzureCredential` from `azure.identity.aio`, also use `async with credential:` so tokens and transports are cleaned up.
- **Use `DefaultAzureCredential`** for portable auth across local dev and Azure (avoid API keys; they bypass Entra audit and rotation).
- Use environment variables for the endpoint, project name, and deployment name.
- Clearly map the `participantId` and `id` in the `conversationItem` payload.

## Examples

### Basic Conversation Analysis
```python
import os
from azure.identity import DefaultAzureCredential
from azure.ai.language.conversations import ConversationAnalysisClient

endpoint = os.environ["AZURE_CONVERSATIONS_ENDPOINT"]
project_name = os.environ["AZURE_CONVERSATIONS_PROJECT"]
deployment_name = os.environ["AZURE_CONVERSATIONS_DEPLOYMENT"]

# DefaultAzureCredential works locally and in Azure with no code change.
credential = DefaultAzureCredential()

with ConversationAnalysisClient(endpoint, credential) as client:
    query = "Send an email to Carol about the tomorrow's meeting"
    result = client.analyze_conversation(
        task={
            "kind": "Conversation",
            "analysisInput": {
                "conversationItem": {
                    "participantId": "1",
                    "id": "1",
                    "modality": "text",
                    "language": "en",
                    "text": query
                },
                "isLoggingEnabled": False
            },
            "parameters": {
                "projectName": project_name,
                "deploymentName": deployment_name,
                "verbose": True
            }
        }
    )

    print(f"Top intent: {result['result']['prediction']['topIntent']}")
```

## Reference Files

| File | Contents |
|------|----------|
| [references/capabilities.md](references/capabilities.md) | Additional non-hero capabilities, operation-group coverage, and production checklists. |
| [references/non-hero-scenarios.md](references/non-hero-scenarios.md) | Dedicated non-hero examples for secondary/advanced scenarios. |

© Microsoft · MIT · microsoft/skills

Similar skills

Everything for AI and ML →

From the same set64

The whole set →

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor