GoogleCloudPlatform / GoogleCloudPlatform/BigQuery-Agent-Analytics-SDK

adk-2.0 consumer: workflow_invocations view

Open
#212 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
47
Forks
21
Avg merge
2d 13h
Merged PRs (30d)
33

Description

Parent tracker: #190 (v18 contract).
Wave: 5 — Consumer views.
Blocked by: #195 (`attributes.adk.app_name` identity stamping — grouped on), #196 (producer `attributes.adk.node`), #210 (cross-event deployment plumbing).

## Contract

One row per `(JSON_VALUE(attributes, '$.adk.app_name'), user_id, session_id, invocation_id, node.path)` — the **full telemetry identity** including app_name, since the table can aggregate multiple apps/users.

DAG join on a **consumer-derived `parent_path`**: the producer emits `attributes.adk.node.path` and `attributes.adk.node.parent_run_id` but **does not serialize a `parent_path`**, so derive it by stripping the final `/` from `node.path` — **returning `NULL` when the path has no `/`** so a root node has no parent (a bare `REGEXP_REPLACE` would wrongly return the path unchanged for `root@1`):

```sql
CASE
WHEN STRPOS(node_path, '/') = 0 THEN NULL -- root@1 -> no parent
ELSE REGEXP_REPLACE(node_path, r'/[^/]+$', '') -- root@1/child@2 -> root@1
END AS parent_path
-- node_path = JSON_VALUE(attributes, '$.adk.node.path')
```

Join on the derived parent path **plus the full telemetry identity** (app_name, user_id, session_id). **Do not join on `parent_run_id` alone** — run ids are only unique within a single segment, so using them as a join key would corrupt the DAG.

Explicit filter: `WHERE NULLIF(JSON_VALUE(attributes, '$.adk.node.path'), '') IS NOT NULL` — `NULLIF` alone makes the read null-safe but doesn't keep empty/non-workflow rows out of the grouping (`NodeInfo.path` defaults to `""` for non-workflow events).

## Acceptance

- [ ] Full telemetry identity in `GROUP BY` / `JOIN ON`.
- [ ] DAG join uses a **consumer-derived** `parent_path` (final `/` stripped from `node.path`), not `parent_run_id`.
- [ ] Non-workflow rows (`path = ""`) and pre-2.0 rows (no `attributes.adk`) are excluded from the DAG output.
- [ ] Null-safe test asserts the exclusion.
- [ ] Parent-derivation case: `node.path = 'root@1/child@2/grandchild@3'` derives `parent_path = 'root@1/child@2'`; a single-segment `root@1` derives no parent (root node).

## References

- #190 (v18 consumer view 1; v6 `parent_path`; v15 `WHERE NULLIF`).
- #293 C1 — producer emits `attributes.adk.node.{path, run_id, parent_run_id}` (no serialized `parent_path`); `parent_path` is a consumer-side derivation from `path` (everything before the final `/@`).
- _Contract corrected 2026-06-15: `parent_path` is consumer-derived from `node.path`; the merged producer ships `parent_run_id`, not `parent_path` (verified against `google/adk-python` `origin/main`)._
- `src/google/adk/events/event.py:45` (path default `""`).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.