Add a sequential agent-workflow example demonstrating WithChainOnlyAgentResponses#709
Add a sequential agent-workflow example demonstrating WithChainOnlyAgentResponses#709PratikDhanave wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a new runnable, deterministic workflow example that demonstrates SequentialWorkflowBuilder.WithChainOnlyAgentResponses(true) by chaining three simple in-process agents and showing (via printed received-message counts) that each stage only receives the prior agent’s output.
Changes:
- Added
08_sequential_chain_only_responsesexample showing sequential chaining with chain-only message forwarding. - Implemented deterministic writer/translator/reviewer stage agents that log the messages they receive to make forwarding semantics observable.
- Registered the example in
cmd/verifyexamplesas a deterministic entry withMustContainassertions to validate behavior.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| examples/03-workflows/01-start-here/08_sequential_chain_only_responses/main.go | New deterministic sequential workflow example illustrating chain-only forwarding semantics. |
| cmd/verifyexamples/examples.go | Registers the new example as deterministic with output assertions to verify chain-only behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This comment has been minimized.
This comment has been minimized.
Add examples/03-workflows/01-start-here/08_sequential_chain_only_responses demonstrating SequentialWorkflowBuilder.WithChainOnlyAgentResponses(true), which forwards only each agent's own response to the next stage instead of the full accumulated conversation. The example chains writer -> translator -> reviewer with deterministic agents that print their received input, so the reader sees the translator receives only the writer's response, not the seed prompt. Register it as a deterministic entry in cmd/verifyexamples.
feb49c8 to
577532d
Compare
Parity Review: ✅ ApprovedThis PR adds only a runnable example ( Cross-SDK alignment
Label outcome
Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
network:
allowed:
- defaults
- "awmgmcpg"See Network Configuration for more information.
|
What
Adds
examples/03-workflows/01-start-here/08_sequential_chain_only_responses, a runnable example that demonstratesSequentialWorkflowBuilder.WithChainOnlyAgentResponses(true).The example chains three deterministic agents (writer -> translator -> reviewer) via
agentworkflow.NewSequentialWorkflowBuilder(...).WithChainOnlyAgentResponses(true).Build(). Each stage prints the messages it received before replying, so the reader can see that the translator and reviewer only ever receive the single message produced by the previous agent — not the seed prompt or the full accumulated conversation.Sample output:
The example is registered as a deterministic entry in
cmd/verifyexamples/examples.go, mirroring the existing07_writer_critic_workflowblock.Why
WithChainOnlyAgentResponseshad no example coverage — the only usage outside tests was none, and both existing sequential examples rely on the default (false). The flag controls whether each agent forwards only its own response or the accumulated conversation, which is a meaningful behavioral distinction worth showing. This mirrors the .NET/PythonSequentialBuilderchain-only option, and giving it a first-class example keeps the Go samples aligned with the other SDKs where the sequential-orchestration samples make the message-forwarding semantics explicit.How it is tested
go run ./examples/03-workflows/01-start-here/08_sequential_chain_only_responses/produces the fixed output above.IsDeterministicentry withMustContainassertions (includingTranslator received 1 message(s):), which is the distinguishing signal — with the default the translator would receive the accumulated conversation instead.TestSequentialWorkflowBuilder_ChainOnlyAgentResponsesinworkflow/agentworkflow/sequential_test.go.go build ./...,go vet, andgo test ./cmd/verifyexamples/ ./workflow/agentworkflow/all pass.