Skip to content

azure-ai-agents streaming samples#48397

Merged
jpalvarezl merged 4 commits into
mainfrom
jpalvarezl/feature/agents_streaming_samples
Mar 13, 2026
Merged

azure-ai-agents streaming samples#48397
jpalvarezl merged 4 commits into
mainfrom
jpalvarezl/feature/agents_streaming_samples

Conversation

@jpalvarezl

Copy link
Copy Markdown
Member

This pull request introduces streaming support for agent responses in both synchronous and asynchronous clients, enabling real-time processing of response events. It adds utility methods for bridging OpenAI streaming types to Azure SDK and Reactor types, and provides new sample code demonstrating streaming with the Code Interpreter tool. The most significant changes are grouped below.

Streaming API Enhancements

  • Added createStreamingWithAgent and createStreamingWithAgentConversation methods to both ResponsesClient and ResponsesAsyncClient, allowing users to receive streamed response events from agents and agent conversations. These methods utilize new bridging utilities for OpenAI streaming types. [1] [2]
  • Introduced the StreamingUtils class, which provides helper methods (toIterableStream and toFlux) to convert OpenAI streaming responses into Azure SDK's IterableStream and Reactor's Flux, ensuring proper resource management and seamless integration.

Sample Code Additions

  • Added CodeInterpreterStreamingSync.java and CodeInterpreterStreamingAsync.java samples, illustrating how to stream agent responses (including code execution progress and text output) using the new synchronous and asynchronous streaming APIs. These samples highlight practical usage of the Code Interpreter tool and event handling. [1] [2]

Asset Tag Update

  • Updated the asset tag in assets.json to reference the new version, reflecting these streaming capabilities.

Copilot AI review requested due to automatic review settings March 12, 2026 13:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds first-class streaming support to azure-ai-agents Responses clients (sync + async), along with bridging utilities and end-to-end samples/tests to demonstrate and validate agent streaming scenarios.

Changes:

  • Added streaming response creation methods to ResponsesClient and ResponsesAsyncClient for agent and agent-conversation scenarios.
  • Introduced StreamingUtils to bridge OpenAI streaming primitives into Azure SDK IterableStream and Reactor Flux.
  • Added streaming-focused samples and tests (sync + async), plus updated assets.json tag.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
sdk/ai/azure-ai-agents/src/main/java/com/azure/ai/agents/ResponsesClient.java Adds sync streaming APIs returning IterableStream<ResponseStreamEvent>.
sdk/ai/azure-ai-agents/src/main/java/com/azure/ai/agents/ResponsesAsyncClient.java Adds async streaming APIs returning Flux<ResponseStreamEvent>.
sdk/ai/azure-ai-agents/src/main/java/com/azure/ai/agents/implementation/StreamingUtils.java New bridging utilities (StreamResponseIterableStream, AsyncStreamResponseFlux).
sdk/ai/azure-ai-agents/src/test/java/com/azure/ai/agents/implementation/StreamingUtilsTest.java Unit tests for the new bridging utilities.
sdk/ai/azure-ai-agents/src/test/java/com/azure/ai/agents/StreamingTests.java New sync integration tests validating streamed agent responses.
sdk/ai/azure-ai-agents/src/test/java/com/azure/ai/agents/StreamingAsyncTests.java New async integration tests validating streamed agent responses.
sdk/ai/azure-ai-agents/src/samples/java/com/azure/ai/agents/streaming/SimpleStreamingSync.java Sample showing sync streaming text deltas.
sdk/ai/azure-ai-agents/src/samples/java/com/azure/ai/agents/streaming/SimpleStreamingAsync.java Sample showing async streaming text deltas.
sdk/ai/azure-ai-agents/src/samples/java/com/azure/ai/agents/streaming/FunctionCallStreamingSync.java Sample showing sync streaming with function-calling deltas.
sdk/ai/azure-ai-agents/src/samples/java/com/azure/ai/agents/streaming/FunctionCallStreamingAsync.java Sample showing async streaming with function-calling deltas.
sdk/ai/azure-ai-agents/src/samples/java/com/azure/ai/agents/streaming/CodeInterpreterStreamingSync.java Sample showing sync streaming with Code Interpreter progress/code events.
sdk/ai/azure-ai-agents/src/samples/java/com/azure/ai/agents/streaming/CodeInterpreterStreamingAsync.java Sample showing async streaming with Code Interpreter progress/code events.
sdk/ai/azure-ai-agents/assets.json Updates the asset tag to a new version.

You can also share your feedback on Copilot code review. Take the survey.

@github-actions

github-actions Bot commented Mar 12, 2026

Copy link
Copy Markdown
Contributor

API Change Check

APIView identified API level changes in this PR and created the following API reviews

com.azure:azure-ai-agents

@jpalvarezl jpalvarezl enabled auto-merge (squash) March 12, 2026 20:20
@jpalvarezl jpalvarezl merged commit 1f8cf74 into main Mar 13, 2026
19 checks passed
@jpalvarezl jpalvarezl deleted the jpalvarezl/feature/agents_streaming_samples branch March 13, 2026 02:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants