Skip to content

Messages being streamed as a block when using QueueTextChunk #697

@alspires

Description

@alspires

Version

What package version of the SDK are you using.

  • Nuget package version: microsoft.agents.builder\1.3.175
  • dll product version: 1.3.175

Describe the bug
A clear and concise description of what the bug is.

  • Streaming with QueueTextChunk won't work as it should. It displays the whole message in a block to the user, instead of in chunks.

To Reproduce

  1. Have a foreach looping through chunks
  2. Call QueueTextChunk inside it for each chunk

Example implementation:

var responseStream = await _chatService.GetMessageStream(newUserMessage, cancellationToken);
await timeoutTokenSource.CancelAsync();

var chunkIndex = 0;
await foreach (var line in responseStream.WithCancellation(cancellationToken))
{
    if (!IsValidMessage(line, out var machineResponse) && machineResponse.Length <= chunkIndex)
    {
        continue;
    }

    turnContext.StreamingResponse.QueueTextChunk(machineResponse[chunkIndex..]);
    chunkIndex = machineResponse.Length;
}

Expected behavior
The message coming chunked from a streaming enabled LLM is displayed in streaming on Teams too.

Screenshots

20260209-0931-00.4162263.mp4

The exact same happens with way bigger messages as well.

Hosting Information (please complete the following information):

  • How are you Hosting this: Azure/Local with DevTunnels
  • Are you deploying: Everything deployed into Azure using a Microsoft sandbox account and local .env file/manifest.
  • Are you using Azure Bot Services: Yes
  • What Client are you using: MSTeams
  • What .net version is your build in: .NET 8

Additional context
The bot talks to one of our services that is responsible to bring back an answer from the LLM (which is correctly coming in chunks). This used to work fine, it would stream as it should but suddenly stopped working.

Metadata

Metadata

Assignees

No one assigned

    Labels

    QuestionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions