Azure.AI.AgentServer.Core.Tasks Namespace

Classes

Name Description
ResilientTaskEnablementExtensions

Opt-in configuration for the resilient-task subsystem.

ResilientTaskException

The single exception type raised by the resilient-task framework. The ErrorCode identifies the failure category; code-specific data is exposed through nullable properties (CurrentStatus, ActualLastInputId, Failure) that are populated only for the corresponding code.

ResilientTaskHostExtensions

Host-builder registration for configuration-bound resilient-task storage.

ResilientTaskOptions

Controls whether the resilient-task runtime is active for an application host.

ResilientTaskServiceCollectionExtensions

Registration entry points for the resilient-tasks feature. Hosted storage can be configured with an explicit credential and endpoint, or through configuration-bound ResilientTaskSettings on an IHostApplicationBuilder. Without an explicit endpoint, the hosted credential can also be supplied through AddResilientTasks(IServiceCollection, TokenCredential) or a registered TokenCredential service. Lease durations and retry/timeout defaults are configured per task rather than globally.

ResilientTaskServiceProviderExtensions

Resolves a registered resilient task's typed TaskDefinition<TInput,TOutput> handle from a built IServiceProvider. Every task registered with AddResilientTask/AddResilientMultiTurnTask is also registered as a keyed singleton service, keyed by its task name — this is the sanctioned way to resolve it. Resolution is always by name (never ambiguous), because multiple tasks may share the same TInput/TOutput pair.

ResilientTaskSettings

Configuration-bindable settings for hosted resilient-task storage. The inherited credential and Endpoint are resolved from one configuration section so task-storage identity and location cannot be configured independently. Binding storage settings does not enable the resilient-task runtime; call SetResilientTasksEnabled(IHostApplicationBuilder, Boolean) before host startup.

RunOptions

Options for a single task invocation. Maps Python's run/start keyword arguments.

TaskContext<TInput>

The handler-facing context for a single task turn. Exposes the typed input, identity, entry mode, retry/steering signals, the crash-recovery count, and cooperative cancellation, matching Python's TaskContext. The protected constructor supports mocking; the engine populates instances internally.

TaskDefinition<TInput,TOutput>

A typed handle to a registered resilient task, returned by AddResilientTask<TInput,TOutput>(IServiceCollection, String, Func<TaskContext<TInput>, CancellationToken,Task<TOutput>>, Action<TaskRegistrationOptions>) and AddResilientMultiTurnTask<TInput,TOutput>(IServiceCollection, String, Func<TaskContext<TInput>,CancellationToken,Task<TOutput>>, Boolean, Action<TaskRegistrationOptions>). The task name and its TInput/TOutput types are bound once at registration, so starting or running the task is strongly typed — an input or output that does not match the registration is a compile-time error rather than a runtime failure. The protected constructor and virtual members support substitution in consumer unit tests.

TaskFailureDetail

Structured detail describing why a task failed. Projects the cross-language failure record (handler error vs. exhausted retries) into typed members.

TaskRegistrationOptions

Per-task registration options. Maps the public keyword arguments of Python's @task(...) minus name/steerable (which are method parameters). Backend selection, lease durations, and the local state root are framework internals, not options here (Python parity).

TaskRetryPolicy

Controls how a failed task handler is retried: the maximum number of attempts, the delay between attempts, and an optional predicate selecting which exceptions are retryable. The delay is expressed as an DelayStrategy so fixed, exponential, jittered, and custom-derived backoff all use one delay model instead of a second bespoke one.

TaskRun<TOutput>

A handle to a started task run. Await Completion to observe the typed result; to cancel only your wait (without affecting the durable run) use Completion.WaitAsync(cancellationToken). The protected constructor supports mocking; the engine returns populated instances.

TaskStream

Provides consumer access to the event stream associated with one task input.

TaskStreamWriter

Provides producer access to the event stream associated with one task input.

Structs

Name Description
ResilientTaskErrorCode

Identifies the category of a ResilientTaskException. This is an extensible enum (a string-backed value type following the Azure SDK pattern): new protocol reasons can be introduced without a breaking change, and an unrecognized value round-trips rather than failing to parse. Argument validation and cancellation are represented by the standard ArgumentException and OperationCanceledException instead of a code.

Interfaces

Name Description
IResilientTaskHandler<TInput,TOutput>

Handles one execution attempt of a registered resilient task.

Enums

Name Description
EntryMode

Describes how a task handler was entered for the current turn. Recovery is observable only through this enum (there is no public recovery counter), matching the Python TaskContext surface.

TaskFailureKind

Categorizes why a task ultimately failed.

TaskRunStatus

The lifecycle status of a resilient task as reported by the task store.