Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
The Durable Task extension for Microsoft Agent Framework brings durable execution directly into the Microsoft Agent Framework. You can register agents with the extension to make them automatically durable with persistent sessions, built-in API endpoints, and distributed scaling — without changes to your agent logic.
When to use durable agents
Choose the Durable Task extension when you need:
- Persistent conversation state — Agent sessions survive process crashes, restarts, and scaling events without losing context.
- Multi-agent orchestration — Coordinate specialized agents in deterministic workflows with automatic checkpointing and failure recovery.
- Long-running workflows — Support human-in-the-loop approvals or timed waits that can last hours, days, or weeks without consuming compute resources.
- Scalable, serverless hosting — Scale to thousands of concurrent agent sessions (or to zero) on the Azure Functions Flex Consumption plan.
If you don't need durable state or multi-agent coordination, a standard Microsoft Agent Framework agent without the extension may be sufficient.
Tip
For a step-by-step walkthrough including local setup, prerequisites, and deployment, see the Agent Framework tutorial. That guide covers application APIs and hosting. This article covers Durable Task integration, backend configuration, state lifecycle, and operations.
Architecture
The extension internally implements entity-based agent loops, where each agent session is a durable entity that automatically manages conversation state and checkpointing.
The extension supports two hosting approaches:
- Azure Functions using the Azure Functions integration package.
- Bring your own compute using the base package.
The following samples demonstrate the capabilities in each language and hosting model. Generated HTTP endpoints are a Functions integration feature; self-hosted applications expose and secure their own APIs.
| Language | Hosting model | Durable agents and orchestrations | Graph-based workflows |
|---|---|---|---|
| C# | Azure Functions | Agent samples | Workflow samples |
| C# | Self-hosted | Agent samples | Workflow samples |
| Python | Azure Functions | Functions samples | Functions workflow samples |
| Python | Self-hosted | Worker and client samples | Standalone workflow sample |
Important
Install the packages shown for your hosting model below, including preview packages where indicated. For complete applications, see the source and samples.
Source-branch documentation can describe capabilities that aren't available in published packages yet. Apply configuration and migration steps only for features included in your installed release.
Agent hosting
Define your agent using the standard Microsoft Agent Framework pattern, then enhance it with the Durable Task extension. The extension handles session persistence, endpoint creation, and state management automatically.
This example uses AIProjectClient from the Azure.AI.Projects package and its .AsAIAgent() extension to integrate with the Durable Task extension.
var endpoint = Environment.GetEnvironmentVariable("AZURE_OPENAI_ENDPOINT")
?? throw new InvalidOperationException("AZURE_OPENAI_ENDPOINT is not set.");
var deploymentName = Environment.GetEnvironmentVariable("AZURE_OPENAI_DEPLOYMENT")
?? "gpt-4o-mini";
// Create an AI agent using the Microsoft Agent Framework pattern
AIAgent agent = new AIProjectClient(new Uri(endpoint), new DefaultAzureCredential())
.AsAIAgent(
model: deploymentName,
instructions: "You are a professional content writer who creates engaging, "
+ "well-structured documents for any given topic.",
name: "DocumentPublisher");
// One line to make the agent durable with serverless hosting
using IHost app = FunctionsApplication
.CreateBuilder(args)
.ConfigureFunctionsWebApplication()
.ConfigureDurableAgents(options => options.AddAIAgent(agent))
.Build();
app.Run();
This example uses AIProjectClient from the Azure.AI.Projects package and its .AsAIAgent() extension to integrate with the Durable Task extension.
var endpoint = Environment.GetEnvironmentVariable("AZURE_OPENAI_ENDPOINT")
?? throw new InvalidOperationException("AZURE_OPENAI_ENDPOINT is not set.");
var deploymentName = Environment.GetEnvironmentVariable("AZURE_OPENAI_DEPLOYMENT")
?? "gpt-4o-mini";
// Create an AI agent using the Microsoft Agent Framework pattern
AIAgent agent = new AIProjectClient(new Uri(endpoint), new DefaultAzureCredential())
.AsAIAgent(
model: deploymentName,
instructions: "You are a professional content writer who creates engaging, "
+ "well-structured documents for any given topic.",
name: "DocumentPublisher");
// Host the agent with Durable Task Scheduler
string connectionString = "Endpoint=http://localhost:8080;TaskHub=default;Authentication=None";
IHost host = Host.CreateDefaultBuilder(args)
.ConfigureServices(services =>
{
services.ConfigureDurableAgents(
options => options.AddAIAgent(agent),
workerBuilder: builder => builder.UseDurableTaskScheduler(connectionString),
clientBuilder: builder => builder.UseDurableTaskScheduler(connectionString));
})
.Build();
await host.StartAsync();
Note
See the Agent Framework setup guide for package installation and the samples on GitHub for complete host configuration.
Multi-agent orchestration with durable checkpointing
You can coordinate multiple specialized agents as steps in a durable orchestration. Each agent call is checkpointed, and the orchestration recovers automatically if any step fails. Completed agent calls aren't re-executed on recovery.
Checkpointing doesn't make external tool side effects transactional or exactly-once. Make tool and activity operations idempotent, especially when they publish documents, charge accounts, or update another service. A failure after an external write but before a durable commit can cause the operation to run again.
The DurableAIAgent wrapper ensures calls are tracked and checkpointed by the framework.
The following example shows a sequential multi-agent workflow where a research agent gathers information and a writer agent produces a document.
Use context.GetAgent() to retrieve registered agents inside an orchestration.
[Function(nameof(DocumentPublishingOrchestration))]
public async Task<string> DocumentPublishingOrchestration(
[OrchestrationTrigger] TaskOrchestrationContext context)
{
var docRequest = context.GetInput<DocumentRequest>();
DurableAIAgent researchAgent = context.GetAgent("ResearchAgent");
DurableAIAgent writerAgent = context.GetAgent("DocumentPublisherAgent");
// Step 1: Research the topic
AgentResponse<ResearchResult> researchResult = await researchAgent
.RunAsync<ResearchResult>(
$"Research the following topic: {docRequest.Topic}");
// Step 2: Write the document using the research findings
AgentResponse<DocumentResponse> document = await writerAgent
.RunAsync<DocumentResponse>(
$"""Create a document about {docRequest.Topic}.
Research findings: {researchResult.Result.Findings}""");
// Step 3: Publish
return await context.CallActivityAsync<string>(
nameof(PublishDocument),
new { docRequest.Topic, document.Result.Text });
}
Use context.GetAgent() to retrieve registered agents inside an orchestration.
static async Task<string> DocumentPublishingOrchestration(
TaskOrchestrationContext context, DocumentRequest docRequest)
{
DurableAIAgent researchAgent = context.GetAgent("ResearchAgent");
DurableAIAgent writerAgent = context.GetAgent("DocumentPublisherAgent");
// Step 1: Research the topic
AgentResponse<ResearchResult> researchResult = await researchAgent
.RunAsync<ResearchResult>(
$"Research the following topic: {docRequest.Topic}");
// Step 2: Write the document using the research findings
AgentResponse<DocumentResponse> document = await writerAgent
.RunAsync<DocumentResponse>(
$"""Create a document about {docRequest.Topic}.
Research findings: {researchResult.Result.Findings}""");
// Step 3: Publish
return await context.CallActivityAsync<string>(
nameof(PublishDocument),
new { docRequest.Topic, document.Result.Text });
}
Graph-based workflows with Microsoft Agent Framework
The Durable Task extension also supports Microsoft Agent Framework workflows, which use a declarative, graph-based programming model (WorkflowBuilder) to define multi-step pipelines of executors and agents. The extension automatically checkpoints each step in the graph and recovers from failures without changes to the workflow definition.
Workflows complement orchestrations: use orchestrations for imperative agent coordination with conditional logic, and workflows for fixed graph topologies with type-validated message routing.
Sequential workflow
The following example chains three executors into an order cancellation workflow: look up the order, cancel it, then send a confirmation email.
OrderLookup orderLookup = new();
OrderCancel orderCancel = new();
SendEmail sendEmail = new();
Workflow cancelOrder = new WorkflowBuilder(orderLookup)
.WithName("CancelOrder")
.WithDescription("Cancel an order and notify the customer")
.AddEdge(orderLookup, orderCancel)
.AddEdge(orderCancel, sendEmail)
.Build();
using IHost app = FunctionsApplication
.CreateBuilder(args)
.ConfigureFunctionsWebApplication()
.ConfigureDurableWorkflows(workflows => workflows.AddWorkflows(cancelOrder))
.Build();
app.Run();
The OrderLookup, OrderCancel, and SendEmail executors are standard Microsoft Agent Framework executors with no Durable-specific code. For complete implementations, see the samples on GitHub.
string dtsConnectionString = Environment.GetEnvironmentVariable("DURABLE_TASK_SCHEDULER_CONNECTION_STRING")
?? "Endpoint=http://localhost:8080;TaskHub=default;Authentication=None";
OrderLookup orderLookup = new();
OrderCancel orderCancel = new();
SendEmail sendEmail = new();
Workflow cancelOrder = new WorkflowBuilder(orderLookup)
.WithName("CancelOrder")
.WithDescription("Cancel an order and notify the customer")
.AddEdge(orderLookup, orderCancel)
.AddEdge(orderCancel, sendEmail)
.Build();
IHost host = Host.CreateDefaultBuilder(args)
.ConfigureServices(services =>
{
services.ConfigureDurableWorkflows(
workflowOptions => workflowOptions.AddWorkflow(cancelOrder),
workerBuilder: builder => builder.UseDurableTaskScheduler(dtsConnectionString),
clientBuilder: builder => builder.UseDurableTaskScheduler(dtsConnectionString));
})
.Build();
await host.StartAsync();
IWorkflowClient workflowClient = host.Services.GetRequiredService<IWorkflowClient>();
IAwaitableWorkflowRun run = (IAwaitableWorkflowRun)await workflowClient.RunAsync(cancelOrder, "ORD-12345");
string? result = await run.WaitForCompletionAsync<string>();
The OrderLookup, OrderCancel, and SendEmail executors are standard Microsoft Agent Framework executors with no Durable-specific code. For complete implementations, see the samples on GitHub.
Fan-out/fan-in (concurrent) workflow
You can fan out to multiple executors or agents that run in parallel, then fan in to aggregate the results. The following example sends a science question to a physicist and chemist agent in parallel, then aggregates their responses.
ChatClient chatClient = new AzureOpenAIClient(
new Uri(endpoint), new DefaultAzureCredential()).GetChatClient(deploymentName);
AIAgent physicist = chatClient.AsAIAgent(
"You are a physics expert. Be concise (2-3 sentences).", "Physicist");
AIAgent chemist = chatClient.AsAIAgent(
"You are a chemistry expert. Be concise (2-3 sentences).", "Chemist");
ParseQuestionExecutor parseQuestion = new();
AggregatorExecutor aggregator = new();
Workflow workflow = new WorkflowBuilder(parseQuestion)
.WithName("ExpertReview")
.AddFanOutEdge(parseQuestion, [physicist, chemist])
.AddFanInBarrierEdge([physicist, chemist], aggregator)
.Build();
using IHost app = FunctionsApplication
.CreateBuilder(args)
.ConfigureFunctionsWebApplication()
.ConfigureDurableWorkflows(workflows => workflows.AddWorkflows(workflow))
.Build();
app.Run();
The ParseQuestionExecutor and AggregatorExecutor are standard Microsoft Agent Framework executors with no Durable-specific code. For complete implementations, see the samples on GitHub.
string dtsConnectionString = Environment.GetEnvironmentVariable("DURABLE_TASK_SCHEDULER_CONNECTION_STRING")
?? "Endpoint=http://localhost:8080;TaskHub=default;Authentication=None";
ChatClient chatClient = new AzureOpenAIClient(
new Uri(endpoint), new DefaultAzureCredential()).GetChatClient(deploymentName);
ParseQuestionExecutor parseQuestion = new();
AIAgent physicist = chatClient.AsAIAgent(
"You are a physics expert. Be concise (2-3 sentences).", "Physicist");
AIAgent chemist = chatClient.AsAIAgent(
"You are a chemistry expert. Be concise (2-3 sentences).", "Chemist");
AggregatorExecutor aggregator = new();
Workflow workflow = new WorkflowBuilder(parseQuestion)
.WithName("ExpertReview")
.AddFanOutEdge(parseQuestion, [physicist, chemist])
.AddFanInBarrierEdge([physicist, chemist], aggregator)
.Build();
IHost host = Host.CreateDefaultBuilder(args)
.ConfigureServices(services =>
{
services.ConfigureDurableOptions(
options => options.Workflows.AddWorkflow(workflow),
workerBuilder: builder => builder.UseDurableTaskScheduler(dtsConnectionString),
clientBuilder: builder => builder.UseDurableTaskScheduler(dtsConnectionString));
})
.Build();
await host.StartAsync();
IWorkflowClient workflowClient = host.Services.GetRequiredService<IWorkflowClient>();
IWorkflowRun run = await workflowClient.RunAsync(workflow, "Why is the sky blue?");
if (run is IAwaitableWorkflowRun awaitableRun)
{
string? result = await awaitableRun.WaitForCompletionAsync<string>();
Console.WriteLine(result);
}
The ParseQuestionExecutor and AggregatorExecutor are standard Microsoft Agent Framework executors with no Durable-specific code. For complete implementations, see the samples on GitHub.
Conditional routing workflow
You can route execution to different branches based on runtime results. The following example uses a spam detection agent to classify incoming email, then routes to either a spam handler or an email assistant agent.
AIAgent spamDetector = chatClient.AsAIAgent(
"You are a spam detection assistant. Return JSON with is_spam (bool) and reason (string).",
"SpamDetectionAgent");
AIAgent emailAssistant = chatClient.AsAIAgent(
"You are an email assistant. Draft a professional response.",
"EmailAssistantAgent");
SpamHandlerExecutor spamHandler = new();
EmailSenderExecutor emailSender = new();
Workflow workflow = new WorkflowBuilder(spamDetector)
.WithName("EmailClassification")
.AddSwitchCaseEdgeGroup(spamDetector, [
new Case(condition: IsSpamDetected, target: spamHandler),
new Default(target: emailAssistant),
])
.AddEdge(emailAssistant, emailSender)
.Build();
using IHost app = FunctionsApplication
.CreateBuilder(args)
.ConfigureFunctionsWebApplication()
.ConfigureDurableWorkflows(workflows => workflows.AddWorkflows(workflow))
.Build();
app.Run();
The SpamHandlerExecutor and EmailSenderExecutor are standard Microsoft Agent Framework executors with no Durable-specific code. For complete implementations, see the samples on GitHub.
string dtsConnectionString = Environment.GetEnvironmentVariable("DURABLE_TASK_SCHEDULER_CONNECTION_STRING")
?? "Endpoint=http://localhost:8080;TaskHub=default;Authentication=None";
ChatClient chatClient = new AzureOpenAIClient(
new Uri(endpoint), new DefaultAzureCredential()).GetChatClient(deploymentName);
AIAgent spamDetector = chatClient.AsAIAgent(
"You are a spam detection assistant. Return JSON with is_spam (bool) and reason (string).",
"SpamDetectionAgent");
AIAgent emailAssistant = chatClient.AsAIAgent(
"You are an email assistant. Draft a professional response.",
"EmailAssistantAgent");
SpamHandlerExecutor spamHandler = new();
EmailSenderExecutor emailSender = new();
Workflow workflow = new WorkflowBuilder(spamDetector)
.WithName("EmailClassification")
.AddSwitchCaseEdgeGroup(spamDetector, [
new Case(condition: IsSpamDetected, target: spamHandler),
new Default(target: emailAssistant),
])
.AddEdge(emailAssistant, emailSender)
.Build();
IHost host = Host.CreateDefaultBuilder(args)
.ConfigureServices(services =>
{
services.ConfigureDurableWorkflows(
workflowOptions => workflowOptions.AddWorkflow(workflow),
workerBuilder: builder => builder.UseDurableTaskScheduler(dtsConnectionString),
clientBuilder: builder => builder.UseDurableTaskScheduler(dtsConnectionString));
})
.Build();
await host.StartAsync();
IWorkflowClient workflowClient = host.Services.GetRequiredService<IWorkflowClient>();
IAwaitableWorkflowRun run = (IAwaitableWorkflowRun)await workflowClient.RunAsync(workflow, "Check this email for spam");
string? result = await run.WaitForCompletionAsync<string>();
The SpamHandlerExecutor and EmailSenderExecutor are standard Microsoft Agent Framework executors with no Durable-specific code. For complete implementations, see the samples on GitHub.
Human-in-the-loop (HITL) workflow
You can pause workflow execution at designated points to wait for external input before continuing. The Microsoft Agent Framework workflow model uses RequestPort nodes (in .NET) or ctx.request_info() (in Python) to define pause points. The following example implements an expense reimbursement workflow with a manager approval followed by parallel budget and compliance approvals.
CreateApprovalRequest createRequest = new();
RequestPort<ApprovalRequest, ApprovalResponse> managerApproval =
RequestPort.Create<ApprovalRequest, ApprovalResponse>("ManagerApproval");
PrepareFinanceReview prepareFinanceReview = new();
RequestPort<ApprovalRequest, ApprovalResponse> budgetApproval =
RequestPort.Create<ApprovalRequest, ApprovalResponse>("BudgetApproval");
RequestPort<ApprovalRequest, ApprovalResponse> complianceApproval =
RequestPort.Create<ApprovalRequest, ApprovalResponse>("ComplianceApproval");
ExpenseReimburse reimburse = new();
Workflow expenseApproval = new WorkflowBuilder(createRequest)
.WithName("ExpenseReimbursement")
.WithDescription("Expense reimbursement with manager and parallel finance approvals")
.AddEdge(createRequest, managerApproval)
.AddEdge(managerApproval, prepareFinanceReview)
.AddFanOutEdge(prepareFinanceReview, [budgetApproval, complianceApproval])
.AddFanInBarrierEdge([budgetApproval, complianceApproval], reimburse)
.Build();
using IHost app = FunctionsApplication
.CreateBuilder(args)
.ConfigureFunctionsWebApplication()
.ConfigureDurableWorkflows(workflows =>
workflows.AddWorkflow(expenseApproval, exposeStatusEndpoint: true))
.Build();
app.Run();
The framework auto-generates three HTTP endpoints for HITL interaction.
POST /api/workflows/{name}/run: Start the workflowGET /api/workflows/{name}/status/{id}: Check status and pending approvalsPOST /api/workflows/{name}/respond/{id}: Send approval response to resume
The following record types define the data flowing through the workflow:
public record ApprovalRequest(string ExpenseId, decimal Amount, string EmployeeName);
public record ApprovalResponse(bool Approved, string? Comments);
The CreateApprovalRequest, PrepareFinanceReview, and ExpenseReimburse executors are standard Microsoft Agent Framework executors with no Durable-specific code. For complete implementations, see the samples on GitHub.
string dtsConnectionString = Environment.GetEnvironmentVariable("DURABLE_TASK_SCHEDULER_CONNECTION_STRING")
?? "Endpoint=http://localhost:8080;TaskHub=default;Authentication=None";
CreateApprovalRequest createRequest = new();
RequestPort<ApprovalRequest, ApprovalResponse> managerApproval =
RequestPort.Create<ApprovalRequest, ApprovalResponse>("ManagerApproval");
PrepareFinanceReview prepareFinanceReview = new();
RequestPort<ApprovalRequest, ApprovalResponse> budgetApproval =
RequestPort.Create<ApprovalRequest, ApprovalResponse>("BudgetApproval");
RequestPort<ApprovalRequest, ApprovalResponse> complianceApproval =
RequestPort.Create<ApprovalRequest, ApprovalResponse>("ComplianceApproval");
ExpenseReimburse reimburse = new();
Workflow expenseApproval = new WorkflowBuilder(createRequest)
.WithName("ExpenseReimbursement")
.AddEdge(createRequest, managerApproval)
.AddEdge(managerApproval, prepareFinanceReview)
.AddFanOutEdge(prepareFinanceReview, [budgetApproval, complianceApproval])
.AddFanInBarrierEdge([budgetApproval, complianceApproval], reimburse)
.Build();
IHost host = Host.CreateDefaultBuilder(args)
.ConfigureServices(services =>
{
services.ConfigureDurableWorkflows(
options => options.AddWorkflow(expenseApproval),
workerBuilder: builder => builder.UseDurableTaskScheduler(dtsConnectionString),
clientBuilder: builder => builder.UseDurableTaskScheduler(dtsConnectionString));
})
.Build();
await host.StartAsync();
IWorkflowClient workflowClient = host.Services.GetRequiredService<IWorkflowClient>();
IStreamingWorkflowRun run = await workflowClient.StreamAsync(expenseApproval, "EXP-2025-001");
await foreach (WorkflowEvent evt in run.WatchStreamAsync())
{
switch (evt)
{
case DurableWorkflowWaitingForInputEvent requestEvent:
Console.WriteLine($"Workflow paused at: {requestEvent.RequestPort.Id}");
ApprovalResponse approval = new(Approved: true, Comments: "Approved.");
await run.SendResponseAsync(requestEvent, approval);
break;
case DurableWorkflowCompletedEvent completedEvent:
Console.WriteLine($"Workflow completed: {completedEvent.Result}");
break;
}
}
The following record types define the data flowing through the workflow:
public record ApprovalRequest(string ExpenseId, decimal Amount, string EmployeeName);
public record ApprovalResponse(bool Approved, string? Comments);
The CreateApprovalRequest, PrepareFinanceReview, and ExpenseReimburse executors are standard Microsoft Agent Framework executors with no Durable-specific code. For complete implementations, see the samples on GitHub.
Durable Task Scheduler dashboard
Use the Durable Task Scheduler dashboard for full visibility into your durable agents, orchestrations, and graph-based workflows:
- View conversation history for each agent session
- Inspect tool calls and structured outputs
- Trace orchestration and workflow execution flows
- Monitor performance metrics
Both local development (via the emulator) and production deployments surface the same dashboard experience.
The application must use the Durable Task Scheduler backend and the same task hub that you open in the dashboard. The Python Functions samples default to Azure Storage; starting the scheduler emulator alone doesn't switch their backend. Configure the Functions storage provider and scheduler connection before expecting those sessions to appear here.
The following screenshot shows an agent session with its conversation history and session details:
The following screenshot shows a deterministic orchestration with activity execution details:
Session time-to-live (TTL) for durable agents
Durable agent sessions automatically maintain conversation history and state, which can accumulate indefinitely. The time-to-live (TTL) feature provides automatic cleanup of idle sessions, preventing storage resource consumption and increased costs.
When an agent session is idle for longer than an applicable TTL period, it becomes eligible for deletion. Each new interaction resets the TTL timer, extending the session's lifetime. Cleanup isn't an exact-time deletion guarantee.
Default values
- Legacy .NET default TTL: 14 days. In schema-v2 receipt-bearing state, the unconfigured legacy default doesn't automatically delete the entity. Configure a global or per-agent TTL explicitly if you want idle-session deletion.
- Default .NET minimum TTL deletion delay: 5 minutes. This scheduling floor isn't a retention period.
Configuration
TTL can be configured globally or per-agent. When an agent session expires, its entire state is deleted, including conversation history and any custom state data. If a message is sent to the same session after deletion, a new session is created with a fresh conversation history.
Note
The following TTL configuration applies to .NET. Python retention and state-budget options are separate from this whole-session TTL policy.
services.ConfigureDurableAgents(
options =>
{
// Set global default TTL to 7 days
options.DefaultTimeToLive = TimeSpan.FromDays(7);
// Agent with custom TTL of 1 day
options.AddAIAgent(shortLivedAgent, timeToLive: TimeSpan.FromDays(1));
// Agent with custom TTL of 90 days
options.AddAIAgent(longLivedAgent, timeToLive: TimeSpan.FromDays(90));
// Agent using global default (7 days)
options.AddAIAgent(defaultAgent);
// null doesn't override the global default: this agent also uses 7 days
options.AddAIAgent(inheritedAgent, timeToLive: null);
});
To disable the global TTL for agents without a positive per-agent override, set options.DefaultTimeToLive = null. Passing timeToLive: null to AddAIAgent doesn't create a per-agent "never expires" override.
Separate session, history, and result policies
Whole-session TTL deletes the entity, including its conversation and completion receipts. Result-payload retention controls how long a completed response remains available; in .NET, ResultRetentionPeriod defaults to 60 seconds. A retained completion receipt can still identify a successful or failed operation after its result payload becomes unavailable.
Durable transcript retention and model-input compaction solve different problems. .NET defaults to DurableAgentHistoryRetentionMode.KeepAll; opt into Auto for pressure-based transcript retention. Python exposes retention and state budgets through its host options. Model-input compaction reduces context sent to the model and doesn't necessarily remove durable history. See the .NET lifecycle guide and Python retention guide for their distinct defaults and limits.
Python also supports optional SDK-managed Blob payload offloading. This transport feature doesn't remove entity-state capacity limits or replace retention. Session deletion, result expiry, and orchestration purge don't delete these payload blobs. Configure Blob lifecycle separately, retaining blobs while durable state or replay history still references them.
Upgrade existing deployments
Schema-v2 state and versioned entity identities require a deployment plan. Don't replace all workers on an existing hub and assume every session or workflow history can resume.
- .NET: New sessions use the
dafx-v2-entity namespace. Keep legacy processing disabled while v1 workers remain active. EnableProcessLegacyEntitiesonly after all v1 workers stop. Side-by-side Functions hosts require compatible host-side work-item filtering; distinct trigger names alone aren't isolation. Without filtering, use an offline cutover. See the .NET upgrade and filtering requirements. - Python: Explicitly choose
two_phasewith Durable Task Scheduler filtering, orisolated_v2for an isolated deployment with upgraded workers and clients. The two-phase path supports eligible in-place entity upgrades; a new task hub isn't required for every migration. Keep compatible filtered workers available during coexistence, and stop old workers before enabling historical-name processing. See Python entity migration. - Python workflow histories: Entity migration doesn't repair replay compatibility. Affected older workflow histories, including older v2 histories, must finish on their original workers and hub. Start fresh workflow instances on the upgraded runtime. See the Python runtime compatibility guidance.
Known limitations
Maximum conversation size.
Agent session state is subject to the state-size limits of the durable backend. When using the Durable Task Scheduler, the maximum entity state size is 1 MB. History retention can remove eligible transcript content, but protected state, completion receipts, and live results also consume capacity. Neither compaction nor Blob payload offloading guarantees that an entity fits. Configure state budgets, monitor capacity failures, and use a new session when the protected state can't fit.Latency.
All agent interactions are routed through the Durable Task Scheduler, which adds latency compared to in-memory agent execution. This tradeoff provides durability and distributed scaling.Streaming.
Since durable agents are implemented on top of durable entities, the underlying communication model is request/response. Streaming is supported through response callbacks (for example, pushing tokens to a Redis Stream for client consumption), while the entity returns the complete response after the stream finishes.In the Python Redis streaming sample, chunks and the completion marker are provisional. They can arrive before retention checks and the durable commit. Confirm the authoritative result separately before treating streamed output as committed.
TTL expiration.
The TTL timer is based on wall-clock time since the last message, not cumulative activity time. Once a session is deleted (via TTL expiration or manual deletion), its conversation history can't be recovered.
Production checks and troubleshooting
For generated .NET Functions agent endpoints, 202 Accepted acknowledges dispatch, not successful execution. A waiting request returns 200 for an available committed success, or 500 for a supported committed terminal failure. 410 Gone means completion is known but the result is unavailable; the retained outcome can be succeeded or failed. It isn't necessarily execution failure or only result expiry. Don't automatically submit a new operation after 410. These are agent endpoint semantics, not the Durable Functions orchestration status API. See agent completion outcomes.
Separate application-user authorization from Functions keys, model credentials, and scheduler access. Enforce ownership before accepting session IDs or approval responses; session and request IDs are identifiers, not authorization. Grant model and scheduler permissions to the intended worker or client identity.
| Symptom | Check |
|---|---|
| Python Functions host fails to load or start | Use Python 3.13 or later, install the packages in Agent hosting, and explicitly select a deployment strategy. |
| No sessions appear in the scheduler dashboard | Verify that the application uses the scheduler backend, not Azure Storage, and that endpoint and task hub match the dashboard. |
| Old runs fail after an upgrade | Check worker generation, dispatch filters, entity migration prerequisites, and workflow replay compatibility before resuming historical runs. |
| State writes fail despite compaction | Inspect whole-entity capacity, protected state, and retention settings. Model-context size alone doesn't measure stored entity size. |
| A stream finishes but the result isn't available | Check the durable completion outcome and result-retention policy; stream markers aren't durable commit evidence. |
Additional capabilities
The following advanced patterns are available in the samples on GitHub but aren't covered in detail in this article:
| Pattern | Description |
|---|---|
| Long-running tools | Agents can start durable orchestrations from tool calls, enabling tools that run for extended periods with progress tracking. |
| Agent as MCP tool | Expose durable agents as Model Context Protocol (MCP) tools, allowing other agents or clients to invoke them through a standard interface. |
| Reliable streaming | Use Redis Streams (or similar transports) for resumable token streaming that survives client disconnects and reconnections. |
Related links
For complete code samples:
For complete code samples: