Skip to content

Latest commit

 

History

History
312 lines (245 loc) · 28.5 KB

README.md

File metadata and controls

312 lines (245 loc) · 28.5 KB

📚 Sample Catalog

Explore a comprehensive collection of samples for building durable, fault-tolerant workflows with Azure Durable Task Scheduler. Whether you're just getting started or building advanced AI agents, there's a sample for you.

Prerequisites: Most samples require Docker to run the Durable Task Scheduler emulator locally. See each sample's README for specific setup instructions.


🚀 Start Here

New to Durable Task Scheduler? Start with the Function Chaining sample in your preferred language:

Language Sample Description
.NET Function Chaining Sequential workflow with data transformation
Python Function Chaining Sequential workflow basics
Java Function Chaining Sequential workflow basics
JavaScript Function Chaining Sequential workflow basics
Go Function Chaining Worker and client in one runnable package (Go 1.25+, beta SDK)

📋 Samples by Pattern

A quick-reference matrix showing which patterns are available in each language and framework.

Durable Task SDKs

Pattern .NET Python Java JavaScript Go (beta)
Function Chaining ✅ ✅ ✅ ✅ ✅
Fan-out/Fan-in ✅ ✅ ✅ ✅ ✅
Human Interaction ✅ ✅ ✅ ✅
Async HTTP API ✅ ✅ ✅
Monitoring ✅ ✅ ✅ ✅
Sub-orchestrations ✅ ✅ ✅ ✅
Eternal Orchestrations ✅ ✅ ✅ ✅
Saga Pattern ✅ ✅
Durable Entities ✅ ✅ ✅ ✅
Orchestration Versioning ✅ ✅ ✅
ASP.NET Web API ✅
Scheduled Tasks ✅ ✅ ✅
.NET Aspire Integration ✅
AI Agent Chaining ✅
AI Research Agent ✅
Large Payload ✅ ✅ ✅
Export History ✅ ✅ ✅
Bounded Coordinator ✅ ✅ ✅
OpenTelemetry Tracing ✅ ✅ ✅ ✅
Agent-Directed Workflows ✅ ✅
Orchestration Management ✅ ✅
Work Item Filtering ✅ ✅ ✅ ✅
In-Memory Testing ✅ ✅

See the Go samples for setup.

Durable Functions

Pattern .NET Python Java JavaScript TypeScript PowerShell
Hello Cities (Quickstart) ✅ ✅ ✅ ✅ ✅ ✅
Fan-out/Fan-in ✅ ✅ ✅ ✅ ✅ ✅
Order Processor ✅
Saga Pattern ✅
Distributed Tracing ✅
Large Payload ✅
Large Payload Fan-out/Fan-in ✅
AI Travel Planner ✅
Aspire Integration ✅
Agent-Directed Workflows ✅ ✅
Durable Entities ✅
Work Item Filtering ✅ ✅
Custom Exception Properties ✅ ✅
Critical Sections ✅ ✅

Durable Task SDKs

.NET

Sample Pattern Description
Function Chaining Function Chaining Sequential workflow with data transformation
Fan-out/Fan-in Fan-out/Fan-in Parallel execution and result aggregation
Human Interaction Human Interaction Approval workflow with external events and timeouts
Durable Entities Durable Entities Funds transfer using stateful distributed objects
Orchestration Versioning Versioning Safe evolution of running orchestrations
ASP.NET Web API Web API Web API running orchestrations
Scheduled Tasks Scheduled Tasks Recurring background tasks with scheduled orchestrations
.NET Aspire Integration Aspire Local dev orchestration with Aspire
AI Agent Chaining AI Agents Multi-agent workflow with research, content, and image agents
Monitoring Monitoring Periodic polling pattern with ContinueAsNew
Sub-Orchestrations Sub-orchestrations Parent/child orchestration composition for order processing
Eternal Orchestrations Eternal Orchestrations Indefinitely running orchestration with ContinueAsNew
OpenTelemetry Tracing Observability Distributed tracing with OpenTelemetry and Jaeger
Large Payload Large Payload Blob-backed payload externalization for orchestration inputs and outputs larger than 1 MB
Export History Export History REST API for batch and continuous orchestration history export to Azure Blob Storage
Bounded Coordinator Bounded Coordinator Process child work in bounded batches and reset history with ContinueAsNew
Agent-Directed Workflows AI Agents Entity-based agent loop with tool calling and Redis-backed response streaming

Python

