# Microsoft Foundry + Diagrid

**Build agents with Microsoft Foundry. Make their execution durable with Diagrid.**

[Microsoft Foundry](https://learn.microsoft.com/azure/foundry/) gives your agents models, tools and a managed place to run. Diagrid gives every agent run [durable execution](https://docs.diagrid.io/concepts/durable-execution): each model call and tool call is recorded as a step of a workflow, so a run survives crashes and restarts and resumes where it stopped.

The two are complementary. You keep your agent framework, your Foundry models, your tools and your business logic, and add one Diagrid package to the agent.

**Diagram: A Foundry agent with Diagrid durable execution.** Your agent calls Foundry for models and tools, and records every step of the run in Diagrid. The agent app runs on your machine, in your cloud, or as a Foundry hosted agent.

- **Your agent app (your code)**: Agent framework (LangGraph, CrewAI, …), Diagrid agent package (durable runner)
- **Microsoft Foundry**: Models, Tools
- **Diagrid**: Workflow engine, Execution history, Diagrid CLI and Console

- Agent framework (LangGraph, CrewAI, …) → Microsoft Foundry (model and tool calls)
- Agent framework (LangGraph, CrewAI, …) → Diagrid agent package (durable runner)
- Diagrid agent package (durable runner) → Workflow engine (every step)
- Workflow engine → Execution history
- Execution history → Diagrid CLI and Console (async)

## What each platform provides

| | Microsoft Foundry | Diagrid |
| --- | --- | --- |
| **Models and tools** | Model catalog, model deployments and tools | Works with the models and tools your agent already uses |
| **Agent runtime** | [Hosted agents](https://learn.microsoft.com/azure/foundry/agents/concepts/hosted-agents): a managed sandbox, endpoint and identity for your agent container | Never runs your agent code. Your agent connects to Diagrid over outbound HTTPS and gRPC |
| **Execution** | Runs the model and hosts the agent process | Runs the agent's control loop as a durable workflow and stores its history |
| **Visibility** | Traces and logs of the hosted agent | Every run as a workflow: status, steps, inputs, outputs and timing |

## What Diagrid adds to a Foundry agent

- **Durable execution with automatic failure recovery.** Each model call and tool call runs as a workflow activity. A failed activity is retried, and when the agent process stops, the run resumes from its last completed step after a restart.
- **Persistent execution history and checkpoints.** Diagrid stores the result of every completed step in the project's workflow state store. A resumed run reads those results from the history and doesn't call the model or the tool again for them. Activities run at least once, so keep tools with side effects idempotent.
- **Long-running agent execution.** A run isn't tied to one process or one request. It can outlive the instance that started it, which matters for platforms that scale an idle agent to zero.
- **Workflow-level visibility.** Every agent run is a workflow that you can [inspect](https://docs.diagrid.io/operate/project-operations/workflows) with the Diagrid CLI or in the Diagrid Console, with the input and output of each step.
- **Multi-instance coordination.** Several instances of the same agent can connect with one [identity](https://docs.diagrid.io/concepts/identities). Diagrid distributes the steps among them and keeps one history per run.
- **Verifiable execution.** In a project with workflow history signing, Diagrid signs every history event, which gives you a tamper-evident record of what ran, and attests results that cross identities. You turn it on when you create the project. See [Verifiable execution](https://docs.diagrid.io/concepts/verifiable-execution).

## Supported frameworks

The [quickstart](https://docs.diagrid.io/integrations/microsoft-foundry/getting-started) has a tab for each of these frameworks. They are Python frameworks unless the table says otherwise. Every combination was run against a real Foundry model deployment and a real Diagrid project.

| Framework | Diagrid package | Tested with | Foundry model access |
| --- | --- | --- | --- |
| LangGraph | `diagrid[langgraph]` 0.5.3 | `langgraph` 1.2.22, `langchain-openai` 1.8.0 | Microsoft Entra ID |
| Microsoft Agent Framework (.NET) | `Diagrid.AI.Microsoft.AgentFramework` 1.2.1 | `Microsoft.Agents.AI.Foundry` 1.5.0 | Microsoft Entra ID |
| Deep Agents | `diagrid[deepagents]` 0.5.3 | `deepagents` 0.7.38 | Microsoft Entra ID |
| OpenAI Agents SDK | `diagrid[openai_agents]` 0.5.3 | `openai-agents` 0.20.0 | API key |
| CrewAI | `diagrid[crewai]` 0.5.3 | `crewai` 1.15.41 | API key |
| Google ADK | `diagrid[adk]` 0.5.3 | `google-adk` 1.39.1 | API key |
| Pydantic AI | `diagrid[pydantic_ai]` 0.5.3 | `pydantic-ai-slim` 2.31.1 | API key |
| Strands | `diagrid[strands]` 0.5.3 | `strands-agents` 1.65.0 | API key |
| Mastra (TypeScript) | `@diagrid/agent-mastra` 0.2.0 | `@mastra/core` 1.83.0 | API key |
| Dapr Agents | `dapr-agents` 1.1.1 | Diagrid conversation component | API key, held by Diagrid |

The Claude Agent SDK only runs Claude models, so it needs a Claude deployment in Foundry. That combination isn't verified yet and has no tab in the quickstart.

## Next steps

- [Quickstart](https://docs.diagrid.io/integrations/microsoft-foundry/getting-started) — Take a Foundry agent, add the Diagrid package, and inspect its run as a durable workflow.
- [Foundry hosted agents](https://docs.diagrid.io/integrations/microsoft-foundry/hosted-agents) — Deploy a Diagrid-enabled agent to Foundry's hosted agent runtime.
- [Troubleshooting](https://docs.diagrid.io/integrations/microsoft-foundry/troubleshooting) — Fix the errors you're most likely to meet with Foundry models and Diagrid.
- [Agent frameworks](https://docs.diagrid.io/develop/agents) — Tutorials and access policies for each framework Diagrid supports.
