This repo contains hands-on notebooks and sample agents for operating and connecting agents in Azure AI Foundry from a Control Plane perspective. The focus is practical: create (or point to) a Foundry project, run lightweight inventory/monitoring checks, and connect both MS Agent Framework agents and Hosted Agents.
- 0_setup/1_setup.ipynb: Bootstrap the minimum Foundry resources (Resource Group, AIServices account, Project), discover the Project endpoint/API key, and write a local config file for reuse.
- 1_controlplane/1_foundry_agent_monitoring.ipynb: Control Plane checks with the Foundry SDK (list deployed agents, inspect assets like connections, and understand where quota is managed).
- 1_controlplane/2_ms_agent_framework_connect_foundry.ipynb: Connect MS Agent Framework agents using
AzureAIClient, including conversation/thread linkage and tracing verification in the Foundry portal. - 1_controlplane/3_hosted_agent_connect_foundry.ipynb: Package agents as containers, push to ACR, and register Hosted Agents using the Hosting Adapter (with sample agents under
1_controlplane/1.1_hosted-agent_sdk/).
- Python 3.12+
- Azure CLI (
az) and an Azure account with access to Azure AI Foundry - For Hosted Agents: Docker and an Azure Container Registry (ACR)
uv sync --prerelease=allow
source .venv/bin/activateCopy environment variables:
cp sample.env .envUpdate .env values as needed. Common variables used across the notebooks:
AZURE_TENANT_ID,AZURE_SUBSCRIPTION_IDAZURE_AI_MODEL_DEPLOYMENT_NAME(model deployment name in Foundry)AZURE_OPENAI_ENDPOINT(Azure OpenAI endpoint)AZURE_OPENAI_CHAT_DEPLOYMENT_NAME(used by some notebooks/samples)AZURE_CONTAINER_REGISTRY(required for Hosted Agent container builds)BING_GROUNDING_CONNECTION_NAME(only if you run the web-search hosted agent scenario)
Note: authentication is typically done via DefaultAzureCredential (e.g., az login). Some flows may also use AZURE_OPENAI_API_KEY depending on the notebook/sample.
- Run 0_setup/1_setup.ipynb to create or configure your Foundry Project.
- Run 1_controlplane/1_foundry_agent_monitoring.ipynb for basic fleet/assets checks.
- Run 1_controlplane/2_ms_agent_framework_connect_foundry.ipynb to connect MS Agent Framework agents and verify tracing.
- Run 1_controlplane/3_hosted_agent_connect_foundry.ipynb to build/push container images and register Hosted Agents.
Sample agents live under 1_controlplane/1.1_hosted-agent_sdk/:
calculator-agent: LangGraph + Hosting Adapter (simple arithmetic tools)msft-docs-agent: MAF-based exampleworkflow-agent: concurrent workflow exampleweb-search-agent: grounding with Bing Search connection
- Do not commit
.envor0_setup/.foundry_config.json(they can contain secrets like API keys). - If a key was ever committed, rotate the key in Azure and rewrite Git history before sharing the repo.