Sample Pattern Description
Function Chaining Function Chaining Sequential workflow basics
Fan-out/Fan-in Fan-out/Fan-in Parallel execution and result aggregation
Human Interaction Human Interaction Approval workflow with external events and timeouts
Async HTTP API Async HTTP API FastAPI with long-running operations
Monitoring Monitoring Periodic polling pattern
Sub-orchestrations Sub-orchestrations Nested orchestration composition
Eternal Orchestrations Eternal Orchestrations Continue-as-new pattern
Durable Entities Durable Entities Counter entity
Orchestration Versioning Versioning Safe evolution of running orchestrations
AI Research Agent AI Agents Autonomous research agent with arXiv + LLM
Saga Pattern Saga Travel booking with compensating transactions
OpenTelemetry Tracing Observability Distributed tracing with OpenTelemetry and Jaeger
Scheduled Tasks Scheduled Tasks Recurring orchestrations with pause, resume, and schedule management
Export History Export History Export orchestration history to Azure Blob Storage
Bounded Coordinator Bounded Coordinator Process child work in bounded batches and reset history with continue-as-new
Large Payload Large Payload Transparently externalize large payloads to Azure Blob Storage
Orchestration Management Management Query, suspend, resume, terminate, and purge orchestration instances
Work Item Filtering Work Item Filtering Route orchestration and activity work to workers that register matching tasks
In-Memory Testing Testing Test orchestrations and activities without Docker, an emulator, or Azure resources
Agent-Directed Workflows AI Agents Entity-based agent loop with tool calling and response streaming

Java

Sample Pattern Description
Function Chaining Function Chaining Sequential workflow basics
Fan-out/Fan-in Fan-out/Fan-in Parallel execution and result aggregation
Human Interaction Human Interaction Approval workflow with external events and timeouts
Async HTTP API Async HTTP API Long-running operations with HTTP polling
Monitoring Monitoring Periodic polling pattern
Sub-orchestrations Sub-orchestrations Nested orchestration composition
Eternal Orchestrations Eternal Orchestrations Continue-as-new pattern
Durable Entities Durable Entities Counter entity with state persisted across operations
OpenTelemetry Tracing Observability Distributed tracing with OpenTelemetry and Jaeger

JavaScript / TypeScript (preview)

The JavaScript/TypeScript SDK is available in preview. The samples below use JavaScript; see the JavaScript sample guide for prerequisites and setup.

Sample Pattern Description
Function Chaining Function Chaining Sequential workflow basics with JavaScript SDK
Fan-out/Fan-in Fan-out/Fan-in Parallel execution and result aggregation with JavaScript SDK

Go

Requires: Go 1.25.0+. All samples share one module in durable-task-sdks/go that uses github.com/microsoft/durabletask-go v1.0.0-beta3.

From the repository root, with the emulator running:

cd samples/durable-task-sdks/go
go mod download
go run ./function-chaining

Replace function-chaining with any sample name below. Each sample runs its worker and client, prints a result, and exits. To connect to Azure, set DTS_CONNECTION_STRING; see the Go quickstart. Large Payload and Export History also need Blob Storage (Azurite by default). Export History needs a separate task hub; see its README.

Sample Pattern Description
Function Chaining Function Chaining Sequential activities
Fan-out/Fan-in Fan-out/Fan-in Parallel activities and result aggregation
Human Interaction Human Interaction External events with an approval timeout
Async HTTP API Async HTTP API HTTP start/status endpoints and a polling client
Monitoring Monitoring Periodic status checks with durable timers
Sub-orchestrations Sub-orchestrations Parent/child workflow composition
Eternal Orchestrations Eternal Orchestrations Continue-as-new
Durable Entities Durable Entities Persistent entity state and operations
Orchestration Versioning Versioning Register and run versioned tasks
Saga Pattern Saga Compensating activities after a failed step
OpenTelemetry Tracing Observability Application spans and W3C trace context
Bounded Coordinator Bounded Coordinator Bounded child batches with continue-as-new
Large Payload Large Payload Externalize inputs and outputs with the payload extension
Export History History Export (preview) Export terminal orchestration histories with the history extension
Scheduled Tasks Scheduled Tasks Recurring interval schedules and lifecycle management
Orchestration Management Management Query and manage orchestration lifecycle
Testing Testing Offline business-logic tests and DTS integration tests
Work Item Filtering Worker Routing Route work to matching worker registrations

Run go build ./..., go test ./..., and go vet ./... from the Go module. These need no scheduler. Integration tests need DTS_SAMPLES_E2E=1; see the contributor guide.


Durable Functions

.NET

