Skip to content

feat: Implement tool provenance tracking for tool execution logging - #1382

Draft
vasilyl wants to merge 3 commits into
google:mainfrom
vasilyl:tool-provenance-tracking
Draft

feat: Implement tool provenance tracking for tool execution logging#1382
vasilyl wants to merge 3 commits into
google:mainfrom
vasilyl:tool-provenance-tracking

Conversation

@vasilyl

@vasilyl vasilyl commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Please ensure you have read the contribution guide before creating a pull request.

Link to Issue or Description of Change

1. Link to an existing issue (if applicable):

2. Or, if no issue exists, describe the change:

Problem:
During complex multi-agent executions or nested tool invocations, it is difficult to trace the origin of a tool (e.g., whether it is a local function, an MCP tool, a sub-agent, or a transfer agent). This lack of provenance makes debugging and analytics on tool usage patterns highly challenging.

Solution:
Introduce a getToolOrigin(t tool.Tool) string helper inside bigquery_agent_analytics_plugin.go to inspect the tool's type and return its origin classification (LOCAL, SUB_AGENT, MCP, A2A, TRANSFER_AGENT, or UNKNOWN). Use this to populate a tool_origin attribute in telemetry logs for TOOL_START, TOOL_END, and TOOL_ERROR event types.

Testing Plan

Added a unit test TestToolProvenance to verify that getToolOrigin correctly identifies LOCAL function tools and SUB_AGENT agent tools.

Checklist

  • I have read the CONTRIBUTING.md document.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests pass locally with my changes.
  • I have manually tested my changes end-to-end.

@vasilyl
vasilyl force-pushed the tool-provenance-tracking branch from 3c18af4 to 0d9a26f Compare August 25, 2026 19:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant