Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions docs/graphs/dynamic.md
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,10 @@ manually read and write session state keys for data transfer.
```

You can also pass specific data schemas using a defined class and configure
input and output schemas, similar to graph-based workflow nodes:
input and output schemas, similar to graph-based workflow nodes. To bind
named function parameters from input rather than workflow state, set
`parameter_binding="node_input"` and pass a dictionary whose keys match
the function's parameters:

```python
from google.adk import Agent
Expand All @@ -244,7 +247,7 @@ manually read and write session state keys for data transfer.
time_info: str # time information
city: str # city name

@node
@node(parameter_binding="node_input")
def city_time_function(city: str):
"""Simulate returning the current time in a specified city."""
return CityTime(time_info="10:10 AM", city=city)
Expand All @@ -258,7 +261,9 @@ manually read and write session state keys for data transfer.

@node # workflow node
async def city_workflow(ctx: Context):
city_time = await ctx.run_node(city_time_function, "Paris")
city_time = await ctx.run_node(
city_time_function, node_input={"city": "Paris"}
)
report_text = await ctx.run_node(city_report_agent, city_time)

return report_text
Expand Down Expand Up @@ -299,7 +304,9 @@ as you can with graph-based workflows.
@node # workflow node
async def city_workflow(ctx: Context):
city = await ctx.run_node(city_generator_agent)
city_time = await ctx.run_node(city_time_function, city)
city_time = await ctx.run_node(
city_time_function, node_input={"city": city}
)
report_text = await ctx.run_node(city_report_agent, city_time)

return report_text
Expand Down