Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Get Started with Azure Content Understanding in Microsoft Agent Framework

Please install this package via pip:

pip install agent-framework-azure-contentunderstanding --pre

Azure Content Understanding Integration

Prerequisites

Before using this package, you need an Azure Content Understanding resource:

  1. An active Azure subscription (create one for free)
  2. A Microsoft Foundry resource created in a supported region
  3. Default model deployments configured for your resource (GPT-4.1, GPT-4.1-mini, text-embedding-3-large)

Follow the prerequisites section in the Azure Content Understanding quickstart for setup instructions.

Introduction

The Azure Content Understanding integration provides a context provider that automatically analyzes file attachments (documents, images, audio, video) using Azure Content Understanding and injects structured results into the LLM context.

  • Document & image analysis: State-of-the-art OCR with markdown extraction, table preservation, and structured field extraction — handles scanned PDFs, handwritten content, and complex layouts
  • Audio & video analysis: Transcription, speaker diarization, and per-segment summaries
  • Background processing: Configurable timeout with async background fallback for large files
  • file_search integration: Optional vector store upload for token-efficient RAG on large documents

Learn more about Azure Content Understanding capabilities at https://learn.microsoft.com/azure/ai-services/content-understanding/

Basic Usage Example

See the Azure Content Understanding samples which demonstrate:

import asyncio
from agent_framework import Agent, AgentSession, Message, Content
from agent_framework.foundry import FoundryChatClient
from agent_framework.foundry import ContentUnderstandingContextProvider
from azure.identity import AzureCliCredential

credential = AzureCliCredential()

cu = ContentUnderstandingContextProvider(
    endpoint="https://my-resource.cognitiveservices.azure.com/",
    credential=credential,
    max_wait=None,  # block until CU extraction completes before sending to LLM
)

client = FoundryChatClient(
    project_endpoint="https://your-account.services.ai.azure.com/api/projects/your-project",
    model="gpt-4.1",
    credential=credential,
)

async def main():
    async with cu:
        agent = Agent(
            client=client,
            name="DocumentQA",
            instructions="You are a helpful document analyst.",
            context_providers=[cu],
        )
        session = AgentSession()

        response = await agent.run(
            Message(role="user", contents=[
                Content.from_text("What's on this invoice?"),
                Content.from_uri(
                    "https://raw.githubusercontent.com/Azure-Samples/"
                    "azure-ai-content-understanding-assets/main/document/invoice.pdf",
                    media_type="application/pdf",
                    additional_properties={"filename": "invoice.pdf"},
                ),
            ]),
            session=session,
        )
        print(response.text)

asyncio.run(main())

Supported File Types

Category Types
Documents PDF, DOCX, XLSX, PPTX, HTML, TXT, Markdown
Images JPEG, PNG, TIFF, BMP
Audio WAV, MP3, M4A, FLAC, OGG
Video MP4, MOV, AVI, WebM

For the complete list of supported file types and size limits, see Azure Content Understanding service limits.

Environment Variables

The provider supports automatic endpoint resolution from environment variables. When endpoint is not passed to the constructor, it is loaded from AZURE_CONTENTUNDERSTANDING_ENDPOINT:

# Endpoint auto-loaded from AZURE_CONTENTUNDERSTANDING_ENDPOINT env var
cu = ContentUnderstandingContextProvider(credential=credential)

Set these in your shell or in a .env file:

AZURE_CONTENTUNDERSTANDING_ENDPOINT=https://your-cu-resource.cognitiveservices.azure.com/
FOUNDRY_PROJECT_ENDPOINT=https://your-account.services.ai.azure.com/api/projects/your-project
FOUNDRY_MODEL=gpt-4.1

You also need to be logged in with az login (for AzureCliCredential).

Next steps

Metadata

Release files for agent-framework-azure-contentunderstanding 1.0.0b261106

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for agent-framework-azure-contentunderstanding 1.0.0b261106
File Size Uploaded Provenance Actions
agent_framework_azure_contentunderstanding-1.0.0b261106.tar.gz 21.6 kB Without provenance Details for agent_framework_azure_contentunderstanding-1.0.0b261106.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for agent-framework-azure-contentunderstanding 1.0.0b261106
File Interpreter ABI Platform Actions
agent_framework_azure_contentunderstanding-1.0.0b261106-py3-none-any.whl Python 3 none any Details for agent_framework_azure_contentunderstanding-1.0.0b261106-py3-none-any.whl

Total release size: 44.5 kB

Release files / agent_framework_azure_contentunderstanding-1.0.0b261106.tar.gz

Download URL agent_framework_azure_contentunderstanding-1.0.0b261106.tar.gz
Size 21.6 kB
Tags Source
SHA-256 checksum
How to use checksums
f177c9ac83eba18a32029d06f031cc88a5ba02db7a21bef8c04ea151ee7aaccf
BLAKE2b-256 checksum
How to use checksums
fdc9a6c137a80cf3d76288bfdfbb9bbb84b727e3bf31806d4bc3bf32c0d5ac50
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via RestSharp/106.13.0.0

Release files / agent_framework_azure_contentunderstanding-1.0.0b261106-py3-none-any.whl

Download URL agent_framework_azure_contentunderstanding-1.0.0b261106-py3-none-any.whl
Size 22.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bcbcce5ccb32c369a626da58075f114fd1aaa867a3faf5fd7e3c3c312d584398
BLAKE2b-256 checksum
How to use checksums
85872fd611de441db49641988679dc4715bd1c7857b2a6fd12e48750fec55dc6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via RestSharp/106.13.0.0

Security for agent-framework-azure-contentunderstanding 1.0.0b261106

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page