Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PC×
Skip to content
World desk7 min

How to Build Resumable AI Workflows with Temporal in .NET 10

Temporal can recover orchestration progress in a .NET AI system when Workflow logic stays deterministic and model, tool, and other external calls run in Activities. Learn how to design retries, human messages, evaluations, and safe Workflow changes.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use Temporal to coordinate durable work in a .NET AI application, and put every LLM request, tool call, database operation, and other external I/O in an Activity. Keep Workflow code deterministic so Temporal can replay its recorded history after a worker restart without calling the model again. Microsoft.Extensions.AI can provide a common .NET abstraction for chat and embedding clients; it does not provide durable execution.

What each part of the system is responsible for

Think of the design as three separate concerns: calling AI services, coordinating work over time, and defining agent behavior. Keeping those concerns distinct makes it easier to change a model provider, recover an orchestration after interruption, or revise a multi-step process without implying that any one component guarantees the others.

As an Amazon Associate I earn from qualifying purchases.

Technology Use it for What it does not replace
Microsoft.Extensions.AI Common .NET abstractions for chat and embedding clients, with provider integrations behind them. Durable workflow execution or agent orchestration. Microsoft recommends starting with it for most app-level AI features. Microsoft’s .NET AI ecosystem guide and Microsoft.Extensions.AI libraries
Microsoft Agent Framework Multi-step agent behavior, routing, and handoffs. A provider-neutral chat abstraction or, by itself, the same orchestration model as Temporal. The ecosystem guidance distinguishes its agent role from the client abstractions. Microsoft’s .NET AI ecosystem guide
Temporal Durable, long-running application orchestration using Workflows, Activities, and Workers. Correct AI answers or exactly-once effects in external systems. Workflows replay deterministically; nondeterministic external operations belong in Activities. Temporal’s .NET SDK developer guide and .NET SDK repository
Azure Durable Task Durable workflow and agent programming in Azure’s ecosystem. It is not simply another name for an agent framework. For a deployment decision, assess language and framework integration, hosting, state management, operations, and portability. Microsoft’s Durable Task guidance for AI agents

These choices are not necessarily mutually exclusive. Microsoft describes providers supported through Microsoft.Extensions.AI as usable with Agent Framework, and Temporal workflows can coordinate direct LLM calls or agent frameworks. Compatibility depends on the specific SDKs and versions you select; verify that combination before committing to an architecture. Microsoft’s .NET AI ecosystem guide Microsoft’s Durable Task guidance

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Why model and tool calls belong in Activities

A Temporal Workflow is the durable coordinator, not the place to make fresh external requests. Workflow code should derive decisions from workflow inputs, deterministic logic, messages, timers, and recorded Activity results. It must avoid external I/O, mutable external state, system-clock access, and random or otherwise nondeterministic calls. On replay, Temporal reconstructs workflow progress from history; the recorded Activity result is used rather than asking the model for a new response. Temporal’s .NET SDK developer guide Temporal’s .NET Workflow versioning guidance

That separation also makes failure policy explicit. An Activity can call a configured IChatClient, invoke a search or other tool, or write to a database. The Workflow can then schedule the next step based on the result, wait for approval, or respond to cancellation. Keeping external effects in Activities gives you a place to apply timeouts, retries, auditing, and operation-specific safeguards.

Keep replay-safe coordination in the Workflow

  • Accept stable, typed inputs and keep only the state needed to continue the business process.
  • Schedule Activities, coordinate their recorded outcomes, and wait on Temporal timers or Workflow messages.
  • Keep large documents or binary data in external storage and pass references when appropriate; this is an application design choice, not a prescribed API rule.
  • Do not put provider credentials or fresh provider-specific decisions in Workflow logic.

Temporal’s .NET SDK documentation also cautions against ordinary thread-pool and delay patterns such as Task.Run and Task.Delay in Workflow code. Follow the guidance for the specific SDK version you deploy rather than assuming normal application-code behavior is safe during replay. Temporal .NET SDK repository

Put nondeterministic work in Activities

Register the chosen AI client through your application’s dependency-injection configuration, then let an Activity use it. An AI Activity might receive a bounded prompt or request plus references to needed data and return a structured result. Put consequential tool effects—such as changing a record or initiating an external action—in separate Activities when that makes retries, auditing, and failure handling clearer. Exact client registration and method calls vary with provider and package versions, so there is no single provider-independent code snippet that can be assumed to compile unchanged.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Plan for retries and external side effects

