TECH NOTE Β· KNOWLEDGE SHARING

Streaming Responses in
Copilot Studio

What works, what doesn't, and the gotchas we hit building a live progressive-response chat playground — across both Direct Line and the Direct-to-Engine SDK.

SurfaceCopilot Studio agent + Bot Framework Web Chat
TransportsDirect Line (WebSocket) Β· Direct-to-Engine SDK
DateUpdated August 30, 2026
Michael Jiang
Prepared by: Michael Jiang
michael.jiang@microsoft.com
Microsoft AI Business Process GBB Asia
Why It Matters

The business case for live streaming responses

😊 Higher customer satisfaction

Answers appear immediately and grow progressively, so the wait feels far shorter even when the total time is unchanged. Users stay engaged instead of staring at a spinner.

πŸ” Transparency builds trust

The inline thought process reveals what the agent is doing behind the scenes β€” searching, planning, analyzing β€” so the interaction feels meaningful and the answer feels earned, not guessed.

πŸ“‰ Fewer abandoned conversations

Continuous, visible progress keeps people from giving up on longer answers. They see momentum, trust it is working, and wait for the full result.

⭐ Meets modern expectations

Users now expect the ChatGPT / Copilot style of live reply. A static "pause, then dump a wall of text" response feels dated and lowers confidence in the agent.

Streaming is not a UI gimmick β€” it is a measurable lever on satisfaction, trust, and completion, and the reason this playground was worth building.
The Goal

Render a real, progressive streaming answer

We wanted the same experience users expect from modern AI chat:

  • β‘ A single answer bubble that grows progressively in place.
  • β‘‘An inline "thought process" showing the agent's reasoning steps while it works.
  • β‘’The view auto-following the answer as it streams.
  • β‘£A diagnostics inspector to see raw streaming activities.

The stack

Web Chat: CDN botframework-webchat/latest

Client: agents-copilotstudio-client (Direct-to-Engine)

Auth: @azure/msal-browser (Entra redirect)

Relay: Express token server, port 3978

Streaming "just working" out of the box is a myth β€” Web Chat and the SDK each make assumptions you have to actively reconcile.
The Wire Format

How a streamed answer actually arrives

informative
Dynamic reasoning steps ("Generating plan…", "Processing", "Analyzing data…").
type: typing
β†’
streaming
Interim chunks with cumulative growing text. Many per answer (we saw 150+).
type: typing
β†’
final
The concluded message that replaces the growing bubble.
type: message
// Each interim chunk is a typing activity carrying streaminfo
{
  "type": "typing",
  "id": "e4c33a60…c20-3",   // UNIQUE per chunk: streamId-sequence
  "channelData": { "streamType": "streaming", "streamId": "e4c33a60…c20",
                    "streamSequence": 3, "webchat:sequence-id": 14 },
  "entities": [{ "type": "streaminfo", … }]   // mirrored copy
}
All chunks of one answer share a streamId, but every chunk has its own unique activity id. That single fact causes the biggest gotcha.
The Good News

What's working βœ…

βœ… Token streaming verified on DtE and DL

With a runtime that emits livestream activities, Direct-to-Engine streams natively and Direct Line WebSocket carries the same informative β†’ streaming β†’ final protocol. The client opt-in alone cannot force chunks.

βœ… Single growing bubble

Forcing the activity id = streamId makes Web Chat update one bubble in place β€” verified growing 8 β†’ 1385 chars in a single message.

βœ… Dynamic "thought process"

The informative chunks are real reasoning steps. We render them as a styled timeline that disappears the moment the answer streams.

βœ… Auto-scroll & diagnostics

A MutationObserver keeps the view pinned to the growing answer. The inspector confirmed 439 chunks across 2 livestreams end-to-end.

With the right normalization, the full modern streaming UX is achievable β€” single bubble, inline reasoning, live scroll.
The Hard Parts

What's not working (out of the box) ⚠️

⚠️ 152 bubbles, not 1

Web Chat dedupes by activity id. Since every chunk has a unique id, each renders as its own bubble. Long answers exploded into 150+ stacked bubbles.

⚠️ Cold observable, one subscriber

The SDK's activity$ is cold with a single internal subscriber. Subscribe twice (e.g. for an inspector) and one observer goes blind.

⚠️ No auto-scroll on in-place updates

Web Chat only auto-pins on new activities. A streaming answer updates the same id, so the view stays put while content grows off-screen.

