CA Explorer β€” how it works

← Back to Explorer

A generalist agent built this

No custom tooling. No specialized data pipeline. Just a general-purpose AI agent with a GCP service account, asked to build an analytics explorer for its own logs.

Architecture

πŸ€–
Molto
Generalist agent
β†’
πŸ”‘
Service Account
GCP IAM
β†’
πŸ—ƒοΈ
BigQuery
4 public views
β†’
πŸ“Š
Data Agent
Gemini Analytics
β†’
πŸ’¬
Chat API
Streaming SSE
β†’
πŸ–₯️
This UI
Flask + Vega-Lite

Two companion agents

The explorer now keeps two analysis paths side by side. Google Conversational Analytics uses the published molto_logs_agent to resolve schema, run BigQuery SQL, and return tables and charts. Codex + OKF runs codex exec --model gpt-5.6-luna and consumes the OKF wiki from the live Google Dataplex Knowledge Catalog EntryGroup molto_logs_okf.

Google CA
Live SQL, result tables, charts, and BigQuery provenance
Codex + OKF
OKF guidance plus validated live SQL on four public views

Codex + OKF can request one live query per turn, but it never receives Google credentials or direct network access. The Flask app parses generated GoogleSQL, accepts only one read-only SELECT whose fully qualified sources are the four privacy-filtered public views, dry-runs it with a bytes cap, and executes it using the dedicated ca-luna-query service account. DDL, DML, wildcards, raw tables, other datasets, and multiple statements are rejected before BigQuery sees them. Results are capped and returned to Codex + OKF as explicitly untrusted data for a final answer. Separately, Flask pulls and translates the Dataplex catalog, caches it for five minutes, and includes it in the prompt. Codex + OKF's sandbox network remains disabled and API-key variables are stripped from child commands.

Open Knowledge Format

Open Knowledge Format (OKF) is a portable wiki convention: one concept per Markdown file, YAML frontmatter for compact structured signals, ordinary links for relationships, and paths as concept identities. An agent needs no special SDK to consume itβ€”it can read the directory like any other source tree.

The OKF wiki published to molto_logs_okf documents the dataset, raw tables, public views, field meanings, join cardinalities, query practices, privacy boundaries, and the known stale-schema history of the CA agent instruction. Codex + OKF consumes the catalog copy; the repo's okf/ directory remains the authoring source used by the separate publish workflow. The wiki uses the v0.1 signal fields resource, type, generated, and sources alongside title, description, and tags. The open specification and examples live in Google's knowledge-catalog repository.

Regenerate and publish the wiki

Schema prose should follow live BigQuery evidence, never a model's remembered schema. The refresh script queries INFORMATION_SCHEMA.COLUMNS, COLUMN_FIELD_PATHS, and TABLES, plus table metadata, without reading row values. Review its JSON before updating the table concept files.

Refresh schema evidenceshell
GOOGLE_APPLICATION_CREDENTIALS=data/sa-key.json \ python3 scripts/introspect_bigquery_schema.py --out schema-evidence.json

Google's toolbox/mdcode is vendored at a pinned upstream commit. Its OKF demo adapter stages the clean Markdown signal layer into a custom okf Dataplex aspect, while the Documents Layout stores titles, descriptions, tags, and bodies. Publishing creates EntryGroup molto_logs_okf in global.

Build kcmd and publishshell
cd vendor/knowledge-catalog-mdcode npm install && npm run build cd demo/molto_logs_okf ../../node_modules/.bin/bun setup.ts ../../node_modules/.bin/bun push.ts

The final push requires roles/dataplex.catalogEditor on project moltonhim-agent for ca-explorer-app@moltonhim-agent.iam.gserviceaccount.com. The app never grants IAM itself. Full commands and round-trip pull instructions are in the vendored demo README.

What's interesting

Molto is an AI agent that runs 24/7 on a GCP VM, handling conversations, tasks, and self-maintenance. It has shell access, file editing, web search, and β€” critically β€” a GCP service account with access to BigQuery, Vertex AI, and other services.

When asked to build an analytics dashboard for its own operational logs, the agent:

Step 1 β€” Data discovery
Discovered the existing agent_turns_full table in BigQuery containing turn-level telemetry: tokens, latency, tool calls, errors, sender/channel metadata.
Step 2 β€” Privacy-safe view
Created agent_turns_public β€” a BQ view that strips all message content (user questions, agent responses, tool I/O) while preserving operational metrics. This makes the data safe to expose without leaking conversation content.
Step 3 β€” Data Agent configuration
Created a Conversational Analytics data agent via the Gemini Data Analytics API. Wrote a system instruction explaining the schema, key senders, channels, and token pricing. Pointed it at the public view.
Step 4 β€” Streaming frontend
Built a chat UI that streams the data agent's responses via SSE β€” showing thoughts, SQL execution, data tables, and Vega-Lite charts progressively as they arrive. Subsequent iterations added dark theme, Vega chart fixes, snapshot saving, and multi-turn conversations.
Step 5 β€” Public deployment
Made the app publicly accessible (no login required). The SA key is scoped to read-only BQ access and the data agent API β€” minimal privilege.

The data agent resource

This is the live configuration that powers the analytics chat. The agent wrote and published this β€” including the system instruction, pricing context, and datasource binding.

Loading agent resource…

Key details

Agent type
Generalist LLM agent
GCP project
moltonhim-agent
Data agent ID
molto_logs_agent
Registered views
agent_turns_public + 3 current-pipeline public views
Chat API
Gemini Data Analytics v1beta
Visualization
Vega-Lite (from API specs)
First deployed
Feb 26, 2026
Made public
Feb 27, 2026

Why this matters

This wasn't built by a purpose-built data tool. The same agent that built this also: manages its own infrastructure, has conversations with family members, writes reflections, debugs production outages, and modifies its own source code.

The data agent — the Gemini Analytics resource that handles the NL→SQL→chart pipeline — was created and configured by a generalist agent that happened to have GCP access. No human wrote the system instruction, created the BQ view, or configured the datasource binding. The agent understood the data, wrote appropriate context, and wired it all together.

The frontend is a Flask app running in a sandboxed Docker container on the same VM. The agent wrote every line of HTML, CSS, and JavaScript through iterative conversation with its creator.