docs(examples/workflow): add a WithUseAsOutput sample - #922
Merged
Merged
Conversation
wolo-lab
force-pushed
the
wolo/run_node_use_as_output
branch
from
May 29, 2026 19:10
982aa73 to
1ebaccb
Compare
wolo-lab
force-pushed
the
wolo/run_node_use_as_output_sample
branch
from
May 29, 2026 19:10
3b93b94 to
01ce85a
Compare
wolo-lab
force-pushed
the
wolo/run_node_use_as_output
branch
from
May 29, 2026 19:18
1ebaccb to
f864f49
Compare
wolo-lab
force-pushed
the
wolo/run_node_use_as_output_sample
branch
2 times, most recently
from
May 29, 2026 19:34
8e5abba to
f04ccc5
Compare
wolo-lab
force-pushed
the
wolo/run_node_use_as_output
branch
from
May 29, 2026 20:03
f864f49 to
94fd0ec
Compare
wolo-lab
force-pushed
the
wolo/run_node_use_as_output_sample
branch
5 times, most recently
from
May 30, 2026 15:41
b1644a5 to
7948949
Compare
wolo-lab
force-pushed
the
wolo/run_node_use_as_output
branch
15 times, most recently
from
June 5, 2026 12:36
467581b to
3f8bec4
Compare
wolo-lab
force-pushed
the
wolo/run_node_use_as_output_sample
branch
from
June 5, 2026 19:24
6c18731 to
915433d
Compare
wolo-lab
changed the base branch from
wolo/run_node_use_as_output
to
wolo/output-for
June 5, 2026 19:48
wolo-lab
force-pushed
the
wolo/run_node_use_as_output_sample
branch
from
June 5, 2026 20:04
915433d to
1bbcff8
Compare
wolo-lab
force-pushed
the
wolo/run_node_use_as_output_sample
branch
from
June 8, 2026 08:07
ba4809e to
dce4f28
Compare
wolo-lab
force-pushed
the
wolo/run_node_use_as_output_sample
branch
from
June 8, 2026 08:16
dce4f28 to
43c93bd
Compare
wolo-lab
force-pushed
the
wolo/run_node_use_as_output_sample
branch
from
June 8, 2026 08:18
43c93bd to
656ebe4
Compare
wolo-lab
force-pushed
the
v2
branch
2 times, most recently
from
June 22, 2026 10:45
fbb3e0c to
1ccdf49
Compare
wolo-lab
force-pushed
the
wolo/run_node_use_as_output_sample
branch
from
June 22, 2026 10:57
656ebe4 to
7d9e344
Compare
wolo-lab
force-pushed
the
wolo/run_node_use_as_output_sample
branch
from
August 26, 2026 19:14
7d9e344 to
6edb613
Compare
The workflow examples cover dynamic orchestration and AgentNode composition, but nothing shows output delegation: handing a dynamic node's terminal output to a child so the child's event carries it and the parent emits none. The orchestrator branches in plain Go before any model call, so both paths are reachable from the console and the documented session reproduces. The in-scope branch delegates to an LlmAgent child with WithUseAsOutput, the out-of-scope branch returns its own string.
wolo-lab
force-pushed
the
wolo/run_node_use_as_output_sample
branch
from
August 26, 2026 21:44
6edb613 to
9bc1ed0
Compare
wolo-lab
marked this pull request as ready for review
August 27, 2026 08:30
Review of the sample turned up four claims that do not match what the code does. The "needs LLM on the delegating branch only" bullet was wrong in the way that costs a newcomer the most time: the model client is built at startup, so without credentials the sample dies with "api key is required" before printing a prompt, including on the branch that never calls the model. "Reaches the caller exactly once" was true of events but not of the console, which prints the reply once either way, so a reader deleting WithUseAsOutput to see the promised duplicate would have concluded the option does nothing. Nothing said why the orchestrator has no successor. A node chained after a delegating dynamic node receives the zero value rather than the delegated text, silently, so the omission was the one thing a reader most needed explained. The unknown-agent warning fires on turns after a delegated one, when the runner walks the history, not on the delegated turn itself. Also numbers the diagram edge that was skipped on the delegating path, reconciles the legend with the arrows actually drawn, and switches the transcript to US spelling. The transcript was re-captured from a live run rather than edited by hand.
kdroste-google
requested changes
Aug 27, 2026
Switches the sample to gemini-3.5-flash. gemini-flash-latest is an AI Studio alias and returns 404 NOT_FOUND on Vertex, which the README offers as Option B, so a reader following that path hit an error. The 15 samples still on the alias were all written in one batch on the same day; every example touched since #1162 uses gemini-3.5-flash, and that commit made the switch specifically to drop the API-key dependency. Replaces the flowchart with a sequence diagram, as suggested in review. The sample exists to show WHICH participant emits the event carrying the output, and a flowchart cannot express authorship — the sequence diagram shows the reply leaving drafter rather than assistant. It also carries the branch natively through alt/else, so the step numbering and the solid-versus-dotted legend the flowchart needed are both gone. Precedent: examples/agentregistry/{bind,a2a}. The example session was re-captured from a live run on the new model rather than edited by hand.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The workflow examples cover dynamic orchestration (
dynamic/basic) and calling anLlmAgentfrom a dynamic body (dynamic/llm), but none of them shows output delegation.workflow.WithUseAsOutput()promotes a child's output to the parent dynamic node's terminal output. Without it the same value rides two events, the child's own event and the orchestrator's terminal event. With it only the child's event carries the value, stamped for both node paths, so anLlmAgent's reply reaches the caller authored by the agent instead of being restated by the workflow. There was no runnable sample for the option and no entry for it in the workflow example index.Summary
Adds
examples/workflow/dynamic/use_as_output/and registers it inexamples/workflow/README.md. The layout follows the sibling samples: amain.goplus a README with concept bullets, goal, auth block, Mermaid diagram, run command, example session, and a "what it shows" table.A single orchestrator holds both behaviors so the contrast is visible from the console. An in-scope request is delegated to an
LlmAgentchild withWithUseAsOutput(). Anything else is answered by the orchestrator's ownreturn, without calling the model at all.Which branch runs is decided by a substring check on the user's request rather than by anything the model produces, and that is deliberate. An earlier draft gated on the length of the generated email, so the delegating branch — the only thing the sample exists to show — never ran: drafts measured 412 and 506 characters against a 60-character threshold. A guard evaluated in Go before the model call keeps both branches reachable on demand and makes the session in the README reproduce.
The orchestrator is the last node in the graph, which is the shape that works today. A successor placed after a delegating dynamic node receives the zero value instead of the delegated output, which is a separate engine defect and out of scope here.