Registry / llm-agents / agent-framework-durabletask

agent-framework-durabletask

JSON →
library1.0.0b260521pypypiunverified

The `agent-framework-durabletask` library provides robust integration for orchestrating long-running agent operations within the Microsoft Agent Framework, leveraging the capabilities of Durable Task (often via Azure Durable Functions). It enables complex, stateful workflows for agent-based systems. The current version is `1.0.0b260409`, indicating a beta phase with potentially frequent updates as it evolves alongside the core `agent-framework` library.

pip install agent-framework-durabletask
INSTALL
IMPORT
SIG · AGENT-FRAMEWORK-DU
A
agent-framework-durabletask
llm-agentspythonv1.0.0b260521
Install
7.0s avg
Import
Disk
80MB
Pass rate
8/ 10
Env Coverage8 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.0.0b260521 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
glibc
py 3.10
✓ —
✓ 8.9s
py 3.11
✓ —
✓ 7.28s
py 3.12
✓ —
✓ 5.9s
py 3.13
✓ —
✓ 6.1s
py 3.9
✕ build_error
✕ build_error
80MB installed
● package 80MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

DurableTaskOrchestrator
from agent_framework_durabletask.orchestration import DurableTaskOrchestrator
DurableTaskOrchestrationContext
from agent_framework_durabletask.orchestration import DurableTaskOrchestrationContext
DurableTaskClient
from agent_framework_durabletask.client import DurableTaskClient
AzureDurableTaskClient
from agent_framework_durabletask.azure import AzureDurableTaskClient
Use this specific client for interactions with Azure Durable Functions.

This quickstart demonstrates how to define a `DurableTaskOrchestrator` and initialize an `AzureDurableTaskClient`. To make the client fully functional and execute orchestrations, you must set the `AZURE_STORAGE_CONNECTION_STRING` environment variable, pointing to an Azure Storage Account that backs an Azure Functions app running Durable Functions.

import os from agent_framework_durabletask.orchestration import ( DurableTaskOrchestrator, DurableTaskOrchestrationContext, ) from agent_framework_durabletask.client import DurableTaskClient from agent_framework_durabletask.azure import AzureDurableTaskClient # 1. Define a Durable Task Orchestrator class MySimpleOrchestrator(DurableTaskOrchestrator): """ A simple orchestrator that logs its input and returns a processed string. In a real scenario, this would coordinate calls to 'activities'. """ async def orchestrate(self, context: DurableTaskOrchestrationContext, input_data: str): print(f"Orchestrator '{context.instance_id}' received input: '{input_data}'") # Simulate some async work by returning immediately for this example return f"Processed '{input_data}' at {context.current_utc_datetime}" # 2. Instantiate a Durable Task Client (e.g., for Azure Durable Functions) # This client requires connection details to an Azure Storage Account # which is used by Azure Durable Functions to manage orchestration state. azure_storage_connection_string = os.environ.get("AZURE_STORAGE_CONNECTION_STRING", "") task_hub_name = os.environ.get("DURABLETASK_HUB_NAME", "DefaultTaskHub") if azure_storage_connection_string: print("Initializing AzureDurableTaskClient...") try: client = AzureDurableTaskClient( task_hub_name=task_hub_name, azure_storage_connection_string=azure_storage_connection_string ) print(f"AzureDurableTaskClient initialized for task hub '{task_hub_name}'.") # In a real application, you would then use `client` to start and manage orchestrations: # import asyncio # async def run_orchestration(): # instance_id = await client.start_orchestration(MySimpleOrchestrator, "Hello DurableTask!") # print(f"Started orchestration with ID: {instance_id}") # # You'd typically poll or wait for the orchestration to complete # # status = await client.get_orchestration_status(instance_id) # # while status.runtime_status not in [OrchestrationRuntimeStatus.Completed, OrchestrationRuntimeStatus.Failed, OrchestrationRuntimeStatus.Terminated]: # # await asyncio.sleep(5) # # status = await client.get_orchestration_status(instance_id) # # print(f"Orchestration {instance_id} finished with status: {status.runtime_status}") # asyncio.run(run_orchestration()) except Exception as e: print(f"Failed to initialize AzureDurableTaskClient: {e}") print("Please ensure AZURE_STORAGE_CONNECTION_STRING is valid and points to an Azure Storage Account.") else: print("AZURE_STORAGE_CONNECTION_STRING environment variable not set.") print("Cannot initialize AzureDurableTaskClient without storage connection details.") print("To run this, ensure you have an Azure Storage Account and set its connection string.") print("\n--- Example finished. This code defines an orchestrator and attempts to initialize a client. ---") print("To execute orchestrations, you need a Durable Task backend host (e.g., Azure Functions).")
Debug
Known issues
breakingThe library is currently in a beta (`1.0.0b...`) state, which means its API is subject to change without strict backward compatibility guarantees between minor or even patch versions. Expect breaking changes.
fix
Always pin to a specific version (`agent-framework-durabletask==X.Y.Z`) and thoroughly test updates. Monitor the official GitHub repository for release notes.
affects: <=1.0.0b260409
gotchaOrchestrator functions must be deterministic. Any non-deterministic operations (e.g., direct I/O, generating random numbers, using `datetime.now()` without `context.current_utc_datetime`) can lead to replay issues, where the orchestration behaves differently on replay, causing runtime errors.
fix
Use `DurableTaskOrchestrationContext` methods for all side-effecting operations (e.g., `context.call_activity`, `context.current_utc_datetime`). Avoid any non-deterministic code paths within the orchestrator function itself.
affects: All versions
gotchaUsing `AzureDurableTaskClient` (the most common client) requires an Azure Storage Account and an Azure Functions app configured to host Durable Functions. Without this backend, the client cannot communicate with an orchestrator runtime.
fix
Set up an Azure Storage Account and an Azure Functions app with Durable Functions enabled. Provide the storage account's connection string via the `AZURE_STORAGE_CONNECTION_STRING` environment variable or directly to the client constructor.
affects: All versions using Azure integration
deprecatedWhile not explicitly deprecated yet, reliance on older versions of `azure-functions-durable` or `azure-storage-queue` can lead to compatibility issues with newer Azure services or Python runtimes. Always ensure these dependencies are up-to-date.
fix
Regularly update `agent-framework-durabletask` and its core `azure-*` dependencies. Check PyPI for the latest compatible versions.
affects: Implicitly affects older underlying Azure dependencies
Upgrade
Version history
1.0.0b260521latest on PyPI · released May 22, 2026
Audit
Dependencies
agent-frameworkrequiredCore dependency for Microsoft Agent Framework integration.
azure-functions-durableoptionalProvides the underlying Durable Task framework for Azure-based orchestration.
azure-storage-queueoptionalUsed for state management and task queuing when interacting with Azure Durable Functions.
Agent activity
63 hits · last 30 days
node
56
OpenAI (training)
1
Resources