Skip to content

docs(bqaa): document ADK 2.0 agent-workflow and pause/resume events#1843

Closed
caohy1988 wants to merge 8 commits into
google:mainfrom
caohy1988:bqaa-adk2-docs
Closed

docs(bqaa): document ADK 2.0 agent-workflow and pause/resume events#1843
caohy1988 wants to merge 8 commits into
google:mainfrom
caohy1988:bqaa-adk2-docs

Conversation

@caohy1988

Copy link
Copy Markdown
Contributor

Summary

Documents the ADK 2.0 support added to the BigQuery Agent Analytics plugin (the "minimum producer cut") in docs/integrations/bigquery-agent-analytics.md. ADK 2.0 introduced multi-agent workflows and long-running tools that pause/resume across turns; this PR makes those flows discoverable and queryable for users.

What's added

  • Four new event types, each with a payload example and an auto-created view:
    • AGENT_TRANSFER — one agent hands off to another (v_agent_transfer)
    • AGENT_STATE_CHECKPOINT — agent state snapshot / end-of-run marker (v_agent_state_checkpoint)
    • EVENT_COMPACTION — a window of events compacted into a summary (v_event_compaction)
    • TOOL_PAUSED — a long-running tool or HITL request suspends (v_tool_paused)
  • The attributes.adk envelope — a concise field reference (schema_version, app_name, source_event_id, node, branch, scope, pause_kind, function_call_id) plus querying guidance.
  • Pause/resume pairingTOOL_PAUSEDTOOL_COMPLETED joined on function_call_id, with base-table and view-based SQL recipes for measuring how long a tool was suspended.
  • Reference updatesv_tool_completed gains pause_kind / function_call_id; the captured-events summary, event_type schema reference, views table, version note, and use-cases list are updated to include the ADK 2.0 events.

Doc-vs-code accuracy

All event types, view columns, and envelope fields were verified against the plugin source (src/google/adk/plugins/bigquery_agent_analytics_plugin.py): the _EVENT_VIEW_DEFS view definitions, the _build_adk_envelope / _enrich_attributes envelope logic, and the TOOL_PAUSED emission path. The existing AGENT_RESPONSE docs (flat attributes.source_event_*) are intentionally left unchanged, since that event predates the attributes.adk envelope.

Note on basing

This PR is stacked on top of #1817 (patch-19), which is still open and edits the same file. Until #1817 merges, this PR's diff also includes #1817's reliability/observability changes. Once #1817 merges, rebasing this branch onto main will reduce the diff to the ADK 2.0 additions only.

🤖 Generated with Claude Code

haiyuan-eng-google and others added 4 commits June 4, 2026 16:26
Added reliability and observability fixes for BigQuery Agent Analytics, including cross-region storage write routing, dropped-event tracking, and improved span management in Cloud Trace.
Resolve the code-fence/content-tab indentation issues flagged in review:

- Full example: restore the === "Python" content tab and indent the whole
  Python code block uniformly to 8 spaces so it is a proper sibling of the
  === "Java" tab (previously the block was half-de-indented with an orphaned
  opening fence next to a lone Java tab).
- Public methods: move the Python list inside the === "Python" tab (it had
  been pasted at column 0, outside the tab) and remove the duplicated list
  that ended up wrongly nested under the "Async context manager" bullet.
Add documentation for the ADK 2.0 "minimum producer cut" support in the
BigQuery Agent Analytics plugin:

- New event types: AGENT_TRANSFER, AGENT_STATE_CHECKPOINT, EVENT_COMPACTION,
  and TOOL_PAUSED — with payload examples and auto-created views.
- The `attributes.adk` envelope (schema_version, app_name, source_event_id,
  node, branch, scope, pause_kind, function_call_id) with a concise field
  reference and querying guidance.
- TOOL_PAUSED <-> TOOL_COMPLETED pairing via function_call_id, with base-table
  and view-based SQL join recipes for measuring tool pause duration.
- v_tool_completed gains the pause_kind / function_call_id columns.
- Captured-events summary, schema event_type reference, views table, and a
  new use-case bullet updated to include the ADK 2.0 events.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@google-cla

google-cla Bot commented Jun 15, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@netlify

netlify Bot commented Jun 15, 2026

Copy link
Copy Markdown

Deploy Preview for adk-docs-preview ready!

Name Link
🔨 Latest commit 077b66d
🔍 Latest deploy log https://app.netlify.com/projects/adk-docs-preview/deploys/6a31c96b41d3750008cf638b
😎 Deploy Preview https://deploy-preview-1843--adk-docs-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

caohy1988 and others added 4 commits June 15, 2026 15:58
…paction

Verified against google/adk-python main (the to-be-shipped code), which differs
from the older fork branch the first draft referenced:

- Version requirement: the ADK 2.0 workflow events are on main but not in any
  published release (not in v2.2.0). Reword the requirement note and intro to
  stop implying ADK 2.0 / v2.2.0 already ship them.
- HITL pairing: HITL completions are logged as HITL_*_REQUEST_COMPLETED, never
  TOOL_COMPLETED, so a hitl_* pause cannot pair through the tool join. Restrict
  both pause/resume queries to pause_kind='tool' and rewrite the HITL note.
- attributes.adk.node: the producer writes parent_run_id, not parent_path.
- EVENT_COMPACTION: compacted_content is a plugin-formatted string (via
  _format_content_safely), not a structured object.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…r-key shape

- Views table: mark the four ADK 2.0 workflow views and the new v_tool_completed
  pause_kind / function_call_id columns with a footnote noting they exist only in
  builds with the ADK 2.0 workflow event support (not in v2.2.0), so 1.27.0+
  users don't look for views/columns that aren't there. Also label
  v_event_compaction.compacted_content as JSON holding the formatted summary.
- attributes.adk envelope table: split pause_kind/function_call_id wording —
  TOOL_PAUSED carries tool or hitl_*, but a resumed TOOL_COMPLETED only ever
  carries pause_kind='tool' (HITL completions are HITL_*_REQUEST_COMPLETED).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Distinguish released plugin features from the unreleased ADK 2.0 workflow
support in the top-level Version Requirement note, so 1.26.0+/v2.2.0 users
are not told the whole document is available to them. Also note the
1.27.0+ requirement for automatic view creation.

Correct the span_id description in three places (intro code comment,
schema table, and Tracing section): span_id is not always internally
generated. The root invocation span reuses the ambient OTel span id when
one is active; only child BQAA spans are generated internally.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The manual CREATE TABLE DDL still described span_id as "Generated
internally by the plugin." Align it with the corrected wording elsewhere:
the root invocation span may reuse the ambient OTel span id while child
BQAA spans are generated internally, and no OTel span is created/exported.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@caohy1988 caohy1988 closed this Jun 16, 2026
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.

2 participants