Add a Go example demonstrating intermediate vs terminal workflow outputs - #679
Add a Go example demonstrating intermediate vs terminal workflow outputs#679PratikDhanave wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
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_outputsthat emits intermediate and final outputs from different executors. - Registers the new example in
cmd/verifyexampleswith 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.
This comment has been minimized.
This comment has been minimized.
131e1e0 to
13954f4
Compare
This comment has been minimized.
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.
13954f4 to
2c75e4f
Compare
This comment has been minimized.
This comment has been minimized.
Parity Review: ✅ ApprovedThis PR adds Cross-repo alignment: The Go example is semantically aligned with the upstream Python sample Coverage delta (not a parity issue): The Python sample additionally demonstrates
|
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:WithIntermediateOutputFrom.WithOutputFrom.NewEvents()loop branches onOutputEvent.IsIntermediate()to prefix[intermediate]vs[final], showing how the tag partitions the twoOutputEvents.It mirrors the sibling
01_edge_conditionsample and reuses theexamples/internal/demohelpers. The example is registered withcmd/verifyexamplesas 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_outputsprints one[intermediate]line followed by one[final]line.go vet ./cmd/verifyexamples/...andgo test ./cmd/verifyexamples/...pass (the new registration is covered by the existing verifyexamples definition tests).