Skip to content

[Feature Request] Support ToolContext for ADK function tools #1470

@kawolum

Description

@kawolum

Is your feature request related to a problem? Please describe.

ADK activity_tool cannot wrap ADK function tools that use ToolContext.

When an activity_tool has a tool_context: ToolContext parameter, the wrapper tries to serialize ToolContext for workflow.execute_activity(). Since ToolContext holds non-serializable objects, serialization fails at runtime.

@activity.defn
async def get_weather(query:str, tool_context: ToolContext) -> dict:
    db_url = tool_context.state.get("url", "")
    return requests.get(db_url).json()

search_tool = activity_tool(search_database, start_to_close_timeout=timedelta(seconds=30))

Describe the solution you'd like

Support tool_context from ADK.

Additional context

Not sure what's the best way to support this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions