Skip to content

Add a Go example demonstrating intermediate vs terminal workflow outputs - #679

Open
PratikDhanave wants to merge 2 commits into
microsoft:mainfrom
PratikDhanaveFork:intermediate-outputs-example
Open

Add a Go example demonstrating intermediate vs terminal workflow outputs#679
PratikDhanave wants to merge 2 commits into
microsoft:mainfrom
PratikDhanaveFork:intermediate-outputs-example

Conversation

@PratikDhanave

Copy link
Copy Markdown
Contributor

What

Adds examples/03-workflows/conditional-edges/04_intermediate_outputs/main.go, a fully offline, deterministic example that demonstrates the two-tier workflow output API:

  • A mid-graph executor emits a progress string registered via WithIntermediateOutputFrom.
  • A final executor emits the terminal result registered via WithOutputFrom.
  • The NewEvents() loop branches on OutputEvent.IsIntermediate() to prefix [intermediate] vs [final], showing how the tag partitions the two OutputEvents.

It mirrors the sibling 01_edge_condition sample and reuses the examples/internal/demo helpers. The example is registered with cmd/verifyexamples as a deterministic example.

Why

The intermediate/terminal output API (WithIntermediateOutputFrom, OutputEvent.IsIntermediate(), OutputTagIntermediate) was wired but had no example. This matches the .NET/Python agent-framework, where intermediate outputs are a first-class, documented workflow concept for surfacing progress separately from the final result; the Go port now has an equivalent runnable sample so users can discover the pattern.

Testing

  • go build ./... passes.
  • go run ./examples/03-workflows/conditional-edges/04_intermediate_outputs prints one [intermediate] line followed by one [final] line.
  • go vet ./cmd/verifyexamples/... and go test ./cmd/verifyexamples/... pass (the new registration is covered by the existing verifyexamples definition tests).

@PratikDhanave
PratikDhanave requested a review from a team as a code owner July 24, 2026 01:27
Copilot AI review requested due to automatic review settings July 24, 2026 01:27

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 new runnable Go workflow example that demonstrates the “two-tier” workflow output model by emitting both an intermediate (progress) output and a terminal (final) output, and shows how to distinguish them via OutputEvent.IsIntermediate().

Changes:

  • Introduces a new offline/deterministic example at examples/03-workflows/conditional-edges/04_intermediate_outputs that emits intermediate and final outputs from different executors.
  • Registers the new example in cmd/verifyexamples with deterministic substring assertions to keep it covered by the example verification suite.

Reviewed changes

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

File Description
examples/03-workflows/conditional-edges/04_intermediate_outputs/main.go New workflow example showing WithIntermediateOutputFrom vs WithOutputFrom and tagging via OutputEvent.IsIntermediate().
cmd/verifyexamples/examples.go Adds deterministic verifier registration for the new intermediate-outputs example.

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

@github-actions github-actions Bot added the parity-approved Go API consistency review found no parity issues label Jul 24, 2026
@github-actions

This comment has been minimized.

@PratikDhanave
PratikDhanave force-pushed the intermediate-outputs-example branch from 131e1e0 to 13954f4 Compare July 24, 2026 01:40
@github-actions

This comment has been minimized.

Demonstrate WithIntermediateOutputFrom paired with WithOutputFrom so a
mid-graph executor emits a progress update tagged as intermediate while
the final executor emits the terminal result. The NewEvents loop branches
on OutputEvent.IsIntermediate to partition the two outputs, mirroring the
sibling conditional-edges samples. Register it with verifyexamples as a
deterministic example.
@PratikDhanave
PratikDhanave force-pushed the intermediate-outputs-example branch from 13954f4 to 2c75e4f Compare July 24, 2026 09:34
@github-actions

This comment has been minimized.

@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Parity Review: ✅ Approved

This PR adds examples/03-workflows/conditional-edges/04_intermediate_outputs/main.go — a new example file and a verifyexamples registration. No exported Go API surfaces are added or changed.

Cross-repo alignment: The Go example is semantically aligned with the upstream Python sample python/samples/03-workflows/control-flow/intermediate_vs_terminal_outputs.py. Both demonstrate WithIntermediateOutputFrom/intermediate_output_from and WithOutputFrom/output_from to partition intermediate progress updates from the final workflow result.

Coverage delta (not a parity issue): The Python sample additionally demonstrates as_agent() mapping intermediate events to text_reasoning content, and sub-workflow embedding with intermediate event bubbling. The Go example covers the core case only. This is a coverage gap, not a divergence — no regression or conflict is introduced by this PR.

public-api-change label: Not applied — no exported API surface was added or changed.

parity-approved label added.

Generated by Go API Consistency Review Agent · sonnet46 · 19.7 AIC · ⌖ 5.59 AIC · ⊞ 5.7K ·

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.

2 participants