⚠️ Direct Line needs an explicit opt-in

Plain Web Chat over Direct Line paints only the final message β€” until the client sends deliveryMode:"stream". Miss the opt-in and you'll wrongly conclude DL can't stream (we did, at first).

None of these are bugs exactly β€” they're mismatched assumptions between the SDK's streaming model and Web Chat's transcript model.
The Fixes

How we reconciled them

// The one-line fix that collapsed 152 bubbles β†’ 1
function normalizeStreamingForWebChat(activity) {
  const info = getStreamInfo(activity);
  if (info?.streamId) activity.id = info.streamId;   // group by stream, not chunk
  return activity;
}
Every fix lives in a thin normalization layer between the SDK connection and Web Chat β€” no forks, no patched libraries.
Two Workable Paths

Both transports can carry livestream activities

βœ… Direct-to-Engine (DtE) SDK

No extra client opt-in. CopilotStudioWebChat.createConnection(client, { showTyping:true }) is the native SDK path. The selected agent/runtime may still return final-only. Entra (MSAL) sign-in; no secret in the browser.

Best for: signed-in users, richest reasoning steps, zero secret exposure.

βœ… Direct Line WebSocket + empirical opt-in

WebSocket is a supported livestreaming channel. The playground also sends the deliveryMode:"stream" opt-in observed in the Copilot Studio canvas. Actual chunks still depend on the selected agent/runtime emitting valid livestream activities.

⚠️ GHCP boundary: current GHCP docs list Web app iframe support, but Native app / Direct Line is unavailable. Use authenticated /3p for experimental GHCP testing.

Best for: standard-harness or no-auth Direct Line diagnostics.

// Empirical DL opt-in observed in the Copilot Studio canvas
// 1) once, when the connection goes online:
directLine.postActivity({ type:"event", name:"startConversation",
  deliveryMode:"stream",
  entities:[{ type:"ClientCapabilities", requiresBotState:true,
              supportsListening:true, supportsTts:true }] });
// 2) on every outgoing user message:
postActivity({ ...activity, deliveryMode:"stream" });   // 0 β†’ 84 chunks
Technical Architecture

Components behind the streaming playground

Browser · Bot Framework Web Chat (CDN) + app.js normalization tap · stream coalescing · diagnostics inspector · auto-scroll

Direct-to-Engine (DtE)

sdk-client.js β€” agents-copilotstudio-client
↓ token
MSAL browser β€” Entra access token
↓ HTTPS
Direct-to-Engine endpoint /conversations

Native streaming β€” no client opt-in.

Direct Line (DL)

DirectLine.js (Web Chat) + deliveryMode opt-in
↓ token
Express relay :3978 (secret→token) · or token-endpoint URL
↓ WebSocket
Direct Line channel

WebSocket carries chunks only when the runtime emits valid livestream activities.

Copilot Studio agent β€” emits informative β†’ streaming β†’ final activities
Both transports converge on the same agent and the same app.js normalization tap β€” only the connection + auth layer differs.
Testing Flow

How the components interact during a test run

1 Β· run
Start Express :3978 β€” serves the playground.
npm start
β†’
2 Β· pick mode
Open the playground, choose SDK (DtE) or token / secret / dlStream (DL).
localhost:3978
β†’
3 Β· token
DtE: MSAL Entra redirect. DL: Express mints a Direct Line token.
/api/config
4 Β· connect
Web Chat connects; DL also posts startConversation with deliveryMode:"stream".
β†’
5 Β· prompt
Send a generative prompt β€” only LLM answers stream (not canned topic replies).
β†’
6 Β· stream
Agent emits informative β†’ streaming β†’ final into one growing bubble.
β†’
7 Β· verify
Inspector confirms chunk count, streamId grouping & sequence order.
A passing run = 1 livestream / N streaming chunks / 1 finalized, one clean growing bubble, full markdown, and no duplicate final.
Field Notes

Smaller gotchas worth knowing

  • β€’Web Chat sorts the transcript by webchat:sequence-id β€” get this wrong and bubbles render out of order.
  • β€’net::ERR_ABORTED on the conversations POST is benign β€” it's the SSE stream closing.
  • β€’Token is cached by MSAL, so reconnects are silent (no second sign-in).
  • β€’Informative chunks carry a lower sequence-id than streaming chunks β€” they genuinely precede the answer.
  • β€’Browser caching bites hard during dev β€” hard-reload after edits.
  • β€’showTyping: true on the connection polishes the latency loader UX.
