Build a Durable AI Workflow with Azure Durable Functions and C#
Use Azure Durable Functions to coordinate a recoverable AI processing job whose orchestration survives host restarts.
Architecture
HTTP start → orchestrator → extraction and AI activities → validation → status
Prerequisites and configuration
Use the C# isolated worker and the Durable Functions package supported by your chosen runtime. Return an authorized status endpoint for a stable job ID. Store document content and long result data in private storage, passing only opaque identifiers through orchestration history.
Implementation
Call extraction, inference and persistence through activities. An orchestrator can replay, so avoid direct HTTP, random GUID APIs and wall-clock calls in orchestrator code. Put transient retries on activity calls and keep operations idempotent using job ID and step as a key. Reuse a prior successful model response when a durable result is already recorded.
Implementation example
var result = await context.CallActivityAsync<string>("Analyze", key);Testing and troubleshooting
Trigger a job against a synthetic file, inject a transient inference timeout and restart the host during processing. Confirm the job later completes and the result is written once. Test status access for a different tenant. Version long-lived orchestrations before deploying changes that alter the replay path.
Frequently asked question
Does durable execution guarantee the provider receives a request exactly once?
Activities may be retried. Use durable step state and provider-supported idempotency where available to handle uncertain outcomes.
Comments
Post a Comment