Azure.AI.AgentServer.Responses Namespace

Classes

Name Description
AzureAIAgentServerResponsesContext

Context class which will be filled in by the System.ClientModel.SourceGeneration. For more information https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/System.ClientModel/src/docs/ModelReaderWriterContext.md

BadRequestException

Exception thrown when a request is invalid — malformed JSON, missing required fields, or invalid parameter values. Maps to HTTP 400 Bad Request.

CreateResponseRequest

Encapsulates the data required to persist a newly created response. Passed to CreateResponseAsync(CreateResponseRequest, IsolationContext, CancellationToken).

DataUrl

Utility methods for working with base64 data URLs (e.g., data:image/png;base64,iVBOR... or data:text/plain;base64,SGVs...).

Data URLs follow the format data:[<mediatype>][;base64],<data>. These utilities help handlers extract the raw bytes and media type from ImageUrl and FileData values.

InMemoryProviderOptions

Options for configuring the built-in in-memory ResponsesProvider implementation.

OutputItemBuilder<T>

Base class for output item builders. Provides common fields, properties, and EmitAdded(T) / EmitDone(T) methods that handle event construction and output tracking. Can also be used directly for output item types that have no streaming sub-events (no deltas, no status transitions).

OutputItemCodeInterpreterCallBuilder

Scoped builder for a code interpreter tool call output item. Provides methods for the lifecycle events and streaming code deltas.

OutputItemCustomToolCallBuilder

Scoped builder for a custom tool call output item. Provides methods for lifecycle events and streaming input deltas.

OutputItemFileSearchCallBuilder

Scoped builder for a file search tool call output item. Provides methods for the file search lifecycle: added, in-progress, searching, completed, done.

OutputItemFunctionCallBuilder

Scoped builder for a function call output item. Provides methods for the function call event lifecycle: added, arguments delta/done, and done events.

OutputItemImageGenCallBuilder

Scoped builder for an image_generation_call output item. Provides methods for lifecycle events and streaming partial image data.

The typical lifecycle is: EmitAdded()EmitInProgress()EmitGenerating() → zero or more EmitPartialImage(String)EmitCompleted()EmitDone(String). The final EmitDone(String) call carries the base64-encoded image result.

OutputItemMcpCallBuilder

Scoped builder for an MCP tool call output item. Provides methods for lifecycle events and streaming arguments.

OutputItemMcpListToolsBuilder

Scoped builder for an MCP list tools output item. Provides methods for lifecycle events with success or failure terminal states.

OutputItemMessageBuilder

Scoped builder for a message-type output item. Manages the content index counter within the message and provides factory methods for content part scopes. Child content builders are auto-tracked so EmitDone() can build the final message from their accumulated state.

OutputItemReasoningItemBuilder

Scoped builder for a reasoning output item. Manages the summary part index counter and provides factory methods for creating summary part scopes. Child summary builders are auto-tracked so EmitDone() can build the final reasoning item from their accumulated state.

OutputItemWebSearchCallBuilder

Scoped builder for a web search tool call output item. Provides methods for the web search lifecycle: added, in-progress, searching, completed, done.

PayloadValidationException

Exception thrown when an incoming request payload fails validation against the API schema. Carries the list of per-field validation errors for structured error reporting. Maps to HTTP 400 Bad Request with Error.Details[].

ReasoningSummaryPartBuilder

Scoped builder for a single reasoning summary part. Provides methods for the summary part lifecycle: added, text delta, text done, and part done events.

RefusalContentBuilder

Scoped builder for a refusal content part within a message. Owns its full lifecycle: EmitAddedEmitDelta (0+) → EmitRefusalDoneEmitDone.

ResourceNotFoundException

Exception thrown when a requested resource (e.g., a response ID) is not found. Maps to HTTP 404 Not Found.

ResponseContext

Provides the handler with the response identifier, raw body, input items, conversation history, and forwarded client metadata. The handler communicates state exclusively through events yielded from ResponseEventStream; the mutable Response object is not exposed.

ResponseContextExtensions

Extension methods for ResponseContext that generate correctly formatted item IDs with automatic partition key propagation from the current response.

ResponseEventStream

Top-level scope for building a streaming response event sequence. Manages the global sequence counter and output index counter, and provides factory methods for creating child scopes (message builders, function call builders). Owns a private Response object that is embedded in emitted events.

ResponseHandler

Defines the contract for handling response creation requests. Override this class and register it in DI to provide your agent logic.

ResponsesApiException

Exception that wraps a fully-formed Error model and an HTTP status code. Thrown when code needs to surface a structured API error that serializes directly to ApiErrorResponse. Maps to the specified StatusCode.

ResponsesBuilderExtensions

Extension methods for AgentHostBuilder to register the Responses protocol for one-line startup.

ResponsesCancellationSignalProvider

Provides cancellation signalling for in-flight responses. Extend this class to back cancellation with a custom signalling mechanism (e.g., distributed pub/sub, Redis, message queue).

ResponsesProvider

Provides pluggable response state persistence for the Responses API server.

ResponsesServer

One-line entry point for running a Responses protocol server. Creates the builder, registers the Responses protocol with the specified handler, builds, and runs the server.

ResponsesServerEndpointRouteBuilderExtensions

Extension methods for IEndpointRouteBuilder to map the Responses API routes.

ResponsesServerOptions

Configuration options for the Responses API server SDK.

ResponsesServerServiceCollectionExtensions

Extension methods for IServiceCollection to register the Responses API server SDK services.

ResponsesStreamProvider

Provides event streaming infrastructure for Server-Sent Events (SSE) delivery. Extend this class to back SSE streaming with a custom transport (e.g., Redis Streams, Kafka, Azure Service Bus).

TextContentBuilder

Scoped builder for a text content part within a message. Owns its full lifecycle: EmitAddedEmitDelta (0+) → EmitTextDoneEmitAnnotationAdded (0+) → EmitDone.

TextResponse

A high-level convenience that produces a complete text-message response stream. Implements IAsyncEnumerable<T> so it can be returned directly from CreateAsync(CreateResponse, ResponseContext, CancellationToken).

Handles the full SSE lifecycle automatically: response.createdresponse.in_progress → message/content events → response.completed.

Use the TextResponse(ResponseContext, CreateResponse, Func<CancellationToken,Task<String>>, Action<ResponseObject>) constructor when you have the complete text available (or can produce it in a single async call). Use the TextResponse(ResponseContext, CreateResponse, Func<CancellationToken,IAsyncEnumerable<String>>, Action<ResponseObject>) constructor when text arrives incrementally (e.g., token-by-token from an LLM).

ValidationError

A single validation error with a JSON path and human-readable message.

WireFormatExtensions

Extension methods for translating between model types that share the same underlying JSON wire contract. The Azure Responses models and the OpenAI .NET SDK models are wire-compatible — OpenAI payloads are generally a subset while Azure Responses is a superset with additional item types and extensions.

Important: Only use this for types whose JSON serialization is wire-compatible. If the source and target types do not share the same JSON schema (property names, discriminators, structure), deserialization may silently produce incomplete objects or throw.

Structs

Name Description
WireFormatData

Intermediate wire-format bytes produced by Translate<T>(T). Call To<T>() to deserialize as the target model type.

Interfaces

Name Description
IAsyncObserver<T>

Provides a mechanism for receiving push-based asynchronous notifications.