BQ Agent Analytics · report · 2026-09-28

Intent analysis: BigQuery Agent Analytics SDK

What the SDK does, how the data is shaped, what it already offers for understanding user intent in agent traces, where it is thin, and a ranked list of concrete intents I could implement, contribute, or build on.

Method. I read the upstream README, SDK.md (~2.7k lines), CHANGELOG.md, docs/, and the src/ modules at the snapshot commit, plus every open issue and PR as of 2026-09-28 (64 open issues, 1 open PR) and the roadmap issue #96. Every claim links to its source. Sizes are my own rough estimates: S ≈ ≤1 week, M ≈ 1–3 weeks, L ≈ >3 weeks or gated on an upstream RFC.
  1. TL;DR
  2. What it is
  3. Architecture
  4. Data model: agent_events
  5. Key capabilities
  6. Intent analysis today
  7. Gaps and limitations
  8. Project activity
  9. Open-issue map
  10. Ranked candidate intents
  11. Contributing notes
  12. Sources

TL;DR

What it is

The package bigquery-agent-analytics (Apache-2.0, “Development Status :: 3 - Alpha”, Python 3.10–3.14) describes itself as a “consumption-layer toolkit for agent observability, analysis, evaluation, and advanced capabilities like the Agent Context Graph” (README, pyproject.toml).

Producers write, the SDK reads. The ADK BigQueryAgentAnalyticsPlugin and the LangChain/LangGraph BigQueryCallbackHandler “emit the same schema and can write to the same table side by side”. The SDK is “read-only over that table” (README §How this fits together). The repo now also hosts its own producers: bigquery-agent-analytics-tracing (a writer/drainer, an OTLP receiver, and a Claude Code plugin with nine hooks) (producers/README.md).

from bigquery_agent_analytics import Client, TraceFilter
client = Client(project_id="my-project", dataset_id="analytics",
                table_id="agent_events", location="US")
traces = client.list_traces(TraceFilter(limit=1))
traces[0].render()

Architecture

LayerWhat lives thereSource
Coreclient.py (high-level Client, ~5.5k lines), trace.py (trace/DAG reconstruction), views.py (per-event + cross-event views), event_semantics.pysrc/bigquery_agent_analytics
EvaluationSystem evaluator (latency, turns, tool error rate, tokens, TTFT, cache hit, cost), performance / LLM judge, multi-trial pass@k, grader composition, eval suites, validators, EvalBenchSDK.md §3–§8, §24
AI/MLAI.GENERATE, AI.EMBED, AI.CLASSIFY, AI.DETECT_ANOMALIES, AI.FORECAST; BigFrames evaluator; categorical (“Hatteras-style”) evaluatorSDK.md §12–§13, §16
Analyticsinsights.py (multi-stage report), feedback.py (drift + question distribution), memory_service.py (cross-session memory, user profiles)SDK.md §9–§11
Context graph / ontologyDecision-trace extraction into a BigQuery property graph (GQL), scheduled materialization (bqaa context-graph), ontology runtime, extractor compilationSDK.md §18 · src/bigquery_ontology
SurfacesCLIs bq-agent-sdk / bqaa; Remote Function, Python UDF, streaming evaluation, continuous queries, OTLP receiver, skill-evolution job; Looker Studio, Grafana, and Streamlit dashboardsdeploy/ · dashboards/
ExportSchema-agnostic LangSmith exporter with idempotent run IDs and incremental watermarksSDK.md §23

Every job the SDK submits is labeled (sdk, sdk_version, sdk_surface, sdk_feature, sdk_ai_function), so spend is attributable from INFORMATION_SCHEMA.JOBS without a separate telemetry pipeline (docs/sdk_usage_tracking.md).

Data model: agent_events