Budget time for the plumbing, not the UI. The visible chat is easy; the activity reconciliation is where the work is.
Runtime Split

Choose the route by harness and authentication

β€œNew agent” is not one protocol. Standard-harness agents, no-auth agentic agents, and GitHub Copilot harness agents are served by different runtime routes.

⚠️ Legacy published-bot DTE is the wrong GHCP route

Environment ID + schema alone makes the SDK call /copilotstudio/dataverse-backed/authenticated/bots/{schema} with the preview API version. A CLI/GHCP agent can fall into the classic β€œno related topic” behavior because this is not its agentic-loop controller.

βœ… Agentic Runtime has two distinct integration families

No-auth agent: mint an agenticruntime/.../directline/token and use Direct Line. Integrated GHCP agent: send the delegated user token to agenticruntime/3p/.../bots/{schema} through CopilotStudioClient over SSE.

The deciding input is the harness + authentication mode: no-auth can use agentic Direct Line; Microsoft-authenticated GHCP uses the authenticated /3p Direct-to-Engine route.
No-Auth Alternative

The agenticruntime Direct Line bootstrap

1 Β· region
Discover the agent's geo Direct Line host.
regionalchannelsettings
β†’
2 Β· token
Mint a Direct Line token from the generative runtime.
agenticruntime/…/token
β†’
3 Β· connect
Direct Line 3.0 conversation + WebSocket on the geo host.
webSocket: true
β†’
4 Β· opt-in
startConversation with deliveryMode:"stream" + routing ids.
cci_*
// envHost = <envId first 30>.<last 2>.environment.api.powerplatform.com
// 1) regional Direct Line host (per-agent geo)
GET {envHost}/powervirtualagents/regionalchannelsettings?api-version=2022-03-01-preview
   β†’ { "channelUrlsById": { "directline": "https://unitedstates.directline.botframework.com/" } }
// 2) THE key endpoint β€” generative Direct Line token (anonymous for no-auth agents)
GET {envHost}/copilotstudio/agenticruntime/botsbyschema/{schema}/directline/token?api-version=2022-03-01-preview
   β†’ { "token", "conversationId", "expires_in" }
// 3) Web Chat on the agent's regional host
WebChat.createDirectLine({ token, domain: geoHost + "/v3/directline", webSocket: true });
// 4) opt-in carries the new-gen routing ids
postActivity({ type:"event", name:"startConversation", deliveryMode:"stream",
  cci_bot_id: schema, cci_environment_id: envId, value:{ __version__:"2" } });
AUTH LIMIT β€” Verified only for a no-auth new agent. Direct Line does not carry the integrated Microsoft user context required by a GHCP employee agent; use authenticated /3p instead.
New Agent Experience Β· Live Finding

Authenticated GHCP streaming through /3p (experimental)

Live-verified August 5, 2026 against a published, Microsoft-authenticated GHCP agent. The /3p controller streamed the real progressive response; Microsoft Learn still says new-experience client-library support is not official.

1 Β· identity
MSAL acquires the signed-in user's delegated Power Platform token.
CopilotStudio.Copilots.Invoke
β†’
2 Β· route
Build the environment host and supply the GHCP base URL as directConnectUrl.
agenticruntime/3p
β†’
3 Β· sidecar
Node validates the host/path, preflights once, then keeps the SDK conversation alive.
HTTP + SSE
β†’
4 Β· render
The normalization tap coalesces cumulative chunks into one growing Web Chat bubble.
id = streamId
// Base URL β€” the SDK appends /conversations and /conversations/{id}
https://{envHost}/copilotstudio/agenticruntime/3p/dataverse-backed/authenticated/bots/{schema}?api-version=1

scope: https://api.powerplatform.com/.default
start: client.startConversationStreaming({ emitStartConversationEvent: true })
turn:  client.sendActivityStreaming(activity, conversationId)

Observed stream

Cumulative typing updates, informative tool/status cues, thought entities, the final Markdown message, and generated-file attachments.

Routing reason

Setting directConnectUrl bypasses the legacy PublishedBotStrategy and keeps api-version=1 on every conversation turn.

EXPERIMENTAL SUPPORT BOUNDARY β€” Use this Microsoft-source-backed developer path for testing until Microsoft publishes production support for new-experience clients.
Agent Framework Β· Live Proof

