Registry / azure / azure-functions-durable

azure-functions-durable

JSON →
library1.7.0pypypi✓ verified 22d ago

Durable Functions is an extension of Azure Functions that enables developers to write stateful functions in a serverless environment. It allows defining stateful workflows using orchestrator functions and stateful entities with entity functions. The extension automatically manages state, checkpoints, and restarts, abstracting away complex state management concerns. The current stable version is 1.5.0, with ongoing active development and regular releases.

pip install azure-functions-durable
INSTALL
IMPORT
SIG · AZURE-FUNCTIONS-DU
A
azure-functions-durable
azurepythonv1.7.0
Install
5.7s avg
Import
927ms
Disk
40MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.7.0 · 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
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.974s · 39.5MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 5.7s · import 0.880s · 42MB
40MB installed
● package 40MB
Code
Verified usage

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

DurableOrchestrationContext
from azure.durable_functions import DurableOrchestrationContext
Represents the context for an orchestration function's execution.
DurableOrchestrationClient
from azure.durable_functions import DurableOrchestrationClient
Represents the client for interacting with Durable Functions orchestrations.
Blueprint
from azure.durable_functions import Blueprint
Used to organize Durable Functions (orchestrators, activities, clients) into modular blueprints in the v2 programming model.
orchestration_trigger
from azure.durable_functions import orchestration_trigger
Decorator for defining an orchestrator function.
activity_trigger
from azure.durable_functions import activity_trigger
Decorator for defining an activity function.
durable_client_input
from azure.durable_functions import durable_client_input
Decorator for injecting a Durable Functions client into a starter function (e.g., HTTP trigger).

This quickstart demonstrates a basic 'Hello World' Durable Functions application using the Python v2 programming model and blueprints. It includes an HTTP-triggered starter function, an orchestrator function that calls an activity function multiple times in parallel (fan-out/fan-in pattern), and the activity function itself. To run this, you would typically set up an Azure Functions project locally, install `azure-functions-durable`, and ensure `AzureWebJobsStorage` is configured (e.g., to `UseDevelopmentStorage=true` for local Azurite).