One time-partitioned table with one row per event. The columns below are the ones the SDK’s own seeder creates (seed_events.py#L53):

ColumnTypeRole
timestamp · event_typeTIMESTAMP · STRING (required)Partition key; event taxonomy below
agent · session_id · invocation_id · user_idSTRINGIdentity. session_id is reusable, not unique; ambiguous reads raise AmbiguousSessionError (README)
trace_id · span_id · parent_span_idSTRINGSpan tree / DAG reconstruction
status · error_messageSTRINGErrors via ERROR_SQL_PREDICATE
content · attributes · latency_msJSONPayload (e.g. $.text_summary on user messages), ADK metadata, timings
is_truncatedBOOLEANContent was truncated by the producer

Event families (event_semantics.py#L138): user (USER_MESSAGE_RECEIVED), invocation, agent (incl. AGENT_TRANSFER, AGENT_STATE_CHECKPOINT), llm (LLM_REQUEST/RESPONSE/ERROR), tool (TOOL_STARTING/COMPLETED/ERROR/PAUSED), state (STATE_DELTA), six HITL events, and ADK 2.0 compaction and workflow-node boundaries. ViewManager unnests each type into a typed view (for example adk_llm_requests) and deploys cross-event views such as compaction_windows (SDK.md §15).

What matters for intent analysis: the user’s words live in USER_MESSAGE_RECEIVED.content (text_summary). The outcome signal is spread across tool errors, HITL events, the final response, and optional categorical_results.

Key capabilities

AreaCapabilityRef
ObservabilityTrace reconstruction + DAG render; per-event views; 37-chart Looker Studio template; Grafana and Streamlit dashboardsREADME · Looker README
EvaluationSystem metrics; LLM-judge metrics (correctness, hallucination, sentiment…); golden trajectories; pass@k / pass^k; weighted, binary, and majority graders; eval-suite graduation and saturation; static eval validationSDK.md §3–§8
ClassificationCategorical evaluator: user-defined metrics and categories via AI.CLASSIFY / AI.GENERATE with Gemini API fallback, append-only persistence, dashboard views, 5-minute micro-batchSDK.md §16
InsightsSeven-section report (Task Areas, Interaction Patterns, What Works Well, Friction Analysis, Tool Usage, Improvement Suggestions, Trends & Anomalies) plus per-session facetsSDK.md §10
DriftGolden vs production question coverage; keyword or embedding (AI.EMBED + ML.DISTANCE)SDK.md §9
MemoryCross-session episodes, semantic memory search, UserProfileBuilder (topics, common requests, preferred tools)SDK.md §11
Context graphDecision requests → options → outcomes as a BigQuery property graph; GQL traversal; world-change (HITL safety) checksSDK.md §18 · README quickstart
CI/CDbq-agent-sdk evaluate --exit-code gates; doctor, insights, drift, distribution, categorical-eval, views commandsSDK.md §19

Intent analysis today

Four surfaces already answer “what are users trying to do?”:

SurfaceHow it worksRef
client.deep_analysis(AnalysisConfig(mode=…))Modes: frequently_asked (GROUP BY exact text_summary), frequently_unanswered (questions in sessions that had any error), auto_group_using_semantics and custom (one AI.GENERATE call per question: “Classify this question into exactly one category”, temperature 0, output category STRING). Falls back to legacy ML.GENERATE_TEXT, then to frequently_asked; details["grouping_mode"] records which path ran.feedback.py#L244 · #L840
client.insights(InsightsConfig)An LLM writes per-session facets (goal_categories, outcome, satisfaction, friction_types, session_type, key_topics, …) against fixed vocabularies, then aggregates them (goal_distribution, outcome_distribution) and writes the seven report sections.insights.py#L62
client.evaluate_categorical(config)The most flexible option: arbitrary user-defined metrics and categories (an intent metric works), per-trace trusted context, persistence to categorical_results with identity/provenance, dashboard views, and cron micro-batch.SDK.md §16
client.drift_detection() · UserProfileBuilderCoverage of golden questions in production traffic; per-user “common requests” and topics.SDK.md §9, §11

Gaps and limitations

  1. No intent discovery. “Auto group using semantics” with no categories falls back to six hard-coded generic labels (feedback.py#L875). No embedding clustering or taxonomy induction exists. AI.EMBED is only used for drift.
  2. Closed vocabularies in insights. GOAL_CATEGORIES, OUTCOMES, FRICTION_TYPES, and SESSION_TYPES are module constants, and labels outside them are dropped (insights.py#L815). Domain intents such as “refund status” cannot be expressed there.
  3. Intent is not persisted. Insights facets and question distributions come back as in-memory Pydantic objects, so there is no intent time series. Only the categorical evaluator persists.
  4. Question-level, not session-level. Grouping classifies each USER_MESSAGE_RECEIVED row on its own. Multi-turn goals, intent shifts, and corrections are not modeled in core (#429).
  5. Exact-match heuristics. frequently_asked and keyword_overlap drift use whole-string equality after lower/strip (feedback.py#L520). frequently_unanswered counts a question as unanswered if any event in its session errored (feedback.py#L285).
  6. Small default samples. TraceFilter.limit defaults to 100 and InsightsConfig.max_sessions to 50 (trace.py#L577, insights.py#L251). Fine for exploration, but corpus-level intent work needs explicit, cost-aware batching.
  7. Truncated input. Intent SQL reads content.text_summary. The schema carries is_truncated, but the grouping queries do not use it.
  8. Producer/schema governance. No column-level projection (#321); custom_metadata capture limited to a2a:* keys (#320). Both matter if intents need PII-safe inputs or custom labels.
  9. Alpha surface, heavy API. The classifier says “3 - Alpha”, and #128 asks to simplify the API and add API docs.

Project activity

Open-issue map (64 issues, 1 PR)

ClusterIssuesIntent relevance
Self-improvement / quality loop#63 scorecard · #95 DS features · #318 BigQuerySampler flywheel · #436 synthetic evals · #49 / #131 ReasoningBank · #429 correction analysisHigh. Intents are the natural stratification key.
Failure analysis#435 AgentForensics RFC · #10 wish list (SxS diff)High. Intent × failure matrix.
Producers / OTel#153 full OTel (57 comments) · #316 Claude Code OTLP receiver · #364 OTel Collector exporter · #229 / #235 producers · #372 / #363 customer journeys · #349 / #353 releasesMedium. The path to my own fleet data.
ADK 2.0 views#190 tracking · #212–#219 consumer views · #206–#209 designLow–medium. Workflow context for intents.
Dashboards#365 · #377 · #381 · #386 · #396 MCP App dashboard · #415 · #418 NL Q&A data agent · #434Medium. Somewhere to show intent views.
Ontology / context graph#30 · #75 · #93 · #138–#140 A2A lineageLow. The roadmap calls this workstream over-extended.
Docs / DevX#51 blog series · #128 API docs · #283 user manual (19 comments) · #475 contributor onboarding · #482 simplify examplesMedium. Low-risk first PRs.
Governance#320 metadata allowlist · #321 column projection · #498 attestation botLow–medium.

The roadmap (#96) summary: trace consumption, evaluation, and CLI gating are “mature”; the self-improvement loop is “the next center of gravity”; and ontology/context graph is “over-extended” (at most one ontology bet per quarter).

Ranked candidate intents

Ranked by leverage for intent analysis × fit with where upstream is heading × how quickly I can land it. Nothing here has been filed upstream.

Size M

Dogfood BQAA on my own agent fleet (Claude Code + Codex → BigQuery), then run intent analysis on it

Why. Gives real, owned traces instead of seeded demo data. The repo ships a Claude Code tracing plugin (nine hooks) and an OTLP receiver path for Claude/Codex telemetry. Upstream explicitly lists the Claude Code plugin as a contributor-onboarding target.

What. Point the plugin at a personal dataset, run ViewManager.create_all_views(), then insights() / deep_analysis() / evaluate_categorical() over my own sessions. Write up friction found during setup as candidate upstream fixes. Needs a non-production GCP project.

Evidence: plugins/claude_code · producers/ · deploy/otlp_receiver · #475 (onboarding: Grafana + Claude Code plugin) · #372 · #317 (Codex OTLP design, blocked on #316)

Size M

Real intent discovery: replace the fixed six-label “auto group” with embed → cluster → name

Why. AnalysisConfig(mode="auto_group_using_semantics") reads like clustering, but with no custom categories it classifies each question into a hard-coded list (General Inquiry, Technical Support, Account Management, Feature Request, Bug Report, Other). So it cannot surface intents nobody thought of.

What. New mode (e.g. discover): AI.EMBED the USER_MESSAGE_RECEIVED text, cluster in BigQuery ML (k-means), have an LLM name each cluster from sampled members, and return an induced taxonomy that can be fed back as custom_categories. Reuses the existing AI.EMBED plumbing from semantic drift.

Evidence: feedback.py#L875 (default labels) · feedback.py#L320 (per-question AI.GENERATE classify) · feedback.py#L114 (AI.EMBED already used for drift) · #74 (insights-from-traces papers)

Size S–M

Configurable, persisted intent taxonomy in insights()

Why. Session facets use module-level vocabularies (14 GOAL_CATEGORIES, 5 outcomes, 12 friction types, 5 session types). Labels outside the list are silently dropped (goals fall back to other). Facets are returned in memory, not written to a table, so there is no intent history to trend.

What. Add taxonomy overrides to InsightsConfig and an opt-in persist_results that writes facets to an append-only table with a latest-per-session view, following the pattern categorical_results already uses (schema, then writer, then views).

Evidence: insights.py#L62 (GOAL_CATEGORIES) · insights.py#L815 (out-of-list labels dropped) · insights.py#L251 (max_sessions default 50) · #63 (Quality Scorecard reuses categorical persistence)

Size M

Intent × outcome views: which intents fail, stall, or cost the most

Why. The analysis that matters for an intent is how it connects to outcomes. Today frequently_unanswered groups on exact question strings and counts any session with any error event. There is no view joining intent to outcome, friction, tool errors, latency, or cost.

What. Session-level intent (first message or LLM-summarized goal) joined to the per-event views and categorical_results, giving intent_outcome_matrix / intent_cost cross-event views registered in _CROSS_EVENT_VIEW_DEFS, plus a Streamlit/Grafana panel.

Evidence: feedback.py#L285 (frequently_unanswered SQL) · views.py (cross-event registry, landed in #489) · dashboards/ (Streamlit #480; Grafana moved there in #481)

Size S–M

Intent-level drift and coverage (golden vs production intents)

Why. drift_detection() defaults to keyword_overlap, which is really case-insensitive exact matching of whole questions. The embedding path only runs when an embedding model is passed, and it compares questions, not intents.

What. Make the semantic path easy to reach from the CLI, and add a coverage report per intent cluster (golden share vs production share, uncovered clusters with examples). That report can feed eval-set curation directly.

Evidence: feedback.py#L520 (keyword_overlap) · feedback.py#L540 (cosine threshold 0.3) · #318 (quality flywheel) · #436

Size M–L

Multi-turn intent shift and correction tagging in core

Why. Intent is not static within a session. Upstream already wants the parroted/recovered correction tagger moved out of scripts/quality_report.py into a library surface. Per-turn intent tags are a natural sibling.

What. Contribute to or build on #429: a core turn-segmentation module that emits per-turn tags (intent, correction, recovery) in the sub-trajectory shape the judge reports and skill-evolution already expect.

Evidence: #429 · scripts/quality_report.py

Size L

Intent-stratified synthetic eval sets from real traces

Why. RFC #436 proposes deriving eval cases from production traces. Stratifying by discovered intent keeps rare intents from being drowned out by head traffic.

What. After intents 2 and 3 exist: sample per intent cluster, generate tasks, expected trajectories, and near-misses, then emit an EvalSuite tagged by intent.

Evidence: #436 · #95 (automated benchmarking) · SDK.md §7 Eval Suite Management

Size L

Tie intents to the AgentForensics failure taxonomy

Why. RFC #435 (27 comments) proposes an automated failure taxonomy with span-level auditing over BQAA traces. An intent × failure-category matrix is the missing join between “what users wanted” and “where the agent broke”.

What. Watch or join the RFC. Offer the intent dimension as a grouping key for its reports once G1 labels are persisted (EvalBench span-level G1 labels landed in #470).

Evidence: #435 · docs/week0_g1_taxonomy.md · docs/evalbench.md

Size L

Side-by-side behavioral diff per intent

Why. Wish-list item #1 is SxS diffing of two agent runs to find the divergence point. Scoping it per intent keeps the comparisons interpretable.

What. Given two releases or experiments, align sessions by intent cluster and report the divergence step, using the existing deterministic replay/compare utilities (SDK.md §4).

Evidence: #10 · SDK.md §4 Deterministic Replay

Size S

Document the intent-analysis surfaces (API docs)

Why. The intent-relevant APIs (deep_analysis, insights, drift_detection, evaluate_categorical) are spread across SDK.md §9, §10, and §16, and the fixed-label behaviour is not called out. #128 asks for API docs.

What. A single “User-intent analysis” guide with defaults, limits, and cost notes. Low-risk as a first PR, and it builds the familiarity the bigger intents need.

Evidence: #128 · SDK.md

Contributing notes

Sources