.NET Agent Framework wraps the same Copilot Studio /3p route

Live-verified August 6, 2026 against the same published, Microsoft-authenticated Copilot Studio GHCP-harness agent. This is the Copilot Studio provider β€” not the direct GitHub Copilot CLI provider.

1 Β· identity
Browser MSAL acquires the delegated Power Platform token.
CopilotStudio.Copilots.Invoke
β†’
2 Β· host
A loopback .NET 8 sidecar creates the Copilot Studio client.
CopilotStudioAgent
β†’
3 Β· route
DirectConnectUrl targets the guarded Agentic Runtime controller.
/agenticruntime/3p
β†’
4 Β· stream
RunStreamingAsync yields provider updates; the browser rebuilds the bubble.
AgentResponseUpdate

Key adapter finding

In this run, Agent Framework updates arrived as text fragments, while the Node client delivered cumulative snapshots. Reusing a stable activity ID without consolidation showed only the latest fragment. The browser now appends ordered text updates per streamId, then replaces one growing bubble with a consolidated snapshot.

One observed live turn

15real fragments
4β†’1,164characters
1matching final

Startup proof: the welcome is queued until the adapter reports Online, then rendered in order.

// Sidecar: forward one of the two preview-provider update shapes
await foreach (AgentResponseUpdate update in agent.RunStreamingAsync(prompt, session))
  if (update.RawRepresentation is IActivity activity) writeActivity(activity);
  else writeTextUpdate(update.Text, textMode: "delta");
// Browser: append text by streamId β†’ one cumulative Web Chat activity
RESULT: Agent Framework provides a structured .NET host around the same experimental Copilot Studio /3p route. The progressive Web Chat bubble is adapter reconstruction over preview updates, not a new support contract.
Latest API Β· Compatibility Mode

Latest provider, isolated path, same authenticated GHCP boundary

Added August 30, 2026 as a separate port-3981 mode. It validates the newest available Agent Framework Copilot Studio provider against the proven guarded /3p route without replacing the port-3980 baseline.

Top-level provider1.19.0-preview.260822.1
Transitive client1.3.171-beta Β· unchanged
Released scope APIScopeHelper.getScopeFromSettings
1 Β· identity
MSAL gets the signed-in user's delegated Power Platform token.
Microsoft auth
β†’
2 Β· guard
The sidecar pins host, authenticated bot path, default port, and API version.
no redirects Β· no cookies
β†’
3 Β· prove
Health and preflight report actual provider versions and remote conversation.
:3981/healthz
β†’
4 Β· stream
RunStreamingAsync remains isolated and flows through the existing Web Chat adapter.
NDJSON β†’ streamId
VERDICT β€” This mode proves package compatibility and preserves delegated Microsoft identity. It does not prove a new GHCP transport or change Microsoft's current β€œnot yet officially supported” client-library boundary.
Agent Framework Β· Provider Architecture

Agent Framework provider map β€” reuse the published GHCP agent

Copilot Studio provider β†’ authenticated /3p β†’ existing published GHCP agent.

Microsoft Agent Framework branches to the GitHub Copilot provider and Copilot Studio provider; the Copilot Studio path reaches an existing published GHCP harness agent through Agentic Runtime /3p.
Pasted architecture Β· provider split and existing-agent reuse
Copilot Studio provider
Delegated Power Platform token↓
CopilotStudioAgentCopilotStudio CopilotClient
RunStreamingAsync updates↓
Authenticated Agentic Runtime /3pSSE conversation + session
Handoff to existing published runtime↓
REUSE BOUNDARYExisting published Copilot Studio GHCP harness agent
browser adapter updates→streamId merge→one Web Chat activity
S2S Private Preview Β· Integration Pattern

App-only S2S adds a new identity branch to the guarded /3p route

The browser configures a confidential Entra application, but the Node sidecar owns the client secret, app-token cache, `/3p` preflight, conversation session, and SSE stream.

1 Β· configure
Enter client ID, tenant ID, secret, environment, and schema in the S2S mode.
Save locally
β†’
2 Β· acquire
MSAL Node uses client credentials to mint an app-only Power Platform token.
idtyp: app
β†’
3 Β· guard
Loopback endpoints validate the exact commercial environment host and `/3p` path.
api-version=1
β†’
4 Β· stream
CopilotStudioClient keeps the app-identity conversation and relays SSE as NDJSON.
authMode: s2s

Credential boundary

config/s2s.local.json is atomically written, explicitly git-ignored, and requests owner-only permissions. The secret is submitted once to localhost, cleared from the form, never returned, and never stored in browser storage.

Identity consistency

Preflight/start/send acquire the app token server-side. Sessions are tagged s2s, so delegated and app-only identities cannot continue each other's conversations. A blank secret update preserves the saved secret.

PATTERN β€” Treat app-only S2S as a separate authentication branch. Reuse the proven `/3p` URL guard and stream adapter, but never reuse delegated conversation state.
S2S Private Preview Β· Live Diagnostic

Authentication passed; the platform feature gate stopped the call

Live-probed August 13, 2026 against the published no-auth agent mjsrc_mjnewagent4customer_Kvhq-e. A fresh client-credentials token reached the Agentic Runtime gateway.

api.powerplatform.comtoken audience
idtyp: appapplication context
CopilotStudio.Copilots.Invokeapplication role present
passed
Client ID + secret authenticated in the same tenant.
MSAL client credentials
β†’
passed
Power Platform application permission was present in the JWT roles claim.
no delegated scp
β†’
reached
Gateway routed the request to ThirdPartyAuthenticatedPublishedBotController.
/agenticruntime/3p
β†’
blocked
Controller refused the request before agent ACL evaluation.
HTTP 405
Decisive service response Feature ThirdPartyAuthenticatedPublishedBotController.EnableS2SAuthFeature (Feature) not enabled.

What this rules out

Not a bad secret, wrong audience, wrong tenant, missing application role, malformed environment host, or missing `/3p` controller route.

What remains blocked

Microsoft must enable S2S D2E for the tenant/environment and confirm that the feature applies to GHCP harness `/3p`, not only standard/classic agents.

FINDING β€” A correctly formed app-only token is necessary but not sufficient. The server-side feature flag is evaluated before the agent-share ACL.
S2S Private Preview Β· Sharing Boundary

Why a no-auth GHCP agent may have no usable Share button

The public GHCP sharing experience and the private-preview S2S ACL describe different identity models. Their prerequisites currently conflict in the new agent experience.

Public GHCP sharing

  • β€’Requires Authenticate with Microsoft.
  • β€’Shares with users, security groups, or the organization.
  • β€’No documented application-identity picker for a no-auth GHCP agent.
  • β€’Public channel matrix still marks Native app / Direct Line unavailable.

Private-preview S2S ACL

  • β€’True app-only S2S requires No Authentication.
  • β€’Generic guide says share the agent with the app identity as Viewer.
  • β€’The guide does not document GHCP/new-experience `/3p` coverage.
  • β€’No client-side workaround exists for feature-gate or app-share ACL rejection.
now
Request Microsoft enablement for the environment.
EnableS2SAuthFeature
β†’
then
Retest and inspect the next authorization response.
D2EAccessDenied?
β†’
if denied
Ask Microsoft for the GHCP app-identity Share API or ACL provisioning path.
viewer app identity
SUPPORT BOUNDARY β€” Do not switch the agent to Microsoft authentication just to reveal Share; that invalidates true app-only S2S. Enablement and app ACL must come from the preview service.
TAKEAWAYS

If you remember five things

Repogithub.com/jzh24516/copilot-streaming-chat-playground
Questions?Reach out β€” happy to walk through the inspector live.
Community Share

Discover more and test with your own agent

We shared this streaming reference publicly so teams can reproduce progressive-response UX, then validate the actual wire behavior with the same inspector patterns.

Repository snapshot

copilot-streaming-chat-playground GitHub repository preview

Maker: Michael Jiang (michael.jiang@microsoft.com), Microsoft AI Business Process GBB Asia

Shared repo home with latest commits, README, docs, and deployment status.

Where to discover more

  • πŸ”—GitHub repository:
    github.com/jzh24516/copilot-streaming-chat-playground
  • πŸ“˜Streaming tech note (HTML):
    /docs/streaming-tech-note.html
  • πŸ§ͺMultilingual playground:
    Use the language switcher and connect your own agent to test Direct Line vs Direct-to-Engine behavior.
Start from the repo, run locally, and use this deck + inspector to shorten streaming rollout time for your own Copilot Studio projects.
1 / 22
← β†’ arrows Β· F fullscreen