Skip to content

Add a runnable example for the public messageworkflow chat-protocol primitives - #752

Merged
George Adams (gdams) merged 1 commit into
microsoft:mainfrom
PratikDhanaveFork:message-workflow-example
Jul 28, 2026
Merged

Add a runnable example for the public messageworkflow chat-protocol primitives#752
George Adams (gdams) merged 1 commit into
microsoft:mainfrom
PratikDhanaveFork:message-workflow-example

Conversation

@PratikDhanave

Copy link
Copy Markdown
Contributor

What

Adds examples/03-workflows/message-workflow, the first runnable example that exercises the public message/messageworkflow package. Until now the turn-token / message-accumulation protocol had no example — grep messageworkflow examples/ returned zero matches, and the only in-repo consumers were the internal agentworkflow builders.

The example wires driver -> relay -> chat -> collector:

  • messageworkflow.Configure builds the chat executor: it accumulates every *message.Message/[]*message.Message it receives and invokes its TakeTurnHandler exactly once when a TurnToken arrives, building a single reply from the accumulated turn.
  • messageworkflow.ConfigureForwarding builds the relay executor that relays messages and turn tokens downstream (with StringMessageRole set so bare strings are forwarded as user messages).
  • The example runs the workflow twice to demonstrate DisableAutoSendTurnToken: with auto-send (the default) the collector observes the forwarded TurnToken (forwarded turn tokens: 1); with it disabled the token stops at the chat executor (forwarded turn tokens: 0). Both runs show TakeTurnHandler invocations: 1, confirming a TurnToken triggers exactly one turn regardless of how many messages accumulated.

Registered in cmd/verifyexamples/examples.go as a deterministic example (no model credentials required).

Why

This mirrors the .NET / Python MessageWorkflow samples, where the chat-message protocol (buffer messages, take a turn on a token, forward the token to the next participant) is documented with a runnable sample. The Go port already exposes the same primitives (Configure, ConfigureForwarding, Options.DisableAutoSendTurnToken) but had no example, leaving the turn-token path undocumented for users. PR #691 added godoc only; this adds the missing executable walkthrough, keeping cross-SDK parity.

Testing

  • go build ./...
  • go vet ./examples/03-workflows/message-workflow/... ./cmd/verifyexamples/...
  • go test ./cmd/verifyexamples/...
  • go run ./examples/03-workflows/message-workflow/ — output contains the accumulated messages in order (You said: hello | how are you?), forwarded turn tokens: 1 then 0, and TakeTurnHandler invocations: 1 for both scenarios.

@PratikDhanave
PratikDhanave (PratikDhanave) requested a review from a team as a code owner July 24, 2026 04:18
Copilot AI review requested due to automatic review settings July 24, 2026 04:18

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

Adds a first runnable Go example demonstrating the public message/messageworkflow turn-token / message-accumulation protocol, and wires it into the repository’s example verification harness to keep it deterministic and continuously checked.

Changes:

  • Introduces examples/03-workflows/message-workflow, a runnable workflow showing ConfigureForwarding (relay) + Configure (chat) + DisableAutoSendTurnToken behavior across two scenarios.
  • Registers the new example in cmd/verifyexamples/examples.go with deterministic expected output substrings.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
examples/03-workflows/message-workflow/main.go New runnable sample exercising messageworkflow primitives (message accumulation + turn token semantics + forwarding).
cmd/verifyexamples/examples.go Adds the new example to the verification list with deterministic output expectations.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions

This comment has been minimized.

@github-actions github-actions Bot added the parity-approved Go API consistency review found no parity issues label Jul 24, 2026
Add examples/03-workflows/message-workflow demonstrating the public
messageworkflow package: Configure accumulates messages and invokes
TakeTurnHandler once per TurnToken, ConfigureForwarding relays messages
and turn tokens downstream, and DisableAutoSendTurnToken controls whether
the token is forwarded after a turn. Register it in verifyexamples as a
deterministic example.
@github-actions

Copy link
Copy Markdown
Contributor

Parity Review — PR #752

Scope: examples/03-workflows/message-workflow (new runnable example) + cmd/verifyexamples/examples.go registration.

Exported API surface changed: None. This PR exercises the pre-existing public API — messageworkflow.Configure, messageworkflow.ConfigureForwarding, and Options.DisableAutoSendTurnToken — without adding, removing, or altering any exported symbols. The public-api-change label is not warranted.

Cross-repo parity: The PR claims to mirror upstream .NET and Python "MessageWorkflow" samples. Checking dotnet/samples/03-workflows and python/samples/03-workflows confirms neither has a dedicated message-workflow folder. However, the underlying protocol — buffer messages, take a single turn on a TurnToken, optionally forward the token downstream — is consistent with the framework's cross-SDK design intent. The example fills a sample coverage gap rather than introducing divergence.

Behavior parity: The two demo scenarios (DisableAutoSendTurnToken: false vs true) correctly illustrate the semantics documented in the existing package and align with how turn-token propagation is described in the upstream framework architecture. No behavioral deviation from upstream expectations was found.

Verdict: ✅ No parity issues. The change is example-only, stays within the existing public API, and is conceptually aligned with the upstream framework. parity-approved label retained.

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • awmgmcpg

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "awmgmcpg"

See Network Configuration for more information.

Generated by Go API Consistency Review Agent · 32.8 AIC · ⌖ 3.99 AIC · ⊞ 5.9K ·

@gdams
George Adams (gdams) added this pull request to the merge queue Jul 28, 2026
Merged via the queue into microsoft:main with commit 78a62dc Jul 28, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

parity-approved Go API consistency review found no parity issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants