lab / agent framework foundry

Agent Framework: Azure AI Foundry Integration

How this site's AIAgent is actually backed by an Azure AI Foundry project, and what that buys you.

Contents

Azure AI Foundry hosts model deployments behind a project. This site points an Azure.AI.Projects.AIProjectClient at that project's endpoint and calls .AsAIAgent(model, name, instructions) to get back a plain AIAgent - Foundry only shows up at registration time, not in any code that actually uses the agent.

The Foundry client

Credentials

Auth is DefaultAzureCredential, with one dev-time carve-out: on some dev machines the managed-identity IMDS probe doesn't fail fast, it just retries until it times out - which blocks DefaultAzureCredential from ever reaching the az-login/Visual Studio credential that actually works locally. So in Development, managed identity is excluded from the chain; in Production the full chain is used so hosted managed identity works as expected.

Configuration shape

Everything above reads from a single bound options class:

Currently configured on this deployment

Foundry project hostrepettinet-ai-eus2.services.ai.azure.com
Chat deploymentgpt-5.4-mini
Available models gpt-5.6-lunagpt-5.6-terragpt-5.6-solgpt-5.4-minigpt-4o-mini

Try it: a real Foundry round-trip

This calls IChatService.ChatStreamAsync (the same streaming API the Azure AI chat bot example uses) against the deployment configured above, and shows the token usage Foundry reports back for the turn.

References

For more detailed information and advanced scenarios, check out these helpful resources:

An unhandled error has occurred. Reload ๐Ÿ—™

Reconnecting… Still reconnecting… Connection lost Session paused Session expired

The connection to the server dropped. This usually only takes a moment.

No answer yet. Trying again in 0s.

Couldn't reach the server. Check your connection, then try again.

This tab sat idle, so the server set the session aside. Pick up where you left off.

The server no longer has this session. Reload the page to start fresh.