import logging import os import azure.functions as func import azure.durable_functions as df # Instantiate a Durable Functions Blueprint bp = df.Blueprint() # An HTTP-triggered function that starts an instance of the orchestration @bp.route(route="startOrchestrator") @bp.durable_client_input(client_name="client") async def start_orchestrator(req: func.HttpRequest, client: df.DurableOrchestrationClient): orchestration_id = await client.start_new("my_orchestrator", None, "World") logging.info(f"Started orchestration with ID = '{orchestration_id}'.") return client.create_check_status_response(req, orchestration_id) # The orchestrator function, which orchestrates calls to other functions @bp.orchestration_trigger(context_name="context") def my_orchestrator(context: df.DurableOrchestrationContext): # The orchestrator is deterministic, so use context.call_activity for side-effects result1 = yield context.call_activity('say_hello', "Tokyo") result2 = yield context.call_activity('say_hello', "Seattle") result3 = yield context.call_activity('say_hello', "London") return [result1, result2, result3] # An activity function, which performs the actual work @bp.activity_trigger(input_name="city") def say_hello(city: str) -> str: logging.info(f"Saying hello to {city}.") return f"Hello {city}!" # In your main function_app.py, register the blueprint: # import azure.functions as func # from your_module_name import bp # app = func.FunctionApp() # app.register_functions(bp)
Debug
Known issues
gotchaOrchestrator functions MUST be deterministic. Avoid using non-deterministic APIs like `datetime.now()`, `datetime.utcnow()`, `random.*`, static variables, or environment variables directly within orchestrators. Instead, use `context.current_utc_datetime` for time or pass non-deterministic values via activity function results or as inputs to the orchestrator. Violating this can lead to `NonDeterministicOrchestrationException` due to replay mismatches.
fix
Replace non-deterministic calls with `context.current_utc_datetime` or encapsulate non-deterministic logic within activity functions, passing their results back to the orchestrator. Avoid modifying orchestrator code for active instances without careful planning.
affects: All versions
breakingVersion 1.2.7 of `azure-functions-durable` was yanked from PyPI due to a critical startup error. Installing or running this specific version will lead to failures.
fix
Ensure you are using `azure-functions-durable` version 1.2.8 or higher. If you encounter issues, explicitly upgrade your package: `pip install --upgrade azure-functions-durable>=1.2.8`.
affects: 1.2.7
gotchaThe Python version requirement has been updated. Older versions (e.g., Python 3.6) are no longer supported. The library now requires Python 3.9 or higher.
fix
Ensure your Azure Functions project and local development environment use Python 3.9 or a newer supported version (e.g., 3.10, 3.11).
affects: <1.3.1 (for Python 3.6 support), all versions (for current >=3.9)
gotchaLocal development of Durable Functions requires a storage emulator (like Azurite) or a connection to an Azure Storage account. Without it, functions will fail to start or store state.
fix
For local development, install and start Azurite, and ensure your `local.settings.json` has `"AzureWebJobsStorage": "UseDevelopmentStorage=true"`. For cloud deployment, configure `AzureWebJobsStorage` to an Azure Storage account connection string.
affects: All versions
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'azure.durable_functions'
The `azure-functions-durable` package is not correctly installed or accessible within the Python environment used by the Azure Functions runtime. This often happens due to issues with virtual environments, `requirements.txt` file, or deployment processes where dependencies are not properly packaged or located.
fix
Ensure 'azure-functions-durable' is listed in your `requirements.txt` file. For local development, activate your virtual environment (`.venv\Scripts\activate` on Windows or `source .venv/bin/activate` on Linux/macOS) and run `pip install -r requirements.txt`. For deployment, ensure your deployment process correctly installs dependencies and considers remote build settings if necessary.
The function 'XYZ' doesn't exist, is disabled, or is not an orchestrator function.
The Azure Functions host cannot find or correctly identify the specified orchestrator, activity, or entity function. This can occur due to mismatches between the function's actual name and the name used in calls (e.g., `client.start_new()`), incorrect `function.json` configuration, or deployment issues preventing the function from being registered.
fix
Verify that the function name in your Python code (e.g., `@app.orchestration('MyOrchestrator')`) precisely matches the name used when starting the orchestration (e.g., `client.start_new('MyOrchestrator', ...)`). Ensure your function app is properly deployed and all function definitions are correctly structured and discoverable by the Azure Functions host. Check logs for any startup errors related to function loading.
Orchestration is stuck in the Pending state
The orchestration has been scheduled but has not been picked up by an available worker, or it is stuck in the 'Running' state without making progress. Common causes include transient issues, resource exhaustion, problems with internal control queues in Azure Storage, or an activity/timer/external event it's waiting for is not completing.
fix
Try restarting your function app. Check Application Insights for detailed logs, errors, or warnings, especially within the Durable Task Framework traces. Inspect the Azure Storage account's control queues for the function app to see if any queues are growing continuously, which might indicate a backlog. If memory is a concern, consider configuring your app's platform to 64-bit.
binding type "'client'" and dataType "durableClient" in the binding decorator do not match the corresponding function parameter's Python type annotation DurableOrchestrationClient
This specific error indicates a type mismatch between how a Durable Functions client binding is declared (either in `function.json` or via Python decorators) and the Python type annotation provided for the corresponding function parameter. This often surfaces with specific Python versions or updates to the Durable Functions extension, where stricter type checking is applied.
fix
Ensure that the type hint for the Durable Functions client parameter in your Python function signature is correct, usually `azure.durable_functions.DurableOrchestrationClient` (or `durable_functions.DurableOrchestrationClient` if aliased). Verify that your `azure-functions-durable` library version and Azure Functions runtime version are compatible with your Python version, as this issue can arise from versioning discrepancies. For Python v2 model, explicitly use the correct type from the `azure.durable_functions` module.
Upgrade
Version history
1.7.0latest on PyPI · released Jul 30, 2026
Audit
Dependencies
azure-functionsrequiredCore library for Azure Functions programming model, providing decorators and runtime context.
aiohttprequiredUsed for HTTP operations; updated in v1.3.3.
Agent activity
45 hits · last 30 days
node
38
OpenAI (training)
1
Resources
azure-functions-durable — pip install azure-functions-durable · libregistry