github Azure/azure-sdk-for-python azure-ai-agentserver-responses_1.0.0b2

pre-release7 hours ago

1.0.0b2 (2026-04-17)

Features Added

  • Startup configuration logging — ResponsesAgentServerHost logs storage provider type, default model, default fetch history count, and shutdown grace period at INFO level during construction.
  • InboundRequestLoggingMiddleware moved to azure-ai-agentserver-core — pure-ASGI middleware that logs every inbound HTTP request at INFO level (start) and at INFO or WARNING level (completion). Now wired automatically by AgentServerHost so all protocol hosts get consistent inbound logging. Includes method, path (no query string), status code, duration in milliseconds, and correlation headers (x-request-id, x-ms-client-request-id). Status codes >= 400 are logged at WARNING; unhandled exceptions are logged as status 500 at WARNING. OpenTelemetry trace ID is included when an active trace exists.
  • Handler-level diagnostic logging — all five endpoint handlers (POST /responses, GET /responses/{id}, DELETE /responses/{id}, POST /responses/{id}/cancel, GET /responses/{id}/input_items) now emit INFO-level logs at entry and on success, including response ID, status, and output count where applicable.
  • Orchestrator handler invocation logging — logs the handler function name and response ID at INFO level before each handler invocation.
  • Chat isolation key enforcement — when a response is created with an x-agent-chat-isolation-key header, subsequent GET, DELETE, Cancel, and InputItems requests must include the same key. Mismatched or missing keys return an indistinguishable 404 to prevent cross-chat information leakage. Backward-compatible: no enforcement when the response was created without a key.
  • Malformed response ID validation — all endpoints that accept a response_id path parameter now reject malformed IDs (wrong prefix, too short) with HTTP 400 (error.type: "invalid_request_error", error.code: "invalid_parameters", param: "responseId{<value>}") before touching storage. The previous_response_id field in POST body is also validated.
  • FoundryStorageLoggingPolicy — Azure Core per-retry pipeline policy that logs Foundry storage HTTP calls (method, URI, status code, duration, correlation headers) at the azure.ai.agentserver logger. Replaces the built-in HttpLoggingPolicy in the Foundry pipeline to provide single-line summaries with duration timing and log-level escalation (WARNING for 4xx/5xx).
  • FoundryStorageLoggingPolicy now logs x-request-id and apim-request-id response headers from Foundry in addition to x-ms-client-request-id and x-ms-request-id, matching the .NET SDK's diagnostic detail. This enables verifying that the inbound trace-id round-trips through Foundry storage calls.
  • Foundry storage User-Agent — outbound HTTP requests to Foundry storage now carry a User-Agent header reflecting the exact x-platform-server value (lazy callback via _ServerVersionUserAgentPolicy) so upstream logs can correlate inbound and outbound traffic.

Bugs Fixed

  • SSE stream replay now works when the response provider does not implement ResponseStreamProviderProtocol (e.g. FoundryStorageProvider). Previously, GET /responses/{id}?stream=true returned HTTP 400 after eager eviction because no stream provider was configured. The host now auto-provisions an in-memory stream provider as a fallback.
  • item_reference inputs are now resolved at persistence time — when a POST /responses request includes item_reference entries in its input, they are batch-resolved via the provider before being stored. Previously, item_reference entries were silently dropped during input expansion, so GET /responses/{id}/input_items would only return inline items. This matches the .NET SDK behavior (GetInputItemsForPersistenceAsync).
  • Post-eviction chat isolation — after eager eviction, GET, DELETE, Cancel, and InputItems requests with missing or mismatched x-agent-chat-isolation-key headers now correctly fall through to Foundry storage (which returns HTTP 400) instead of being blocked locally with HTTP 404. In-flight isolation enforcement is unchanged.
  • Error code field now uses spec-compliant values: "invalid_request_error" for 400/404 errors (was "invalid_request", "not_found", or "invalid_mode"), "server_error" for 500 errors (was "internal_error").
  • RequestValidationError default code updated from "invalid_request" to "invalid_request_error".
  • Error responses for deleted resources now correctly return HTTP 404 (was 400). Affects GET /responses/{id}, GET /responses/{id}/input_items, and DELETE /responses/{id} (second delete) on previously deleted responses.
  • Cancel on a response in terminal state now returns the spec-compliant message "Cannot cancel a response in terminal state." (was "Cannot cancel an incomplete response.").
  • SSE replay rejection messages now use spec-compliant wording:
    • Non-background responses: "This response cannot be streamed because it was not created with background=true."
    • Background non-stream responses: "This response cannot be streamed because it was not created with stream=true."
  • Foundry storage errors (FoundryResourceNotFoundError, FoundryBadRequestError, FoundryApiError) are now explicitly caught in endpoint handlers and mapped to appropriate HTTP status codes instead of being swallowed by broad exception handlers.

Don't miss a new azure-sdk-for-python release

NewReleases is sending notifications on new releases.