Sample Pattern Description
Hello Cities Quickstart Basic orchestration with 3 activities
Order Processor Order Workflow End-to-end order processing workflow
Saga Pattern Saga Compensating transactions for distributed operations
Aspire Integration Aspire Azure Functions + DTS with Aspire
Large Payload Large Payload Single round-trip orchestration that externalizes payloads larger than 1 MB to blob storage
Large Payload Fan-out/Fan-in Large Payload Parallel orchestration that externalizes payloads larger than 1 MB for each activity result
AI Travel Planner AI Agents Multi-agent travel planning orchestration
Distributed Tracing Observability Distributed tracing with Application Insights and Jaeger
Agent-Directed Workflows AI Agents Entity-based agent loop with tool calling and Redis-backed response streaming
Work Item Filtering Work Item Filtering Route work between two Function apps sharing a task hub
Custom Exception Properties Error Handling Propagate structured exception properties to orchestration failure details

Python

Sample Pattern Description
Hello Cities Quickstart Basic orchestration with greeting activities
Fan-out/Fan-in Fan-out/Fan-in Parallel processing with result aggregation
Agent-Directed Workflows AI Agents Entity-based agent loop with tool calling and response streaming
Work Item Filtering Work Item Filtering Route work between two Function apps sharing a task hub

Java

Sample Pattern Description
Hello Cities Function Chaining, Fan-out/Fan-in Java quickstart with sequential and parallel orchestration patterns
Durable Entities Durable Entities Stateful counter entity

JavaScript

Sample Pattern Description
Hello Cities Function Chaining, Fan-out/Fan-in JavaScript quickstart with sequential and parallel orchestration patterns
Critical Sections Entity Coordination Coordinate access to entities with durable locks
Custom Exception Properties Error Handling Propagate structured exception properties to orchestration failure details

TypeScript

Sample Pattern Description
Hello Cities Function Chaining, Fan-out/Fan-in TypeScript quickstart with sequential and parallel orchestration patterns
Critical Sections Entity Coordination Coordinate access to entities with durable locks

PowerShell

Sample Pattern Description
Hello Cities Function Chaining, Fan-out/Fan-in PowerShell quickstart with sequential and parallel orchestration patterns

Durable Extension for Microsoft Agent Framework

The Durable Task extension for Microsoft Agent Framework lets you make any Microsoft Agent Framework agent durable with persistent sessions, built-in API endpoints, and distributed scaling, without changes to your agent logic. It also supports graph-based workflows via WorkflowBuilder.

Setup: These samples live in the microsoft/agent-framework repo and are included here via a Git submodule. Run git submodule update --init external/agent-framework after cloning.

The links below open the samples at the pinned submodule revision in the upstream repository. This keeps navigation consistent with the included code even when upstream reorganizes its samples. The local sample directories are symlinks into the submodule and cannot be browsed through GitHub as ordinary directories.

📂 Full details and sample index →

Durable Agents (.NET)

Sample Hosting Description
Single Agent Azure Functions Basic durable agent with persistent sessions
Orchestration Chaining Azure Functions Multi-agent sequential orchestration
Orchestration Concurrency Azure Functions Parallel agent execution (fan-out/fan-in)
Orchestration Conditionals Azure Functions Conditional routing between agents
Human-in-the-Loop Azure Functions Agent pauses for human approval
Reliable Streaming Azure Functions Real-time token streaming with durability
Single Agent Console App Same pattern without Azure Functions

Durable MAF Workflows (.NET)

Sample Hosting Description
Sequential Azure Functions Order cancellation pipeline: look up → cancel → notify
Concurrent Azure Functions Fan-out to multiple expert agents, fan-in to aggregate
Human-in-the-Loop Azure Functions Expense reimbursement with multi-stage approvals
Sequential Console App Sequential executor pipeline
Conditional Edges Console App Runtime routing based on conditions

Durable Agents (Python)

Sample Hosting Description
Single Agent Azure Functions Basic durable agent with persistent sessions
Multi-Agent Orchestration Azure Functions Multiple agents in a durable orchestration
Human-in-the-Loop Azure Functions Agent pauses for human approval
Reliable Streaming Azure Functions Real-time token streaming with durability
Single Agent Durable Task SDK Agent hosted with DT SDK directly

Scenarios

Sample Description
Autoscaling in ACA KEDA-based dynamic worker scaling in Azure Container Apps
Document Processing on AKS .NET activity chaining and fan-out/fan-in on AKS with workload identity
Work Item Filtering: .NET Route orchestration, validation, and shipping work to separate .NET workers
Work Item Filtering: Java Route orchestration, validation, and shipping work to separate Java workers
Work Item Filtering: Python Route orchestration, validation, and shipping work to separate Python workers

Preview Features

Feature Status Samples
On-demand Sandboxes Private preview; access must be enabled on your scheduler .NET and Python samples

Contributing a Sample

Want to add your own sample? See the Contributing Guide for guidelines on sample structure, documentation, and submission.