Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Get Invocation ID from tool context #1831

@saravanabalagi-poppulo

Description

@saravanabalagi-poppulo

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

  • I save artifacts to tool context using tool_context.save_artifact() when within a tool
  • Then retrieve it back in the agent using artifact service with session
  • The retrieval filters only artifacts for the current session (which is equivalent to conversation)
  • But not for the current invocation (which is equivalent to current message within conversation)
Code
# save artifact from a tool
await tool_context.save_artifact(FILENAME, some_data)

# retrieve in agent (e.g. within agent stream fn)
await artifact_service.load_artifact(
    app_name=app_name,
    user_id=user_id,
    session_id=session_id,
    filename=FILENAME,
)

Describe the solution you'd like
tool context have invocation id when inside a particular invocation

Describe alternatives you've considered

  • I can retrieve and save invocation id to state (using an session event update)
  • Use this invocation id from tool call and add to metadata
  • Then filter each retrieved artifact using metadata
  • A better way would be have invocation id within the tool context

Additional context
N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    bot triaged[Bot] This issue is triaged by ADK botcore[Component] This issue is related to the core interface and implementation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions