Skip to content

docs: correct the delta field the MAF streaming example reads - #2105

Merged
SteveSandersonMS merged 1 commit into
mainfrom
sdk-bugfix-61
Jul 28, 2026
Merged

docs: correct the delta field the MAF streaming example reads#2105
SteveSandersonMS merged 1 commit into
mainfrom
sdk-bugfix-61

Conversation

@examon

@examon examon commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Fixes #2104

The "Node.js / TypeScript (standalone SDK)" example under Streaming responses in the Microsoft Agent Framework guide registered an assistant.message_delta handler that read event.data.delta. The payload type for that event, AssistantMessageDeltaData, declares deltaContent; there is no delta. The read therefore evaluated to undefined, the ?? "" fallback turned that into an empty string, and the handler wrote nothing for each delta event.

The change

 session.on("assistant.message_delta", (event) => {
-    process.stdout.write(event.data.delta ?? "");
+    process.stdout.write(event.data.deltaContent ?? "");
 });

docs/integrations/microsoft-agent-framework.md, one line. event.data.delta appeared exactly once in the repository; it now appears nowhere.

deltaContent is required, so the ?? "" fallback is inert either way. It is kept as-is to hold the change to the single field name.

Why deltaContent

AssistantMessageDeltaData (nodejs/src/generated/session-events.ts) declares deltaContent, messageId and an optional deprecated parentToolCallId. The generated types for Go, .NET, Java and Python agree on the same wire field, and the Java example in this same section of this same guide already calls event.getData().deltaContent().

Verification

Extracting the doc block and type-checking it against the SDK source types, with the compiler options scripts/docs-validation/validate.ts generates:

  • before: snippet.ts(11,37): error TS2339: Property 'delta' does not exist on type 'AssistantMessageDeltaData'. (exit 2)
  • after: no diagnostics (exit 0)

That is the block's only type error, and this change removes it.

Observed behaviour, using an instrumented handler that accumulates both accessors side by side rather than the doc block verbatim:

payload keys:           ["messageId","deltaContent"]
event.data.delta:       ""
event.data.deltaContent: "pong"

Checks run in nodejs/: npm run lint, npm run typecheck, npm run format:check and npm test all pass.

The "Node.js / TypeScript (standalone SDK)" example under "Streaming
responses" registered an `assistant.message_delta` handler that read
`event.data.delta`. The payload type for that event,
`AssistantMessageDeltaData`, declares `deltaContent`; there is no `delta`.

The read therefore evaluated to `undefined` and the handler wrote nothing
for each delta event, so none of the streamed text reached stdout.

`deltaContent` is required, so the `?? ""` fallback is inert; it is kept
as-is to hold the change to the single field name.
@examon
examon requested a review from a team as a code owner July 28, 2026 05:17
Copilot AI review requested due to automatic review settings July 28, 2026 05:17

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

Corrects the Microsoft Agent Framework TypeScript streaming example to read the actual delta payload field.

Changes:

  • Replaces nonexistent event.data.delta with event.data.deltaContent.
Show a summary per file
File Description
docs/integrations/microsoft-agent-framework.md Fixes streamed response output in the standalone SDK example.

Review details

  • Files reviewed: 1/1 changed files
  • Comments generated: 0
  • Review effort level: Medium

@SteveSandersonMS
SteveSandersonMS added this pull request to the merge queue Jul 28, 2026
Merged via the queue into main with commit 4a8a8e6 Jul 28, 2026
17 checks passed
@SteveSandersonMS
SteveSandersonMS deleted the sdk-bugfix-61 branch July 28, 2026 08:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Microsoft Agent Framework guide: the Node.js streaming example reads a nonexistent delta field

3 participants