docs(workflow): make the single-turn node example runnable - #7188
Open
winter-street wants to merge 1 commit into
Open
winter-street wants to merge 1 commit into
winter-street wants to merge 1 commit into
Conversation
The example imported `build_node` from `google.adk.workflow`, which does not export it, so the snippet raised ImportError. `build_node` is also unnecessary: `Workflow` wraps node-like objects in `edges` automatically. The trailing `(writer_node, "END")` edge used a string that is not a valid node-like value, which raises WorkflowConfigurationError. Pass the agent directly and drop the terminal edge, matching the other workflow guides.
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.
Link to Issue or Description of Change
2. Or, if no issue exists, describe the change:
Problem:
The single-turn example in this guide does not run. There are three separate issues in the same snippet:
from google.adk.workflow import Workflow, build_node—google/adk/workflow/__init__.pydoes not exportbuild_node(it is not in__all__or_LAZY_MEMBERS, and there is noworkflow/build_node.py), so the import raisesImportError.writer_node = build_node(writer_agent)— unnecessary.Workflowwraps node-like objects inedgesautomatically, so the agent can be passed directly.(writer_node, "END")—"END"is not a valid node-like value. Perbuild_node's docstring the accepted types areBaseNode,BaseAgent,BaseTool, a callable, or'START', so this raisesWorkflowConfigurationError.Solution:
Pass the agent directly and drop the terminal edge, matching the other workflow guides:
This follows the pattern in
docs/guides/workflow/graph/index.md,function_node/index.md,base_node/index.md, andcontributing/samples/workflows/agent_in_workflow/agent.py, none of which callbuild_nodeor use an"END"endpoint.Testing Plan
Small documentation fix, so per the template this section is not required. For completeness, the verification performed:
src/google/adk/workflow/__init__.pywithastand enumerated its module-level bindings and__all__:build_nodeis absent,Workflowis present.workflow/build_node.pyorworkflow/build_node/submodule exists.build_node's docstring, which documentsWorkflowConfigurationErrorfor node-like values outsideBaseNode/BaseAgent/BaseTool/callable/'START'.from google.adk... import ...statements acrossdocs/,contributing/, and.agents/, resolving submodule imports. This was the last broken import; the count is now zero.