Durable Pydantic AI agents with Azure Durable Task
Durable Pydantic AI agents with Azure Durable Task
Pydantic AI Harness now includes AzureDurableTaskDurability, a capability that runs the agent loop on Microsoft's Durable Task engine, recording each model request, tool call, MCP call, and durable operation as an activity so a replacement worker can replay history and resume after a crash. The post walks through a support agent example on the local DTS emulator, shows a worker killed mid-refund resuming without repeating completed activities, and covers replay rules (at-least-once activities, idempotency keys from ctx.run_id and ctx.tool_call_id, deterministic orchestrator code), human approvals via external events, per-role RetryPolicy settings, and deployment to Azure Durable Task Scheduler.
It gives a concrete, tested account of what actually happens when a durable agent worker dies mid-tool-call, plus the replay rules and approval pattern that follow from it.
Source: Pydantic AI Articles · pydantic.dev