github Azure/azure-sdk-for-python azure-ai-agentserver-core_2.0.0b9

pre-release58 minutes ago

2.0.0b9 (2026-07-28)

Features Added

  • Added Agent Server-managed OTLP/gRPC export when OTEL_EXPORTER_OTLP_PROTOCOL=grpc is configured.
  • Task-record schema cleanup: framework-reserved wire keys in the persisted task record no longer carry a leading _ (e.g. the task_name tag; the schema_version / last_input_id / turn_started_at / retry_attempt / steering payload keys; the input / steering_input_<seq> / output attachment keys) — only the __attachment_ref__ discriminator keeps its marker. The source stamp now includes hosting_environment (from FOUNDRY_HOSTING_ENVIRONMENT), and the payload now carries a schema_version (currently "1"). Tasks persisted before this change (lacking payload.schema_version) are deleted rather than recovered by the recovery scan.
  • Added a resilient task primitive for building long-running agents that survive container restarts, out-of-memory kills, and redeployments. Decorate an async function with @task (one-shot) or @multi_turn_task (multi-turn conversations); the framework persists task state to a task store and automatically recovers and re-invokes in-flight work after a crash. Available from azure.ai.agentserver.core.tasks, with TaskContext, TaskRun, configurable retries (RetryPolicy), cancellation, steering, and a typed exception set (TaskFailed, TaskCancelled, TaskConflictError, TaskManagerNotInitialized, and others). See the Resilient Task Developer Guide.
  • Added an event streaming API (azure.ai.agentserver.core.streaming) for publishing incremental task output to one or more subscribers, with in-memory and file-backed buffering and live or replay delivery. This makes it straightforward to serve Server-Sent Events (SSE) responses that a client can disconnect from and resume. See the Streaming Developer Guide.
  • Exposed resolve_state_subdir(name) on the public azure.ai.agentserver.core surface. It resolves an on-disk state subdirectory (e.g. "tasks", "streams", "responses") under the shared agent-server state root (AGENTSERVER_STATE_ROOT, or ~/.agentserver when unset), so protocol packages persist state under the same operator-controlled root.

Other Changes

  • streams.use_file_backed_replay(...) now has ergonomic defaults so the common case is a single call supplying only cursor_fn: storage_dir defaults to resolve_state_subdir("streams") (a streams directory under the agent-server state root, alongside tasks), ttl_seconds defaults to 600 (10 minutes), and serialization defaults to JSON.
  • File-backed replay streams now sanitize the stream id before using it as an on-disk filename: well-formed ids ([A-Za-z0-9._-], no ./.. segment) are used verbatim, and any id containing a path separator or other unsafe character is SHA-256 hash-encoded to an h_<hex> filename so it can never escape the storage directory or collide with another stream. The file-backed terminal sentinel is now written as {"__terminal__": true} (the non-durable emit_time field was dropped; close-time is best-effort on rehydration).
  • The per-attachment value cap was raised from 2 MiB to 10 MiB (per-input payloads spill into task.attachments). The 1 MB task.payload budget, the inline-promotion thresholds (_input 200 KiB, steering input 20 KiB), and the 20-attachments-per-task limit are unchanged.
  • @task / @multi_turn_task now require an explicit name= (the stable recovery/identity anchor); the previous func.__qualname__ fallback is removed because it silently rebound task identity when a handler was renamed or moved, orphaning in-flight tasks. Omitting name (or passing whitespace) now raises ValueError at decoration.
  • The per-turn task timeout now defaults to 1 day when unset (previously unbounded) and enforces 1 day as a hard ceiling — a larger or negative value is rejected at registration (ValueError). This caps a single handler invocation only; multi-turn chains still live indefinitely across turns (the budget resets each turn).
  • A caller-supplied input_id on Task.start / Task.run (and the multi-turn equivalents) is now validated against the same charset/length pattern as task_id; an invalid id raises ValueError before any provider call.
  • RetryPolicy now enforces hard caps at construction (fail-fast, not clamped): max_attempts must be 1–10 and max_delay must be 0–1 hour; out-of-range values raise ValueError. The zero-argument module-level presets (exponential_backoff(), fixed_delay(), linear_backoff()) now match their RetryPolicy.<preset>() classmethod values so retry cadence is identical across the Python and .NET implementations.
  • Added azure-core as a dependency, and a hosted optional-dependencies extra (pulling in azure-identity) for hosted-agent deployments.
  • resolve_graceful_shutdown_timeout() now honors the AGENTSERVER_GRACEFUL_SHUTDOWN_TIMEOUT_SECONDS environment variable, letting operators shorten shutdown so task checkpoints can flush before long-running requests finish.
  • Added diagnostic logging (logger azure.ai.agentserver.streaming) to the event-streaming subsystem covering stream creation/deletion, crash-recovery rehydration of file-backed streams, and corruption/lock-contention failures, to aid debugging in production.

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

NewReleases is sending notifications on new releases.