Activity retries are useful when a transient failure interrupts work, but a retry can mean the downstream system receives the operation again. Durable orchestration preserves workflow progress; it does not make a provider call or external write exactly once. The application and downstream service must define how duplicate effects are avoided or detected. Temporal’s .NET SDK developer guide Temporal .NET SDK repository

  • Make writes idempotent where possible. Use an idempotency key or downstream deduplication mechanism appropriate to the target system. The correct design depends on that system.
  • Choose timeouts and retry behavior per operation. A read, a model request, and a payment-like or state-changing action do not necessarily have the same safe retry policy.
  • Use heartbeats for suitable long-running Activities. Heartbeats can report progress through Temporal’s mechanisms; design resumption behavior for the operation rather than assuming a heartbeat makes arbitrary work resumable.
  • Handle ambiguous outcomes. If a connection fails after a downstream service may have accepted a write, determine whether to query, deduplicate, or reconcile before repeating it.

The Temporal .NET guide covers Activity execution, timeouts, asynchronous completion, and error handling. Use those mechanisms together with the downstream system’s own guarantees; no orchestration setting can substitute for an idempotency plan. Temporal’s .NET SDK developer guide

Use Queries, Signals, and Updates for different interactions

Long-running AI workflows often need to expose progress or wait for user input. Temporal’s message types have distinct semantics, so pick one according to whether the caller is reading state, sending a message, or asking the workflow to apply a change and acknowledge it. Temporal’s guide to Workflow message passing

Message type What it does Useful example
Query Reads current Workflow state without changing it or blocking for a result. Temporal Documentation describes Queries as read requests that cannot block. Show the current stage or status in a progress view.
Signal Asynchronously changes Workflow state without waiting for a result from the Workflow. Deliver user-provided context, or notify the workflow of a cancellation request.
Update Tracks a write so the caller can wait for completion or an error. Submit an approval or configuration decision when the caller needs an acknowledged outcome.

Validate incoming values before applying them to workflow state. Decide how late messages, repeated submissions, and cancellation arriving during an Activity should behave; those are business rules the workflow must implement, not guarantees implied by choosing a message type.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A practical build sequence

  1. Define durable boundaries. Give each step stable, typed inputs and outputs. Keep only continuation-critical state in the workflow and use references for large external data where suitable.
  2. Choose and register the AI client. Configure IChatClient or a supported provider integration using application dependency injection. Keep credentials and provider policy in configuration and service boundaries, not workflow code. Microsoft.Extensions.AI libraries
  3. Write the deterministic coordinator. Have the Workflow schedule Activities, wait on timers or messages, and decide from durable inputs and recorded results. Avoid direct model, HTTP, database, clock, and random calls in the Workflow. Temporal’s .NET SDK developer guide
  4. Implement model and tool Activities. Bound requests, return structured results, and separate side-effecting tool operations where separate retry and audit boundaries help. Match implementation details to the selected provider and SDK versions.
  5. Set failure behavior deliberately. Define timeouts and retries around the operation’s characteristics, deduplicate writes, and use heartbeats for work that supports progress reporting or resumption. Temporal’s .NET SDK developer guide
  6. Expose the right workflow messages. Use Queries for status reads, Signals for asynchronous input, and Updates when the caller needs a tracked write result. Validate all received input. Temporal’s guide to Workflow message passing
  7. Test interruption and evolution paths. Exercise worker termination, Activity retry, duplicate requests, cancellation, late input, and replay of histories created by earlier Workflow code. Temporal’s .NET guide includes testing and versioning resources. Temporal’s .NET SDK developer guide
  8. Evaluate AI quality separately. Build evaluations around representative prompts and outputs so regressions from changing prompts, models, or tools can be detected. Track operational signals such as latency, errors, token or cost data when available, tool outcomes, and retry behavior. Microsoft’s .NET AI guidance treats evaluation as a quality and regression layer. Microsoft’s .NET AI ecosystem guide Develop .NET apps with AI features
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Handle Workflow code changes while executions are open

Long-running executions may outlive a deployment. Because Temporal replays Workflow history, an orchestration change that alters the sequence of commands can make old histories incompatible with new code. Use Temporal’s .NET versioning approach when a change would make replay nondeterministic, and keep external calls inside Activities. Plan deployment and replay testing around the histories that may still be active, not only around newly started workflows. Temporal’s .NET Workflow versioning guidance

For executions that accumulate substantial history or run for a long time, the .NET guide includes Continue-As-New. Use it where appropriate to begin a new run while carrying forward the business state needed to continue; history and payload choices depend on the application. Temporal’s .NET SDK developer guide

What Temporal does—and does not—make reliable

Temporal can durably coordinate steps and recover orchestration progress after worker interruptions. It cannot make an external AI provider available, ensure a model response is correct, guarantee that a fresh model call would return the same answer, or turn external writes into exactly-once operations. Put model calls behind Activities so replay uses their recorded result, then design retries and duplicate protection around each downstream operation.

For .NET 10 specifically, verify the current stable Temporal .NET SDK and AI-provider package versions, their target-framework support, and any preview labels before implementation. The architecture guidance establishes how the components fit together; it is not a tested end-to-end sample or a guarantee that every current package combination supports a given target framework.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.