Skip to content

Can nodes use other argument names than node_input? #2100

Description

@jzju

@node
def city_time_function(city: str):
"""Simulate returning the current time in a specified city."""
return CityTime(time_info="10:10 AM", city=city)
city_report_agent = Agent(
name="city_report_agent",
model="gemini-flash-latest",
input_schema=CityTime,
instruction="""output the data provided by the previous node.""",
)
@node # workflow node
async def city_workflow(ctx: Context):
city_time = await ctx.run_node(city_time_function, "Paris")
report_text = await ctx.run_node(city_report_agent, city_time)
return report_text
```

Test code:

@node
def city_time_function(city: str):
    return "Hello"


@node(rerun_on_resume=True)
async def city_workflow(ctx: Context):
    city_time = await ctx.run_node(city_time_function, "Paris")
    return city_time


session_service = InMemorySessionService()
session = await session_service.create_session(app_name=APP_NAME, user_id=USER_ID, session_id=SESSION_ID)
runner = Runner(agent=city_workflow, app_name=APP_NAME, session_service=session_service)
content = types.Content(role='user', parts=[types.Part(text="hello")])
events = runner.run(user_id=USER_ID, session_id=SESSION_ID, new_message=content)
for event in events:
    pass

Error:

ValueError: Missing value for parameter "city" of function "city_time_function". It was not found in state and has no default value.

Changeing to node_input works:

@node
def city_time_function(node_input: str):
    return "Hello"

Python 3.14.6
google-adk==2.6.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions