Start here
What this is. A hands-on proof of concept, done in one long session on 2026-11-22/23. It tests whether Google's Knowledge Catalog stack can generate, review, publish and serve context about data to AI agents, so a team wouldn't have to build that layer itself:
- Knowledge Catalog: Dataplex's metadata catalog
- Knowledge Studio: its AI enrichment, in Preview
- kcmd: its "metadata as code" CLI and MCP server
- kcagent: Google's open-source sample agent
- OKF: the Open Knowledge Format
Prefer pictures? The visual explainer shows what each piece is, how they fit together and when to use each, with diagrams; it links back to the matching sections here. This report is the detailed, step-by-step record.
Everything ran on a copy of Google's public GA4 e-commerce sample (bigquery-public-data.ga4_obfuscated_sample_ecommerce), in a throwaway project. No work data and no secrets.
Who it's for. A person who wants the story (read top to bottom), and an AI agent that needs the facts. For the agent, For AI agents has every ID, number and file in one place.
The answer in two minutes
- The raw catalog knows structure, not meaning. Google creates catalog entries for BigQuery tables automatically, with the full nested schema, but every description, key and glossary slot is empty. (Step 1)
- Knowledge Studio works, and you can measure it. We gave it Google's 8 sample docs plus a made-up company policy full of facts that exist nowhere else ("tracer facts"), and a 12-question golden-SQL evaluation set. (Step 3)
- In 29 minutes it proposed 9 context pages.
- Every tracer fact landed, each with a citation.
- Its own evaluation rose from 67% to 100%.
- The SQL it wrote changed: the partition filter went from 49% to 95% of queries, and data scanned dropped about 4×.
- Total cost: about USD 0.41 of BigQuery, with tokens free in Preview.
- Review is real, but it has sharp edges. (Step 3, Step 4)
- The good parts:
- Each page can be approved or removed on its own.
- An author can never approve their own change request (403, even as project Owner).
- The sharp edges:
- Removing a page leaves dangling links in the index pages, and the removal isn't recorded as a rejection.
- An 83% "High" confidence score passed a page that contradicts itself.
kcmd pushskips review entirely and isn't atomic.
- The good parts:
- Studio's output lives only in the context set. The real BigQuery table entry still has 0 of 24 column descriptions after Studio. Studio writes documents (a root page, index pages, a table page and topic pages), not catalog fields. (Step 3)
- Getting context out to any agent works, through OKF files. (Step 3, Step 4, Where OKF fits)
kcmd init --kb ... --format okf --pullwrites the published pages as plain Markdown files. The default layout pulls nothing: a 403 on Google'sdocumenttype.- kcmd's local MCP server serves the same text.
- OKF itself left Google on 2026-11-18 and is now a vendor-neutral spec (v0.3). KC's export is only loosely OKF: no titles, descriptions or trust fields, so every page looks "unverified" to an OKF reader.
- The context helps an agent built outside Google, on questions Studio never saw. A local LangGraph agent answered 15 questions. With no context it got 6/15 and broke the city privacy rule twice. With the published pages as OKF files it got 10/15, and through kcmd's MCP server 12/15 (13 and 14 when defensible readings count). It passed 3/3 held-out policy questions where the no-context agent got 0/3, and it scanned about 3× less data. Files and MCP were equally accurate, but MCP used about 3× the tokens. (Step 5; verdict per capability in Step 6)
- Asking Studio for structure doesn't get you structure. In a second run we told Studio to describe every field with its sensitivity tier and personal-data flag, propose glossary terms and list each rule separately. It wrote much more (all 24 columns instead of 12, a glossary section, numbered rules), but still only as page text: no column description fields, no glossary terms, no rule objects. The pages worked just as well for the agent (12/15 with files and with MCP, 3/3 held-out). (Step 7)
How to read this report
| If you want... | Read |
|---|---|
| The verdict and what to build versus use | Step 6: verdict |
| How Studio behaves, with 30 console screenshots | Step 3: Knowledge Studio |
| Where OKF, MCP and playbooks fit with your own agents | Where OKF fits and Step 4 |
| The agent experiment and its numbers | Step 5 |
| What a custom instruction changes in Studio's output | Step 7 |
| To repeat any step | the "commands" section after each step |
| What the words mean | Concepts in plain words |
| What was created in the cloud, and how to delete it | Cloud resources |
Labels on every fact: verified means we ran it and saw the result; docs means it comes from Google's documentation or a spec; guess means it's our reasoning and not yet checked.
Screenshots are inline. Click one to enlarge it. Personal details (account names, other projects) are blurred or left out.
Knowledge Catalog concepts, in plain words
| Term | Plain meaning | .NET / SQL Server analogy | In our POC |
|---|---|---|---|
| Knowledge Catalog | Google's metadata database: facts about your data, not the data itself | sys.* catalog views plus extended properties, for all of GCP |
the console area "Knowledge Catalog" |
| Project | The GCP container for everything | a solution | kc-okf-poc-261122 |
| Location | Where the metadata lives; matches the data's location | a server region | us |
| Entry group | A folder of entries. @bigquery is a system group that Google fills automatically; you can make your own (a context set is one) |
a schema such as dbo |
@bigquery |
| Entry | One record per data object: a dataset, table, view, file, or a custom thing | one row in sys.objects |
ga4_sample (dataset), events (table) |
| Entry type | What kind of entry it is; decides which aspects are required | the object's class | BigQuery Dataset, BigQuery Table |
| Entry list | The child entries of an entry (a dataset's tables) | expanding a database node in Object Explorer | ga4_sample → events |
| Aspect | A typed block of fields attached to an entry. Schema, storage, overview and contacts are all aspects; you can define your own | an extended property, but with a typed schema (like a C# class instance attached to the object) | BigQuery Table, Storage, BigQuery Policy |
| Aspect type | The definition (schema) of an aspect. Listed under Metadata types | the C# class | dataplex-types.global.overview, etc. |
| Required / optional aspect | Required ones come with the entry type and Google maintains them; optional ones you (or an agent) add | Overview is optional and empty | |
| Description | One short text field on the entry, copied from BigQuery | MS_Description |
dataset: yes (we set it in bq mk); table: none |
| Labels | Key/value tags copied from BigQuery | none | |
| Glossary / term | Business vocabulary ("Session", "Conversion") stored as entries, attached to tables or columns by entry links | a data dictionary | none yet |
| Entry link | A typed link between two entries: synonym, related, definition, reference |
a foreign key between metadata rows | Studio will use reference links |
| Context set (Studio) | An entry group of type context-set that holds Studio's overlay entries for agents |
a separate schema of curated views | created in step 3 |
Terms added during steps 3 to 5
| Term | Plain meaning | .NET / SQL Server analogy | In our POC |
|---|---|---|---|
| Knowledge Studio enrichment task | A saved job: which context set, which tables, which documents ("knowledge signals"), which eval set, run as which service account | a SQL Agent job definition | ga4-events-enrichment (us-central1) |
| Run | One execution of the task; it drafts pages, evaluates them, and stages a change request | one job execution, with its history | d3704062-..., 29 min |
| Knowledge signal | A document source Studio reads (GCS bucket/folder/file, glossary; external: Drive, Confluence, Jira, GitHub, SharePoint) | the spec documents you give a developer | gs://kc-okf-poc-261122-signals |
| Evaluation set | Questions plus golden SQL; Studio tests agents with them before and after its draft | a unit-test suite | 12 questions, JSONL in gs://kc-okf-poc-261122-eval |
| Change request | A batch of proposed metadata changes waiting for approval; approve / remove per page; author can't approve their own | a pull request | 345f4080-... (Studio, approved), 919699e7-... (ours, pending) |
| Document entry | A context-set page: context-set / knowledge-base-root (front page), knowledge-base-index (folder index), table-context, knowledge-base (topic page). Text in the overview aspect |
a wiki page stored as a row | agents, documents/..., assets/.../events |
| Tracer fact | A made-up fact planted in one source so we can see whether, and where, it shows up | a canary value in test data | "MSC-417", "Digital Insights Guild", the 72-hour rule |
| OKF | Open Knowledge Format: Markdown files with YAML frontmatter in folders, index.md per folder; v0.3, vendor-neutral since 2026-11-18 |
a .bacpac: portable export you can read without the server |
results/04-okf/pull-after-push/bundle/ |
| kcmd | Google's "metadata as code" CLI: init, pull, push, mcp |
git plus sqlpackage for metadata |
0.2.5 |
| MCP | Model Context Protocol: a standard way for an agent to call tools in another process | a Web API the agent calls | kcmd mcp serves list-entries, lookup-entry, modify-entry |
| Playbook | Process knowledge: "for this kind of question, do these steps, run this SQL" | a runbook / stored procedure with comments | documents/playbook-final-daily-net-revenue |
| Service agent vs service account | The service agent is a Google-owned login per project that impersonates our service account (the "Run as" identity) | IIS app-pool identity switching to a domain account | service-…@gcp-sa-dataplex… → kc-studio-enricher@… |
Step 0: setup, results
Decisions
| Item | Choice | Why |
|---|---|---|
| GCP project | new project kc-okf-poc-261122 |
Deleting the project removes everything, including the project-wide okf aspect type |
| Billing account | the user's existing billing account (the only open one) | |
| Budget alert | 20 USD, alerts at 50 / 90 / 100 % | |
| Dataset | bigquery-public-data.ga4_obfuscated_sample_ecommerce |
Google's OKF repo already has a sample bundle for it; its nested schema tests capability 7 |
| Catalog location | us (where the public datasets live) |
|
| Vertex AI and task execution region | us-central1 |
|
| Knowledge signals | Cloud Storage files only | |
| Policy document | a short made-up sensitivity/PII policy | No private policy is used |
| Working copy of data | copy 3 daily events_YYYYMMDD tables into our own dataset ga4_sample (location us) |
So kcmd push and Studio work on tables we own, and results are visible in the console. Removes the "can Studio target public data?" risk. |
Local tools (verified, 2026-11-22)
| Tool | Version |
|---|---|
| gcloud | 588.0.0 |
| Python | 3.12.3 |
| uv | 0.12.18 |
| git | 2.43.0 |
| gh | 2.45.0 |
| Node | 22.23.5 (via nvm 0.40.3), npm 10.9.9 |
| bun | 1.2.21 (needed unzip 6.0 from apt) |
| kcmd | @google-cloud/kcmd 0.2.5 (build 4b42d81), pinned in package.json and package-lock.json. Last published 2026-11-11, so a machine that blocks very new packages may refuse it for a while. npm audit: 3 moderate advisories in its dependencies glob and minimatch (file-pattern libraries); acceptable for a local POC. |
What the docs say Studio enrichment needs (docs, read 2026-11-22)
Sources: configure-enrichment-prerequisites, create-enrichment-tasks, context-sets, about-enrichment-tasks. All are Preview pages.
APIs (P): dataplex, bigquery, storage, iamcredentials. Vertex AI (aiplatform) is not on Studio's list; we need it only for kcagent and our own agent.
Three identities (like three Windows accounts on one service):
| Who | Roles (docs) |
|---|---|
| Me (creates and runs the task) | roles/dataplex.dataScanEditor or roles/dataplex.editor; roles/iam.serviceAccountUser on the execution service account |
| Execution service account (a robot account I create; the agent runs as it) | roles/serviceusage.serviceUsageConsumer, roles/bigquery.dataViewer, roles/dataplex.contentEditor, roles/dataplex.catalogEditor, roles/dataplex.catalogViewer; recommended roles/bigquery.resourceViewer; roles/bigquery.jobUser (the pages disagree on whether it is required); roles/storage.objectViewer on the input bucket |
Dataplex service agent (service-PROJECT_NUMBER@gcp-sa-dataplex.iam.gserviceaccount.com, Google-owned) |
roles/iam.serviceAccountTokenCreator on the execution service account (so it can act as it); roles/bigquery.dataViewer on the target data |
| Approver | roles/dataplex.contentEditor on the context set, roles/dataplex.catalogViewer, and roles/dataplex.workflowApprover ("Required to approve and publish change requests") |
Locations (C, X): a context set can be regional, multi-regional (us, eu) or global. A multi-region us context set picks an execution region such as us-central1. Target tables must be compatible with the context set's location. So: context set in us, task runs in us-central1.
Inputs (P, C): Cloud Storage files in Markdown, plain text, PDF, HTML or CSV, plus SQL and dbt files. The evaluation set is JSONL, one line per question: evaluation_request.prompt.text and evaluation_request.golden_response.text (the SQL). A Gemini autorater checks whether the SQL means the same.
Limits (A, C): one enrichment task per context set; at most 500 tables per task; a run takes 20 to 60 minutes; logs can lag 20 to 30 minutes; free during Preview apart from BigQuery and storage use.
Open risks (guess)
- Public dataset as a target. None of the four pages say whether a task can target
bigquery-public-data. The service agent may needbigquery.dataVieweron the dataset, which we cannot grant on Google's project (public data is readable by any authenticated user, which may be enough). Fallback: copy the tables into a dataset in our ownusproject (size not checked yet; we will check it with a free metadata query before copying). - Author and publisher separation. No page says whether the approver must differ from the author. To test in step 3 with a second identity.
roles/bigquery.jobUser. One page lists it as required and another as optional. We grant it to avoid a failed run.
Cloud setup (verified, 2026-11-22)
| Step | Result |
|---|---|
| Project | kc-okf-poc-261122 created, ACTIVE, no organization |
| Billing | linked to the user's existing billing account, billingEnabled: true |
| Budget | kc-okf-poc, 20, alerts at 50/90/100 % (created in the console) |
| APIs enabled by us | dataplex, bigquery, storage, iamcredentials, aiplatform |
| APIs Google turned on with them | analyticshub, bigqueryconnection, bigquerydatapolicy, bigquerydatatransfer, bigquerymigration, bigqueryreservation, bigquerystorage, dataform, datastore, logging, monitoring, cloudtrace, telemetry, storage-api, storage-component and others: dependencies or project defaults, free to have on |
| Compute API | compute.googleapis.com was enabled by a gcloud prompt when setting compute/region (gcloud checks the region against the Compute API). Free to have on; nothing runs. |
| gcloud profile | configuration kc-okf: account set, project = kc-okf-poc-261122, compute/region = us-central1. Default profile unchanged. Pick it with export CLOUDSDK_ACTIVE_CONFIG_NAME=kc-okf. |
| Library credentials (ADC) | refreshed for the same account; quota project kc-okf-poc-261122; token check OK. Shared by all profiles: restore with gcloud auth application-default set-quota-project YOUR_PREVIOUS_QUOTA_PROJECT when done. |
Step 0 status
Done. The execution service account and IAM roles for Studio are created in step 3, where they are used.
Commands to repeat this step (poc/00-setup/README.md)
Step 0: setup commands
Run these one at a time. Results are recorded in results/00-setup.md.
Local tools
# nvm (Node version manager), pinned release
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash
# open a new shell, then:
nvm install 22
node --version
# bun, pinned release
curl -fsSL https://bun.sh/install | bash -s "bun-v1.2.21"
Cloud (filled in as we go)
gcloud projects create kc-okf-poc-261122 --name="KC OKF POC"
gcloud billing projects link kc-okf-poc-261122 --billing-account=<BILLING_ACCOUNT_ID>
# Budget: created in the console (Billing > Budgets & alerts), 20, thresholds 50/90/100 %
gcloud services enable dataplex.googleapis.com bigquery.googleapis.com storage.googleapis.com iamcredentials.googleapis.com aiplatform.googleapis.com --project=kc-okf-poc-261122
gcloud config configurations create kc-okf --no-activate
export CLOUDSDK_ACTIVE_CONFIG_NAME=kc-okf && gcloud config set account <YOUR_ACCOUNT> && gcloud config set project kc-okf-poc-261122 && gcloud config set compute/region us-central1
gcloud auth application-default login
gcloud auth application-default set-quota-project kc-okf-poc-261122
Step 1: inspect the catalog, results
1a. Size of the public dataset (verified, 2026-11-22)
Free metadata query on bigquery-public-data.ga4_obfuscated_sample_ecommerce.__TABLES__:
| tables | first_table | last_table | total_rows | total_gb | avg_mb_per_table |
|---|---|---|---|---|---|
| 92 | events_20201101 | events_20210131 | 4,295,584 | 3.34 | 37.1 |
So copying 3 daily tables is about 110 MB: storage well under 1 cent per month.
Why this dataset (verified, 2026-11-22, GitHub code search)
The dataset is Google's public GA4 sample (web analytics export of the Google Merchandise Store), made for GA4 and BigQuery learners, not for Knowledge Catalog. But Google's Knowledge Catalog repos use it as their standard demo dataset:
| Where | File |
|---|---|
kcmd demo setup |
knowledge-catalog/toolbox/mdcode/demo/bq/setup.ts |
kcagent README |
knowledge-catalog/toolbox/enrichment/README.md |
| Enrichment sample docs | knowledge-catalog/samples/enrichment/sample/docs/ (overview.md, events.md) |
| OKF sample bundle | open-knowledge-format/bundles/ga4/ and samples/ga4_merch_store/ |
Both the kcmd demo and the kcagent README copy it the same way: one table events, partitioned by date, built from all 92 daily tables:
CREATE TABLE IF NOT EXISTS `<dataset>.events`
PARTITION BY event_date_dt
AS SELECT *, PARSE_DATE('%Y%m%d', event_date) AS event_date_dt
FROM `bigquery-public-data.ga4_obfuscated_sample_ecommerce.events_*`;
1b–1c. Our copy (verified, 2026-11-22)
Dataset kc-okf-poc-261122.ga4_sample (US), table events built with the query above.
| Check | Value |
|---|---|
| Rows | 4,295,584 (same as the public dataset) |
| Size | 3.62 GB (3,618,022,526 bytes; the extra date column adds a little) |
| Partitioning | DAY on event_date_dt, 92 distinct days |
| Schema | 24 top-level columns, 109 fields including nested ones, nested up to 3 levels (for example items is a repeated record) |
| Column descriptions in BigQuery | 0 of 24 |
1d. Console layout (verified from screenshots, 2026-11-22)
Two areas under Knowledge Catalog in the console:
- Knowledge Catalog (classic), URL
/dataplex/dp-search. Left menu: Studio (Preview); Discover: Search, Shared with me; Manage metadata: Glossaries, Metadata types, Data domains (Preview), Connectors, Cloud Storage discovery; Govern: Data profiling & quality, Data products (New), Governance Workflows; Manage lakes. Search runs in natural-language mode by default, with a link back to keyword search, and quick filters for Datasets, Tables, Data Products, Views and Notebooks. - Knowledge Studio (Preview), URL
/dataplex/studio. Left menu: New chat, Context sets, Enrichments. The welcome card reads: "Explore your catalog in natural language, group the assets that matter into context sets, and enrich them with descriptions your team reviews before they publish." Suggested prompts: "What data do I have in Knowledge Catalog?", "Find context sets that I have access to", "Help me define context scope for my new agent", "What are my top used resources?". A "Classic Knowledge Catalog" link goes back.
Two new things not in the brief: Data products and Governance Workflows in the classic menu. To check whether Governance Workflows relate to approval / separate publisher (capability 3).
1e. What the catalog holds before any enrichment (verified from screenshots, 2026-11-22)
Path shown in the console: kc-okf-poc-261122 > us > @bigquery > ga4_sample > events. Concepts: docs/concepts.md.
Dataset entry ga4_sample |
Table entry events |
|
|---|---|---|
| Entry type | BigQuery Dataset | BigQuery Table |
| Tabs | Details, Entry list, Lineage, Insights | Details, Entry list, Schema, Lineage, Data Profile, Data Quality, Insights, Relationships (Preview) |
| Created / modified | Nov 22 2026 9:44:09 AM (same time) | Nov 22 2026 9:48:29 AM (same time) |
| Description | "GA4 public sample copied as one partitioned table, for the KC/OKF POC" (copied from bq mk --description) |
none |
| Labels, contacts, domain | none | none |
| Overview | "Entry has no overview" | "Entry has no overview" |
| Required aspects | BigQuery Dataset | BigQuery Table, Storage |
| Optional aspects | none | BigQuery Policy |
| Glossary terms | none | none |
| Entry list | one child: events (bigquery-table, no description) |
— |
| Extra buttons | Open in BigQuery | Open in BigQuery, Explore With Data Studio |
Finding: Google created both entries automatically, within minutes, with only technical metadata. The one piece of meaning present (the dataset description) is there because we typed it into BigQuery. Business context (overview, column descriptions, terms) is empty, as expected.
New tab to look at later: Relationships (Preview) on the table entry, possibly where Studio's join proposals appear.
1f. Schema tab of events (verified from screenshot)
24 top-level rows. Columns of the grid: Name, Primary key, Foreign key, Unique constraints, Data type, Metadata type, Mode, Default value, Semantic, Description. For every row, Primary key, Foreign key, Unique constraints, Default value, Semantic and Description are all empty (-). Nested records (event_params, user_properties, items are REPEATED; device, geo, traffic_source, ecommerce, privacy_info, user_ltv, app_info, event_dimensions are single records) expand with a ▸ arrow. Buttons above the grid: Add aspect, Add business term (per column).
So the catalog already has slots for keys, a Semantic type and per-column descriptions; nothing fills them yet.
1g. Can we see Google's public tables in the catalog? (verified, CLI)
| Try | Result |
|---|---|
Console Knowledge Catalog > Search for ga4_obfuscated_sample_ecommerce, no filters |
No rows to display (matches the CLI result below) |
| Console top bar search | Searches Google Cloud products and this project's resources only ("Showing resource results for KC OKF POC only"). Not the catalog search. |
gcloud dataplex entries search "events" |
1 result: our ga4_sample.events |
gcloud dataplex entries search "ga4_obfuscated_sample_ecommerce", with and without --scope=projects/bigquery-public-data |
0 results |
gcloud dataplex entries lookup by exact name, for bigquery-public-data...events_20210131 |
Works: full entry returned |
So public tables have catalog entries, readable by exact name, but search does not find them from our project. Saved both entries for comparison:
- 01-inspect/public-events_20210131.entry.yaml: aspects
bigquery-policy,bigquery-table,schema,storage,usage(empty). Catalog entry created 2024-05-25; table created 2021-08-10. - 01-inspect/ours-events.entry.yaml: same aspects except
usage. - Neither has a single
description:in its schema. Google's own public table carries no column descriptions in the catalog either.
1h. kcmd snapshot, "before" (verified, 2026-11-22)
Command (from results/01-inspect/kcmd-before/):
CLOUDSDK_ACTIVE_CONFIG_NAME=kc-okf npx kcmd init --bigquery-dataset kc-okf-poc-261122.ga4_sample --pull
Files written (kcmd-before/):
| File | Lines | Holds |
|---|---|---|
| catalog.yaml | 4 | scope bq-dataset.kc-okf-poc-261122.ga4_sample; snapshot.aspects: [dataplex-types.global.overview] |
| catalog/kc-okf-poc-261122.ga4_sample.yaml | 14 | dataset entry: resource info, the description we typed, aspect bigquery-dataset |
| catalog/kc-okf-poc-261122.ga4_sample/events.yaml | 476 | table entry: aspects bigquery-table (partitioning by DAY on event_date_dt), schema (every field with only name, dataType, metadataType, mode), storage |
- 0 descriptions in
events.yaml. No overview aspect (it is tracked bycatalog.yaml, but empty, so nothing is written). kcmddid not write thebigquery-policyaspect that the console andgcloud lookupshow. It pulls the built-in structural aspects plus the ones listed incatalog.yaml.- Folder layout mirrors the hierarchy:
catalog/<dataset>.yamlfor the dataset entry,catalog/<dataset>/<table>.yamlfor its children. kcmdprintsYour active configuration is: [kc-okf]four times: it callsgcloudunderneath to get the project and credentials.
Step 1 summary
The raw catalog holds structure only: entry types, partitioning, the nested schema tree (109 fields) and storage facts, created automatically within minutes. Every slot for meaning (overview, table and column descriptions, keys, semantic type, glossary terms, labels, contacts) is empty, both on our copy and on Google's own public table. This is the baseline for steps 2 and 3.
Commands to repeat this step (poc/01-inspect/README.md)
Step 1: inspect the catalog, commands
# 1a. table sizes (metadata only, 0 bytes billed)
bq query --project_id=kc-okf-poc-261122 --use_legacy_sql=false --format=pretty 'SELECT COUNT(*) AS tables, MIN(table_id) AS first_table, MAX(table_id) AS last_table, SUM(row_count) AS total_rows, ROUND(SUM(size_bytes)/POW(1024,3),2) AS total_gb, ROUND(AVG(size_bytes)/POW(1024,2),1) AS avg_mb_per_table FROM `bigquery-public-data.ga4_obfuscated_sample_ecommerce.__TABLES__`'
# 1b. our dataset
bq mk --location=US --dataset --description="GA4 public sample copied as one partitioned table, for the KC/OKF POC" kc-okf-poc-261122:ga4_sample
# 1c. one partitioned table, as in Google's kcmd demo (reads ~3.3 GB, about $0.02)
bq query --project_id=kc-okf-poc-261122 --use_legacy_sql=false 'CREATE TABLE IF NOT EXISTS `kc-okf-poc-261122.ga4_sample.events` PARTITION BY event_date_dt AS SELECT *, PARSE_DATE("%Y%m%d", event_date) AS event_date_dt FROM `bigquery-public-data.ga4_obfuscated_sample_ecommerce.events_*`'
export CLOUDSDK_ACTIVE_CONFIG_NAME=kc-okf
# catalog search (finds our table, not the public ones)
gcloud dataplex entries search "events" --project=kc-okf-poc-261122 --format=json
gcloud dataplex entries search "ga4_obfuscated_sample_ecommerce" --project=kc-okf-poc-261122 --scope=projects/bigquery-public-data
# exact lookup works for public tables
gcloud dataplex entries lookup "bigquery.googleapis.com/projects/bigquery-public-data/datasets/ga4_obfuscated_sample_ecommerce/tables/events_20210131" --entry-group=@bigquery --location=us --project=bigquery-public-data --billing-project=kc-okf-poc-261122 --view=FULL --format=yaml
gcloud dataplex entries lookup "bigquery.googleapis.com/projects/kc-okf-poc-261122/datasets/ga4_sample/tables/events" --entry-group=@bigquery --location=us --project=kc-okf-poc-261122 --view=FULL --format=yaml
# 1h. kcmd snapshot (read-only)
mkdir -p results/01-inspect/kcmd-before && cd results/01-inspect/kcmd-before
CLOUDSDK_ACTIVE_CONFIG_NAME=kc-okf npx kcmd init --bigquery-dataset kc-okf-poc-261122.ga4_sample --pull
Step 2: kcagent (Google's sample enrichment agent), results
2a–2b. Getting it to build (verified, 2026-11-22)
| Item | Value |
|---|---|
| Source | GoogleCloudPlatform/knowledge-catalog at commit 6886cc67 (2026-11-21), folder toolbox/enrichment, kcagent 0.1.0 |
| Change we made | package.json: @google-cloud/kcmd from file:../mdcode (unbuilt sibling folder) to the published 0.2.5 |
| Declared dependencies | runtime 4 (@google/adk, @modelcontextprotocol/sdk, @google-cloud/kcmd, cac); dev 6 (@google/adk-devtools, @modelcontextprotocol/inspector, @types/node, bun 1.3.14, bun-types, typescript) |
npm install |
769 packages, 891 MB, 16 minutes on a home connection |
| Largest parts | bun binaries (@oven) 346 MB, googleapis 112 MB, @opentelemetry 62 MB, debug-UI packages (@azure, lucide-react, …) ~100 MB, typescript 24 MB |
npm audit (all) |
61: 3 low, 27 moderate, 27 high, 4 critical (concurrently, proxy-addr, shell-quote, tar) |
npm audit --omit=dev (runtime only) |
54: 3 low, 27 moderate, 22 high, 2 critical: proxy-addr (IP spoofing in a web-server helper) and tar (path traversal when unpacking archives) |
Reading: most of the download is build tooling and debug UIs, not the agent. Run on a laptop as a CLI, neither critical advisory is reachable in our use (we run no web server and unpack no untrusted archives). We did not run npm audit fix, to keep Google's lock file as shipped. For a team, this is a demo dependency tree, not something to deploy as is.
Build gotcha (verified)
Changing package.json alone was not enough: Google's package-lock.json still said resolved: ../mdcode, link: true, and ../mdcode/package.json is also version 0.2.5, so npm install kept a symlink to the unbuilt source folder. TypeScript compiled (it reads source types), then bun build failed with Could not resolve: "@google-cloud/kcmd". Fix: move the symlink aside and run npm install --save-exact @google-cloud/kcmd@0.2.5, which downloads the published package and rewrites the lock entry.
Build output (verified)
| File | Size | Built by |
|---|---|---|
dist/kcagent |
121 MB | bun build --compile (bun 1.3.14), standalone, no node_modules needed at run time |
dist/md-fileset |
92 MB | same; a small MCP server with tools list_fileset_contents, read_fileset_file, search_fileset_content |
- Even
kcagent --helpfails at start if gcloud has nocompute/region: it runsgcloud config get-value project,... compute/regionandgcloud auth application-default print-access-tokenbefore parsing arguments. - Model is hard-coded:
gemini-2.5-flashon Vertex AI, project and location taken from those gcloud values (sous-central1in ourkc-okfprofile), with thinking enabled (agent.ts).
2c. Run inputs (committed before running, so git diff shows exactly what the agent changed)
run1/ and run2/ are identical:
catalog.yaml+catalog/: copy of the step 1 "before" snapshotfileset/: Google's 8 sample docs, unchanged (source). They name the tablekc_enrich_sample_data.ga_events, not ourga4_sample.events.prompt.md,tools/mcp.json,tools/skills/fileset-source/SKILL.md: copied from Google's README demo; only themd-filesetpath changed to point at our build
2d. First run attempts: silent failure, then model not available (verified)
- Run 1, attempt 1: finished in 9 s, printed
Processing:for both entries, no output and no file changes. Cause: Google's loop incommand.tsprints thought, content, tool-call and tool-result events but ignores ADKERRORevents, so failures are silent. POC patch 1: 4 lines that printERRORevents.
- Attempt 2 then showed, for both entries:
Publisher model projects/kc-okf-poc-261122/locations/us-central1/publishers/google/models/gemini-2.5-flash was not found or your project does not have access to it. - Direct test calls (one-word prompt each) on Vertex
generateContent:
| Model | global |
us-central1 |
|---|---|---|
gemini-2.5-flash (kcagent's hard-coded model) |
404 not found / no access | 404 not found / no access |
gemini-3.5-flash |
200 OK | 404 not found / no access |
The model catalog lists gemini-2.5-flash as GA, yet this new project cannot call it in either location. So the demo, as shipped, does not run in a project created today. POC patch 2: agent.ts reads KCAGENT_MODEL and KCAGENT_LOCATION from the environment (defaults unchanged). Runs below use gemini-3.5-flash on global.
Both patches live only in the vendor/ checkout; the full diff is in 02-kcagent/vendor-patch.diff.
(Side note for anyone repeating this in zsh: $m:generateContent in a URL is read as a zsh history modifier; write ${m}:generateContent.)
2e. Rate limit on a new project (verified)
Attempt 3 (gemini-3.5-flash, global): the dataset entry was enriched (175 lines of overview added, all 8 sources searched and cited, 4 SQL examples). On the table entry, after the first tool call: [Error] Resource exhausted. Please try again later. (HTTP 429, Vertex quota). kcagent has no retry; the run ended with only one of two entries done. The partial result is kept as attempts/run1-attempt3-partial-429.diff, and run1/ was reset to the clean input so each real run is complete and comparable.
2f. Run 1, complete (verified, 2026-11-22)
Command: see poc/02-kcagent, with KCAGENT_MODEL=gemini-3.5-flash KCAGENT_LOCATION=global. Both entries got an overview; nothing else in the YAML changed.
| Entry | Overview | Words |
|---|---|---|
ga4_sample (dataset) |
89 lines | 554 |
events (table) |
98 lines | 683 |
First checks on the events overview:
- Follows the system prompt's template: summary paragraphs, Data Details, Usage Details, Citations.
- Cites 7 of 8 docs and ignores
lipsum.md(the noise file). - Mapped the docs' table name to ours: every SQL
FROMuseskc-okf-poc-261122.ga4_sample.events; the docs' namekc_enrich_sample_data.ga_eventsdoes not appear. - Advice to filter on the partition column
event_date_dtis grounded: partitioning comes from the schema aspect, date filtering fromexample2.mdandoverview.md.
2g. Run 2 and comparison (verified, 2026-11-22)
Same inputs, same model (gemini-3.5-flash, global), separate folder. Both entries enriched, no errors.
| Run 1 | Run 2 | |
|---|---|---|
| Dataset overview | 89 lines, 554 words | 91 lines, 637 words |
| Table overview | 98 lines, 683 words | 90 lines, 575 words |
| Template sections | same 4 (summary, Data Details, Usage Details, Citations) | same 4 |
| Sub-headings | dataset: 4 numbered query headings; table: 4 numbered query headings | dataset: 4, differently worded; table: none (one "SQL Query Examples" block) |
| Citations | the same 7 docs | the same 7 docs |
lipsum.md used |
no | no |
| SQL examples | 4 per entry | 4 per entry |
Text similarity between runs: about 40 % of words in the same order (0.39 dataset, 0.41 table) and 0 identical sentences (dataset 0 of 23 vs 22; table 0 of 29 vs 22). The structure and sources are stable; the wording is entirely new each time. Smaller spread than the earlier work-machine runs with gemini-2.5-flash (120 vs 65 lines), but different model and inputs, so not directly comparable.
Are the SQL examples correct? (BigQuery dry run, free, sql-check/)
| Overview | Queries | Valid | Bytes each would scan |
|---|---|---|---|
events table, run 1 |
4 | 4 | 126 MB, 60 MB, 864 MB, 161 MB |
events table, run 2 |
4 | 4 | same four numbers |
ga4_sample dataset, run 1 |
4 | 0 | — |
ga4_sample dataset, run 2 |
4 | 0 | — |
- All 8 queries in the dataset overviews are invalid, in both runs: they query
FROM `kc-okf-poc-261122.ga4_sample`, which is the dataset, not a table (Not found: Dataset kc-okf-poc-261122:kc-okf-poc-261122). The agent copied the asset name it was given into a table position. Nothing in kcagent checks generated SQL. - The table overviews' SQL is valid, and both runs produced the same four queries (same bytes scanned), adapted from
example1–4.md. - Both table overviews advise "always filter on
event_date_dt", yet only query 2 does; query 3 scans 864 MB (the whole table). The advice and the examples disagree.
Step 2 summary
kcagent writes one thing, a markdown overview per entry, grounded in the docs it was given and with citations at file level (not per statement). Structure and sources repeat between runs; wording does not. Its SQL examples are only as good as its asset name handling: valid for the table, invalid for the dataset in every case. To run at all in a new project it needed three fixes (published kcmd, error printing, a model that the project can call) and a retry after a 429.
2h. Push run 1 to the catalog
- Run 2 took 2 min 23 s wall-clock (21.9 s CPU); almost all of it is waiting on the model.
kcmd push --dry-runprinted onlyValidating catalog entries.../Validation complete; no changes applied.It does not list what would change, so the dry run is a validity check, not a preview. The localgit diffis the real preview.- From
kcmd's code (cli.js,applyChunk/applyViaEntries): a push sends onebatchChangeMetadatarequest (falling back to per-entrymodifyEntry) with an update mask and aspect keys, so only the listed aspects (hereoverview) are written. After a push it also sets a push-state label on the entry.
Push result (verified, 2026-11-22 18:01 UTC): kcmd push succeeded. The events entry page now shows run 1's text under Overview (rendered markdown, with an Edit button). Read back with gcloud dataplex entries lookup --view=ALL:
- overview aspect created at
18:01:39, 5,418 characters - the entry's own
updateTimemoved to18:01:39, but the console's "Last modification time" still shows 9:48:29 AM: that field is the BigQuery source's time (entrySource.updateTime), not the catalog edit time - no labels were added (the push-state label in the code applies to OKF-style pushes, not to BigQuery entries)
- the console gives no hint of who or what wrote the overview, nor of the citations' trust level: it looks the same as a human-written one
How kcagent works (and what an MCP call is)
Source read: GoogleCloudPlatform/knowledge-catalog at commit 6886cc67, folder toolbox/enrichment/src (725 lines of TypeScript in total).
Tool call versus MCP call, in one line each
- Tool call: the model replies "please call function X with these arguments" instead of text; the program runs X and sends the result back. The model never runs anything itself.
- MCP call: the same thing, except X lives in another program (an MCP server). The agent forwards the call over a standard protocol (JSON-RPC messages, here over the child process's stdin/stdout) and relays the answer. Like calling a WCF/gRPC service instead of a local method: the model sees no difference.
The files
| File | Lines | What it does |
|---|---|---|
| agent/main.ts | 37 | CLI entry point (kcagent enrich ...) |
| agent/enrich/command.ts | 140 | The loop: load tools, read the snapshot, for each entry build a prompt, run the agent, print events. Defines the local tool update_documentation |
| agent/enrich/agent.ts | 108 | The system prompt ("experienced data steward…", template, workflow) and the model: gemini-2.5-flash, Vertex AI, thinking on |
| agent/tools.ts | 92 | Reads tools/mcp.json and starts each MCP server (MCPToolset, stdio or HTTP); loads tools/skills/*/SKILL.md |
| tools/md/server.ts | 66 | The MCP server: registers 3 tools with the MCP SDK and serves them over stdio |
| tools/md/fileset.ts | 125 | What the 3 tools actually do: list a folder, read a file, regex-search .md files |
The tools the model can call
| Tool | Kind | Defined in | Effect |
|---|---|---|---|
update_documentation(documentation) |
local function | command.ts | Writes the markdown into the entry's dataplex-types.global.overview aspect, in the local YAML. The only write the agent can make. |
list_fileset_contents(path) |
MCP | server.ts | Lists files in fileset/ |
search_fileset_contents(query, path) |
MCP | server.ts | Regex search across the .md files, returns file, line and snippet |
read_fileset_file(path) |
MCP | server.ts | Returns the whole file |
skill tools (load fileset-source instructions) |
ADK skills | tools.ts | Gives the model the SKILL.md text on demand |
Things worth knowing (verified by reading the code)
- One agent run per entry. The dataset
ga4_sampleand the tableeventseach get their own conversation. - The prompt contains the schema as JSON plus any existing overview, then your
prompt.md. - Name mismatch:
SKILL.md(from Google's README) tells the model aboutsearch_fileset_content, but the server registerssearch_fileset_contents(with an s). The model sees the real tool list, so it usually copes. - Skills run with
UnsafeLocalCodeExecutor(tools.ts). If a skill contained code, ADK could run it on your machine without a sandbox. Our skill is text only, but a team should not point this at untrusted skill folders. - No connection to the catalog during the run. It reads and writes local YAML;
kcmd pushis a separate step.
Commands to repeat this step (poc/02-kcagent/README.md)
Step 2: kcagent (Google's sample enrichment agent), commands
Source: GoogleCloudPlatform/knowledge-catalog, toolbox/enrichment, pinned at commit 6886cc6 (2026-11-21).
The checkout lives in vendor/ (git-ignored); only our inputs and outputs are committed.
# 2a. clone at a pinned commit
git clone https://github.com/GoogleCloudPlatform/knowledge-catalog ~/apps/kc-okf/vendor/knowledge-catalog
cd ~/apps/kc-okf/vendor/knowledge-catalog && git checkout 6886cc6
# 2b. use the published kcmd instead of the unbuilt ../mdcode, then build
cd ~/apps/kc-okf/vendor/knowledge-catalog/toolbox/enrichment
npm pkg set "dependencies.@google-cloud/kcmd=0.2.5" && npm install
mv node_modules/@google-cloud/kcmd ~/apps/kc-okf/trash/kcmd-symlink # npm kept a link to ../mdcode
npm install --save-exact @google-cloud/kcmd@0.2.5
npm run build # -> dist/kcagent, dist/md-fileset
# 2d. run (from each run folder; uses the kc-okf gcloud profile for project + Vertex region)
cd ~/apps/kc-okf/results/02-kcagent/run1
CLOUDSDK_ACTIVE_CONFIG_NAME=kc-okf ../../../vendor/knowledge-catalog/toolbox/enrichment/dist/kcagent enrich --catalog-path . --tools-path tools --prompt-path prompt.md
Step 3: Knowledge Studio (context set, enrichment task, review)
Status: in progress (2026-11-22).
Setup done
| Item | Value |
|---|---|
| Execution service account | kc-studio-enricher@kc-okf-poc-261122.iam.gserviceaccount.com with the 7 project roles from Google's docs |
| Dataplex service agent | service-109873812728@gcp-sa-dataplex.iam.gserviceaccount.com: serviceAccountTokenCreator on the execution account, bigquery.dataViewer on the project |
| Signals bucket | gs://kc-okf-poc-261122-signals (US): Google's 8 sample docs under google-sample/ and our made-up policy doc |
| Eval set | poc/03-studio/eval-set.jsonl in its own bucket gs://kc-okf-poc-261122-eval: 12 questions with golden SQL; 5 need only the schema, 7 need the made-up policy doc to get right (see below) |
| Context set | ga4-merch-context, location us (multi-region), created in the console |
Tracer facts
The made-up policy doc contains facts found nowhere else: dataset code MSC-417, business name "Merch Store Clickstream", team "Digital Insights Guild", tiers "C2"/"C3", the 72-hour rule, the "Net merch revenue" formula. If they show up in Studio's output, Studio read our doc. verified that they are absent from Google's docs and from step 2's kcagent output (they were written after it).
Findings so far
- Console location list: the context-set form defaults to
us-central1; multi-regions (us,eu,global, ...) are at the top of the list under "Multi-region". Location cannot be changed later. verified - Project Owner cannot read a context set. Right after creating it, the details page showed
Permission 'dataplex.entries.listContext' deniedfor the Owner. verified The context permissions are only in the Dataplex content roles, not in Owner/Editor or the Catalog roles (read withgcloud iam roles describe, verified):
| Role | Context permissions |
|---|---|
dataplex.editor, dataplex.admin |
entryGroups.createContextSet only |
dataplex.contentViewer |
getContextSet |
dataplex.contentUser |
get/list context, requestContextChanges |
dataplex.contentEditor |
create/update/delete/get/list context, requestContextChanges, updateContextSet |
dataplex.contentAdmin |
contentEditor plus deleteContextSet |
dataplex.workflowApprover (Beta) |
changeRequests.get/list/use (approving changes) |
dataplex.catalogEditor, catalogAdmin |
useContextAspect/Entry/EntryLink only |
So a team needs to hand out these roles on purpose: creating a context set and reading it are separate permissions.
- After granting
roles/dataplex.contentEditorto my user, the context set page loads without the error, Edit becomes clickable, and Delete stays greyed out (matches the table: onlycontentAdminhasdeleteContextSet). verified - The context set page has fields Enrichment task and Ontology included in enrichment (both empty), and an Entries list with columns Name, Description, Entry type, Linked assets, Last modified. So a context set holds its own entries that link to assets such as tables. verified (what the screen shows) / guess (what "Linked assets" will contain).
- The enrichment task is a 4-page wizard: 1 Define (display name, task ID that cannot be changed later, custom instructions "in one or two sentences"), 2 Scope ("what gets enriched, and what the agent reads"), 3 Improve ("evaluation and self-learning"), 4 Run ("trigger and notifications"). verified
- Scope page (verified, from the console):
- Context set (required): "the context set this task enriches and saves its results to". Can create one inline.
- Enrichment task region (required): "required for context sets in a multi-region"; defaults to
us-central1. - Resources to enrich: "Default resources: everything in the context set is enriched by default", plus optional Add more resources (BigQuery datasets/tables, or Lakehouse catalogs/namespaces/tables).
- With an empty context set and no resources the page warns: "Running this task will create a knowledge base and will not enrich any entries."
- Knowledge signals: "extra sources the agent reads for context. These are not enriched": Cloud Storage buckets, folders (path ending in
/) or files; Glossaries.
- Task ID used:
ga4-events-enrichment. - Scope as filled: resource
kc-okf-poc-261122.ga4_sample.events(table only); signal bucketkc-okf-poc-261122-signals(whole bucket); no glossaries. Console note: "Adding new resources to this task will add them to the context set." A collapsed External sources section sits below Glossaries. verified - Improve page (verified, from the console):
- Evaluation set: "a .jsonl file in Cloud Storage. Measures the impact of proposed context changes."
- Curation set: "a .jsonl file in Cloud Storage. Set of questions to hillclimb on." So Studio separates a training-style set (curation) from a held-out test set (evaluation).
- Publishing: "Enable auto-publish: automatically publish changes that meet the quality threshold" (off by default). Human review is the default.
- Self-learning: "finds gaps in real agent conversations and keeps your context current" (toggle, off by default).
- Choice for run 1: evaluation set only, no curation set, auto-publish off, self-learning off. Reason: a clean baseline where every change goes through human review and the 15 questions are never used to tune the context.
- The eval file goes in a separate bucket (
gs://kc-okf-poc-261122-eval), because the whole signals bucket is a knowledge signal: an eval file there would let the agent read the answers. - External sources (Scope page, collapsed by default; verified from the console): "Includes Google Workspace, Microsoft SharePoint, GitHub, and Atlassian Confluence." Connected sources, each with a Set up button: Google Workspace (Drive, Docs, Sheets, Slides), Atlassian (Confluence spaces and Jira projects), GitHub (repositories and READMEs), Microsoft (SharePoint sites). Optional Source configuration file: a Cloud Storage YAML file to configure third-party connections. Not used in run 1. This is wider than the docs we read in step 0, which named only Cloud Storage and Workspace (docs vs verified).
- Eval set format: my first file put
golden_responsenext toevaluation_request(my reading of the docs). The console rejected it:Line 1: missing "evaluation_request.golden_response.text". Correct shape, verified by the console's validator:{"evaluation_request": {"prompt": {"text": "..."}, "golden_response": {"text": "..."}}}. The console checks the file as soon as you pick it, which is helpful. - The evaluation set is about SQL. After loading the file, the preview table's columns are Name, Prompt, Golden SQL. verified So Studio measures whether an agent writes the right query with the context, not whether it answers in prose. Our first set had prose answers (kept as
trash/eval-set-prose-v1.jsonl); it was rewritten as 12 questions with golden SQL in poc/03-studio/eval-sql/. All 12 pass a BigQuery dry run (verified**, dry-run.txt).
Eval set (golden SQL)
| # | Question | Needs the policy doc? | What the right SQL must do |
|---|---|---|---|
| 1 | Total sessions | no | count distinct user_pseudo_id + ga_session_id on session_start |
| 2 | Daily active users, Dec 2020 | no | filter on partition column event_date_dt |
| 3 | Top 10 products added to cart | no | unnest items |
| 4 | Top pages on 2021-01-15 | no | pull page_location out of event_params |
| 5 | Purchases per day, first week of Jan 2021 | no | partition filter |
| 6 | Net merch revenue, Dec 2020 | yes | purchase_revenue_in_usd minus refund_value_in_usd |
| 7 | Active buyers (28d) as of 2021-01-31 | yes | trailing 28 days of purchase |
| 8 | Users by city, Jan 2021 | yes | group by country/region instead (city is Tier C3) |
| 9 | Sessions by traffic source for attribution | yes | exclude (data deleted) |
| 10 | Cart conversion rate, Dec 2020 | yes | sessions with purchase / sessions with add_to_cart |
| 11 | Engaged sessions, Jan 2021 | yes | >10 s, or 2+ page views, or a purchase |
| 12 | Daily net merch revenue, Jan 2021, final days only | yes | drop the last 3 days (72-hour rule) |
Facts with no SQL form (owner team, dataset code MSC-417, "never join with CRM") are tested in step 5 instead.
Screenshots
- Run page (verified, from the console): Run as "the identity this task uses to read the configured sources and write to the context set": a required user service account picker listing the project's service accounts (ours, plus the Compute Engine default account that appeared when the Compute API was turned on), with a New service account button. Trigger: default On demand, with a schedule option. Notifications: "email a report after every run", up to five addresses. The final button is Create.
- After Create (verified): the Enrichments list shows counters Active 0 / Failed 0 / Succeeded 0 and one row
ga4-events-enrichmentwith an empty Status and Run summary and Trigger "Scheduled", although the Run page summary said "On demand". So Create made the task but did not visibly start a run.
- Task page (verified): buttons Edit, Delete, Refresh, Run now; tabs Jobs and Details. The Jobs tab (columns Name, Status, Last Update Time, Duration, Tokens Used, Summary, Actions) showed "Sorry, the server was not able to fulfill your request" before any run existed. guess**: the Preview UI errors on an empty job list rather than a permission problem.
- Not scriptable yet. The task is not a Dataplex DataScan (
gcloud dataplex datascans listis empty). The public Dataplex v1 discovery document has a resourceprojects.locations.agentTasks, but it exposes onlygetIamPolicy,setIamPolicyandtestIamPermissions; GET on.../agentTasksreturns "Method not found". verified (2026-11-22). So enrichment tasks can only be driven from the console for now: no gcloud, no public REST, no Terraform.
- Create is slow and silent. Audit logs (verified,
gcloud logging read) showAgentTaskService.CreateAgentTaskat 22:02:37 (UTC) as a long-running operation that finished at 22:07:04: about 4.5 minutes to create the task. The console listed the task (trigger "Scheduled", no status) during that time with no "creating" indicator. Clicking Run now at 22:06:26 failed withINVALID_ARGUMENT: Provided AgentTask '.../locations/us-central1/agentTasks/ga4-events-enrichment' does not exist.The operation result is saved in 03-studio/create-agenttask-operation.json: resource typegoogle.cloud.dataplex.v1.AgentTask, locationus-central1. - What is visible from outside the console: the API service is
google.cloud.dataplex.v1.AgentTaskService(methods seen:CreateAgentTask,RunAgentTask); calls appear in Cloud Audit Logs, and the create operation can be read with the standard operations API. The REST methods themselves are not in the public discovery doc. verified
- Task Details tab (verified) lists everything in one place: context set
projects/kc-okf-poc-261122/locations/us/entryGroups/ga4-merch-context(so a context set is an entry group, as the docs said), regionus-central1, resources "Tables: kc-okf-poc-261122.ga4_sample.events", assets (buckets)kc-okf-poc-261122-signals, the service account, the evaluation set, Auto-publish quality threshold and Regression threshold (both empty: two settings the wizard did not show), trigger On demand. So the "Scheduled" label in the task list is wrong or means something else. - Run 1 started at 22:07 UTC on 2026-11-22, run ID
d3704062-699a-4661-9299-1d42e5d4266d. The run page has tabs Overview (Enrichment Report: status, duration, tokens, summary) and Logs. First status: Pending.
- The agent queries the data. Audit logs for
kc-studio-enricherduring run 1 (verified, snapshot at about 12 minutes in): 138 completed BigQuery jobs, 0 errors, 52.5 GB billed (about USD 0.33 at on-demand prices; inside the 1 TB/month free tier). The first queries list schemas, tables, columns and routines throughINFORMATION_SCHEMA, then profile the data (min/max date, row counts) and run analytical queries that look like attempts at our eval questions. Several queries do not filter on the partition column and scan 1.35 GB each. The Dataplex service agent only calledGenerateAccessToken(the badge swap). Every job of the full run and its SQL: 03-studio/run1-bq-jobs.csv. - Cost note for a team: enrichment is free during Preview, but the BigQuery queries it runs are billed to the project like any other query. On large tables, a team should cap this with a per-user or per-project query quota or custom cost controls for the service account.
Run 1: what happened behind the scenes
The console's Logs tab reads Cloud Logging, log dataplex.googleapis.com/agent_task, entries of type google.cloud.dataplex.v1.AgentTaskEvent (event types EXECUTION_LOG and AGENT_RUN_EVENT). tools/export_run_log.py exports a run's entries to 03-studio/run1-agent-log.md (readable) and .jsonl (raw). Findings from the log, all verified unless marked:
- A 7-stage pipeline:
prepare(5%),baseline_eval(15%),source_gather(20%),entry_writing(45%), then later stages. Queued for about 8 minutes before the first stage (run started 22:08:27, stage 1 at 22:16:47 UTC). - Baseline first. Stage 2
baseline_evaltook about 6.5 minutes. The BigQuery jobs in that window look like answers to our eval questions written without the new context, so Studio measures a "before" score. guess (from timing and the SQL in the jobs snapshot). - Model:
gemini-3.8-flash. - Our documents were read. "9 gathered" items from Cloud Storage (our 8 Google files and the policy doc); all were under the 8,000-character "size gate", so they were used whole without a summarising model call. The
[Crawler]"fetched 0 documents" line refers to the external connectors, which we did not set up. - Tracer, first sign: the
[Router]step matched the table to our made-up doc:events ← Merch Store Clickstream: data policy and metric definitions, table metadata, data sample (used only to check accuracy). The business name exists only in our policy doc. - Mention extraction: "Source documents mention 4 tables, 20 columns, 9 glossary terms and 10 other systems (51 times in total)". So Studio extracts glossary-like terms from documents even with no glossary configured.
- Query history. Studio tries to learn from 30 days of real query history for the table ("sample queries"), but failed with
403 ... customer permission check failed for bigquery.jobs.listAll. Our service account does haveroles/bigquery.resourceViewer, which includesbigquery.jobs.listAll(checked withgcloud iam roles describe). Why it still failed is unknown (guess: the check runs as a different identity or at another level). Google's setup docs do not mention this permission. It would matter on a real table with real usage; here there was no history anyway. - Relationships: a
[Link]step looks for related tables from document co-mentions and schema overlap ("1 verifier candidate pair ... from schema overlap"), and added 0 links. That is the console's Relationships feature. - Output so far: "wrote 2 file(s)" for
miscellaneous/events, created 1 context-set asset entry foreventslinked to its source table, and planned 3 context entries in categoryanalytics-guidelines.
Run 1 result
- Succeeded. Run started 22:08:27, completed 22:37:39 UTC: 29 minutes (about 8 of them queued). verified
- Run summary (from the final
AGENT_RUN_EVENT): "High confidence overall: 4 proposals scored across 9 changes -- 4 High, 0 Medium, 0 Low." Tokens: 83,969 in, 20,056 out, 104,025 total. One change request created:projects/109873812728/locations/us/changeRequests/345f4080-d80d-4ae6-85ce-a856cda1ae23, "staged (auto-publish is off; staged for review)". verified - Later stages: wrote 3 documents
pitfalls,data-governance-and-quality-boundaries,computing-standard-ecommerce-metrics; organised them into folders; rewrote the context set's description; skipped a "semantic model step" on a temporary copyga4-merch-context-curate-tmp-...;finalize_catalog(88%, "models and redaction");final_eval(92%, about 5.5 minutes);publish(95%, "staging change requests and run reports"). verified -
BigQuery work by the service account over the whole run: 209 jobs, 0 errors, 65.2 GB billed (about USD 0.41 on-demand, inside the free tier). 03-studio/run1-bq-jobs.csv. verified
-
Console Jobs tab after the run: status "Needs review" (a warning icon, not "Succeeded"), duration 29 min 12 sec, Tokens Used 104K, and the same summary text. The log says SUCCEEDED; the console shows the human-facing state: the run is done but its change request is waiting for a reviewer. verified
Studio's own scores (run Overview tab)
From the user's screenshot of Enrichments > ga4-events-enrichment > run d3704062 > Overview (the image file was not saved in the session, so it isn't embedded here): verified
| Field | Value |
|---|---|
| Enrichment Report score | 83%, High |
| End-to-end evaluation, Baseline | 67% (8 of 12 pass) |
| End-to-end evaluation, Projected | 100% (12 of 12 pass) |
| Delta | +4 (+33%), "Cases with a baseline: 12" |
| Proposals | author kc-studio-enricher@..., "Enrichment Agent Proposal: Knowledge Base Entry", buttons Deny / Approve (9) |
"Projected" means Studio's final eval ran against the proposed context before anyone approved it. It isn't a measurement of the published context. The page also has Evaluation and Artifacts tabs, which we haven't opened yet.
The proposals (the change request)
- 9 changes, all Create (0 Update, 0 Delete). The filter chips say High 4, N/A 5: the 4 content pages get a confidence score; the index pages and the link don't. verified
- Review is per item, not all-or-nothing. Each proposal has a checkbox, with Remove selected and Approve selected buttons, plus Deny / Approve (9) for the whole request. verified (we haven't clicked any of them yet)
- The change request can be read through the API even though the task API can't:
GET https://dataplex.googleapis.com/v1/projects/kc-okf-poc-261122/locations/us/changeRequests/345f4080-...returns the full request (v1beta1 and v1alpha1 return 404). Fields:author= our execution SA,state: NEW, labelssource: knowledge_agent,generator: enrichment_agent,changeType: BATCH_CHANGE_METADATA, and a list ofcreateEntryRequest/createEntryLinkRequest. Saved as 03-studio/run1-change-request.json. verified - What is proposed: a small knowledge base inside the context set, built from Dataplex
documententries whose text lives in theoverviewaspect (Markdown), the same aspect kcagent writes in step 2. Each page was extracted into 03-studio/run1-proposals/. verified
| Entry id | Document type | Size | What it is |
|---|---|---|---|
agents |
knowledge-base-root | 2.2 KB | Front page for agents: what the data is, top 2 traps, how to navigate ("about three searches and three lookups per question") |
assets |
knowledge-base-index | 0.3 KB | Folder index |
assets/bigquery/kc-okf-poc-261122/ga4_sample |
knowledge-base-index | 0.3 KB | Dataset index |
assets/.../ga4_sample/events |
table-context | 5.5 KB | Table page: columns, metric definitions, owner, governance, data quality, usage |
documents |
knowledge-base-index | 0.9 KB | Folder index for the 3 topic pages |
documents/computing-standard-ecommerce-metrics |
knowledge-base | 3.3 KB | Metric definitions with SQL |
documents/data-governance-and-quality-boundaries |
knowledge-base | 8.0 KB | Tiers, retention, finality, attribution rules |
documents/pitfalls |
knowledge-base | 5.9 KB | "Pitfalls that silently produce wrong answers" |
link events -> events |
entryLink reference |
Ties the table page to the real BigQuery table entry in @bigquery |
- Tracer facts: every one of them made it in. MSC-417, "Merch Store Clickstream", Digital Insights Guild,
#msc-417-data, 72-hour finality, tiers C1/C2/C3, 14-month retention, engaged session > 10 s, active buyer 28d, net revenue with refunds,(data deleted),event_date_dt, 2020-11-01 and 92 days all appear, cited as[1] Merch Store Clickstream: data policy and metric definitions. Each fact we spot-checked matches the policy wording, including the on-call steward and "never use local-currency columns". Google's sample docs are cited separately ([2]–[7] inpitfalls). verified (by grep, plus a manual read ofevents,agentsandpitfalls) - One flaw found: the example SQL in
pitfallscounts sessions asCOUNT(DISTINCT ga_session_id)per day, but the same page (and the policy) say a session isuser_pseudo_id+ga_session_id. The page contradicts itself. This makes it a good candidate for the "reject" half of the review test. verified (reading)
Review test: remove pitfalls, approve the rest
- Removing is final: "You can't undo this. Removed proposals can't be recovered. The proposals are removed from this change request and never applied. Their catalog entries stay as they are." We had already saved the page's full text in 03-studio/run1-proposals/documents__pitfalls.md and the request JSON, so nothing is lost from the record. verified
- Studio's confidence score missed the flaw. Expanded,
pitfallsshows Overview 83%, "Several independent sources agree on it, and no check holds it back", even though its example SQL contradicts its own session rule. The confidence score looks at whether sources agree, not whether the example SQL is correct. verified (screenshot) / the explanation is a guess - Index rows such as
documentsshow N/A confidence, with the reason text "Enrichment Agent Proposal: Knowledge Base Entry". verified
After removing pitfalls: the proposal viewer
- The removal worked. The list now shows All 8, High 3 (it was 9 and 4), and the viewer pages through "1 of 8" ... "8 of 8". verified
- Confidence per content page:
events86%,computing-standard-ecommerce-metrics87%,data-governance-and-quality-boundaries83%. The reason given is "Every statement traces to a source the run read, which is enough for High." Theagentsfront page and the indexes have no score. verified - What the viewer offers for each proposal (opened with "View proposal"): verified
- the entry path and type (for example
document · assets/bigquery/kc-okf-poc-261122/ga4_sample/events) and "2 aspects change": Overview (the Markdown text) and Document aspect (thetype/jobmetadata seen in the API JSON) - a New badge (because it's a Create; an Update would presumably show a diff, which is a guess until run 2)
- Changes / Preview toggles: a raw diff or the rendered Markdown
- a pencil (edit) icon: it looks like the reviewer can edit the text before approving, which we haven't tried yet
- Remove proposal on each page, the same as Remove selected in the list
- < > arrows to step through all proposals, like reviewing files in a pull request
- the entry path and type (for example
Approve and publish
- The status went from "Needs review" to "Approved, applying changes", and the Proposals card says "8 approved, 0 rejected". The removed
pitfallsis not counted as "rejected": removing deletes the proposal from the request instead of recording a rejection, so there's no audit trail of what was turned down. (Our local copy is the only record.) verified - We skipped the optional pencil-edit test; the published
eventspage is byte-for-byte identical to the proposal. verified - Read back through the API (the full JSON is saved in 03-studio/run1-change-request-after-approve.json, with the approver's email redacted): verified
- Change request
state: APPROVED,approver= the user's own account,author=kc-studio-enricher@.... Itschangeslist now holds 8 items; pitfalls was removed from the request itself. - The context set now holds 7 document entries, all created at 23:51:30 UTC, about 2 seconds after approval (23:51:28), plus the entry link.
- Aspect keys on the published entries use the project number form
655216118709.global.overview/.document. In the proposal they used the name formdataplex-types.global.overview. These are the same Google-owneddataplex-typesproject; readers must accept either form. GET .../entryLinks/link-events-events-776bc352returns 400 "Operation ... is not allowed for Context Sets", so entry links inside a context set can't be read directly with this API.
- Change request
- Same person wrote and approved. The SA is the author and our Owner account approved. Studio didn't stop the person who set up and ran the task from approving its output. We haven't yet tested whether a separate approver identity is required or merely possible (to do: second account +
roles/dataplex.workflowApprover). verified (no block seen) / the separation question is still open - Finding: removing a proposal leaves dangling references. The published
documentsindex still listscatalog/documents/pitfalls("Pitfalls that silently produce wrong answers"), and theagentsfront page still says "3 pages of knowledge". Neither page exists. Studio doesn't regenerate the indexes after you remove one item, so an agent following the index will look up a missing entry. The workaround is to remove or edit the index pages too, or use the pencil to fix them before approving. verified
Read-back with kcmd 0.2.5
- Default layout pulls nothing.
kcmd init --kb kc-okf-poc-261122.us.ga4-merch-context --pull(run by the user inresults/03-studio/kcmd-kb/) printed "Warning: Unable to load type information for entry type dataplex-types.global.document. Entries of this type are not pulled. Successfully updated local snapshot." and wrote onlycatalog.yaml. verified - Why:
GET projects/dataplex-types/locations/global/entryTypes/documentreturns 403dataplex.entryTypes.getdenied (the same foraspectTypes/document), whileentryTypes/bigquery-tablein the same Google-owned project reads fine. Thedocumenttype definition isn't readable by our project, probably because it's still Preview-gated (guess). kcmd 0.2.5 tolerates a 403 on an aspect type ("its aspects are still pulled") but treats a 403 on an entry type as fatal for that type (_loadEntryTypeinbuild/ts/kcmd/cli.js). That's a gap in kcmd, and 0.2.5 is the latest version on npm. verified (code and API) - The OKF layout works.
kcmd init --kb ... --format okf --pullreported "Wrote 7 concept(s) to bundle/" and producedbundle/agents.md,assets.md,assets/bigquery/kc-okf-poc-261122/ga4_sample.md,.../ga4_sample/events.md,documents.md, the twodocuments/*.mdpages and_links.yaml. Each page is Markdown with YAML front matter:type(knowledge-base-root / -index / table-context / knowledge-base) and anx-kcmdblock that keeps the entry type, parent, labels (generator: enrichment_agent) and the Studio job name and time, sokcmd pushcan round-trip it. The entry link to the real BigQuery table is in_links.yaml. verified (tested in a scratch folder first) - So path S1 in docs/context-layer.md works today: published Studio context comes out as plain OKF files an outside agent can read, but only with
--format okf. verified - The dangling
pitfallsrow from the removed proposal comes along inbundle/documents.md. verified - There's no
index.md; the root index isagents.md. Its front matter saystype: knowledge-base-rootand its text starts "Index of the catalog root". The folder indexes areassets.md,documents.mdandassets/.../ga4_sample.md(type: knowledge-base-index), each sitting next to the folder it describes. kcmd treatsagents.mdandindex.mdas interchangeable root files: when initialising an empty workspace it writesindex.mdunlessagents.mdalready exists, and it looks for<group>_entry.md, thenagents.md, thenindex.mdas the context set's front page (build/ts/kcmd/cli.js). An OKF reader that hard-codesindex.mdmust also acceptagents.md. verified (code)
Read-back through the kcmd MCP server
python3 tools/mcp_probe.py results/03-studio/kcmd-okf results/03-studio/kcmd-mcp-probe.md agents assets/bigquery/kc-okf-poc-261122/ga4_sample/events (run by the user) starts kcmd mcp on the OKF workspace and acts like an agent. Full output: 03-studio/kcmd-mcp-probe.md. verified
- 3 tools:
list-entries(no inputs),lookup-entry(name),modify-entry(name, field, updates). The README also listspullandpush; 0.2.5 doesn't serve them. list-entriesreturns only the 7 entry names, with no titles or descriptions, so an agent can't choose a page from the list alone. It has to openagents(the root) first and follow the indexes, which is how the root page tells it to navigate.lookup-entryreturns JSON:name,type(dataplex-types.global.document),resource(labels, location) andaspects. The page text is inaspects["dataplex-types.global.overview"].contentand is identical to the.mdbody in the bundle. The document aspect carries the page role (table-context) and the Studio job. The JSON wrapping makes it about 13% bigger than the plain file (6,239 vs 5,526 characters forevents).- There's no tool for entry links:
_links.yaml(events page → real BigQuery table) isn't reachable over MCP. - Takeaway: for a read-only question-answering agent, MCP gives the same content as reading the OKF files, plus a write tool you'd need to hide. Reading the files directly (S1) is simpler. MCP earns its place only when the agent can't touch the file system.
Who can approve: answered from role definitions (no live second-account test)
The user decided a live test with a second account wasn't needed. These facts come from read-only calls (the API discovery doc, gcloud iam roles describe, GET on the context set). verified unless marked otherwise.
- Approval is plain IAM, not a Studio setting. Approving or rejecting needs
dataplex.changeRequests.use. Roles that have it:dataplex.workflowApprover(Beta: get, list, use),dataplex.workflowAdmin,dataplex.catalogAdmin,dataplex.admin, and the basic Editor and Owner roles. - Running Studio doesn't need it.
dataplex.editorhasagentTasks.create/run/...but nochangeRequests.use, and thecontent*roles only haveentryGroups.requestContextChanges. So separation of duties is possible: give task runnersdataplex.editor+contentEditorand reviewersworkflowApprover. Anyone with basic Editor or Owner can do both, which is what happened in this POC. - The context set's approver list is notification only. The
changeRequestConfig.approverEmailsfield (up to 10) is documented as "potential approvers ... notified when a change request is created". It doesn't restrict who can approve (docs). Ours is empty (changeRequestConfig: {}). - Change requests can be scripted, unlike Studio tasks:
changeRequests.get/list/patch/approve/reject/delete, with comments on approve and reject (reviewerComment,rejectionComment), andentryGroups:requestBatchMetadataChangeto submit a reviewed change yourself. That's the API route for hand-written playbooks to go through the same review gate (docs, untested). - Not tested: whether the API or console blocks a person from approving a change request they authored themselves.
Before versus after, seen in the agent's own SQL
The baseline stage (agent answering without new context) and the final-eval stage (with the new context) both show up as bursts of queries. Counting signals in the SQL text (data queries only, INFORMATION_SCHEMA excluded; verified counts, guess that each burst is the eval answering):
| Signal in the SQL | Baseline (22:16–22:23) | Final eval (22:31–22:38) |
|---|---|---|
| Data queries | 110 | 62 |
Filter on partition column event_date_dt |
54 (49%) | 59 (95%) |
| Scans over 1 GB | 30 | 1 |
Excludes (data deleted) traffic (policy rule) |
0 | 15 |
Groups by geo.region (policy: no city level) |
0 | 3 |
Uses geo.city |
4 | 1 |
| GB billed | 52.7 | 12.5 |
So after enrichment the agent followed our made-up reporting rules and the partition rule, and scanned about 4 times less data. The official scores should be in the run report and change request (next).
Commands to repeat this step (poc/03-studio/README.md)
Step 3: Knowledge Studio, commands
Everything we ran for step 3, in order. Results and findings: results/03-studio.md. How to remove each resource: results/cloud-resources.md.
Every command assumes the gcloud profile for this POC: run export CLOUDSDK_ACTIVE_CONFIG_NAME=kc-okf once per terminal tab. Replace YOUR_EMAIL with your own Google account. The project number 109873812728 names the Dataplex service agent; use your own project's number.
3a. Identity that Studio runs as ("Run as" service account)
# our execution service account
gcloud iam service-accounts create kc-studio-enricher --display-name="KC Studio enrichment (POC)"
# its project roles: use the API quota, read and query BigQuery, read and write catalog metadata and context
for r in serviceusage.serviceUsageConsumer bigquery.dataViewer bigquery.resourceViewer bigquery.jobUser dataplex.catalogViewer dataplex.catalogEditor dataplex.contentEditor; do echo "== $r"; gcloud projects add-iam-policy-binding kc-okf-poc-261122 --member="serviceAccount:kc-studio-enricher@kc-okf-poc-261122.iam.gserviceaccount.com" --role="roles/$r" --condition=None --format=none; done
# make sure Google's Dataplex service agent exists in the project (needs gcloud beta)
gcloud beta services identity create --service=dataplex.googleapis.com
# let the service agent act as our service account (the "badge swap")
gcloud iam service-accounts add-iam-policy-binding kc-studio-enricher@kc-okf-poc-261122.iam.gserviceaccount.com --member="serviceAccount:service-109873812728@gcp-sa-dataplex.iam.gserviceaccount.com" --role="roles/iam.serviceAccountTokenCreator" --format=none
# the service agent also reads BigQuery data
gcloud projects add-iam-policy-binding kc-okf-poc-261122 --member="serviceAccount:service-109873812728@gcp-sa-dataplex.iam.gserviceaccount.com" --role="roles/bigquery.dataViewer" --condition=None --format=none
3b. Knowledge signals (documents Studio reads)
Contents: Google's 8 sample docs (signals/google-sample/) and our made-up policy doc signals/merch-store-data-policy.md, which carries the tracer facts.
gcloud storage buckets create gs://kc-okf-poc-261122-signals --location=US --uniform-bucket-level-access
cd ~/apps/kc-okf && gcloud storage cp -r poc/03-studio/signals/* gs://kc-okf-poc-261122-signals/
gcloud storage buckets add-iam-policy-binding gs://kc-okf-poc-261122-signals --member="serviceAccount:kc-studio-enricher@kc-okf-poc-261122.iam.gserviceaccount.com" --role="roles/storage.objectViewer"
3c. Let yourself read context (Owner alone can't)
gcloud projects add-iam-policy-binding kc-okf-poc-261122 --member="user:YOUR_EMAIL" --role="roles/dataplex.contentEditor" --condition=None --format=none
3d. Evaluation set (kept apart from the signals so Studio can't learn the answers)
The format of each line of eval-set.jsonl: {"evaluation_request": {"prompt": {"text": "..."}, "golden_response": {"text": "<golden SQL>"}}}. The golden SQL comes from eval-sql/01.sql–12.sql; we dry-ran each one first (eval-sql/dry-run.txt).
gcloud storage buckets create gs://kc-okf-poc-261122-eval --location=US --uniform-bucket-level-access
cd ~/apps/kc-okf && gcloud storage cp poc/03-studio/eval-set.jsonl gs://kc-okf-poc-261122-eval/
gcloud storage buckets add-iam-policy-binding gs://kc-okf-poc-261122-eval --member="serviceAccount:kc-studio-enricher@kc-okf-poc-261122.iam.gserviceaccount.com" --role="roles/storage.objectViewer" --format=none
3e. Console only (no API for these)
These steps have no public API (agentTasks has IAM methods only), so they're done in Knowledge Catalog > Studio:
- Context sets > Create: name
ga4-merch-context, location multi-regionus(at the top of the list; the default is us-central1). - Enrichments > Create, a 4-page wizard:
- Define: name
ga4-events-enrichment - Scope: context set
ga4-merch-context, region us-central1, resource the BigQuery tablega4_sample.events, knowledge signal the bucketkc-okf-poc-261122-signals - Improve: evaluation set
gs://kc-okf-poc-261122-eval/eval-set.jsonl; no curation set; auto-publish off; self-learning off - Run: Run as
kc-studio-enricher@..., trigger On demand
- Define: name
- Wait about 5 minutes after Create (the task is created in the background), then Run now. It ran for 29 minutes.
- Review: open the run, read each proposal with View proposal, remove
pitfalls(Remove selected), then Approve.
3f. Read-only checks we used
# the run's own event log -> results/03-studio/run1-agent-log.{jsonl,md}
cd ~/apps/kc-okf && python3 tools/export_run_log.py d3704062-699a-4661-9299-1d42e5d4266d results/03-studio/run1-agent-log
# the change request with every proposed page (the API can read and approve change requests, unlike tasks)
curl -s -H "Authorization: Bearer $(gcloud auth print-access-token)" -H "x-goog-user-project: kc-okf-poc-261122" "https://dataplex.googleapis.com/v1/projects/kc-okf-poc-261122/locations/us/changeRequests/345f4080-d80d-4ae6-85ce-a856cda1ae23"
# BigQuery jobs the service account ran (audit log)
gcloud logging read 'protoPayload.methodName="jobservice.jobcompleted" AND protoPayload.authenticationInfo.principalEmail="kc-studio-enricher@kc-okf-poc-261122.iam.gserviceaccount.com"' --freshness=2d --format=json
3g. Read the published context back
kcmd 0.2.5 from the step 2 install. The default layout pulls nothing (403 on the document type definition); use --format okf.
cd ~/apps/kc-okf && mkdir -p results/03-studio/kcmd-okf && cd results/03-studio/kcmd-okf && ../../../vendor/knowledge-catalog/toolbox/enrichment/node_modules/.bin/kcmd init --kb kc-okf-poc-261122.us.ga4-merch-context --format okf --pull && find . -type f | sort
# act as an MCP client against `kcmd mcp` (read tools only)
cd ~/apps/kc-okf && python3 tools/mcp_probe.py results/03-studio/kcmd-okf results/03-studio/kcmd-mcp-probe.md agents assets/bigquery/kc-okf-poc-261122/ga4_sample/events
Where OKF fits, and how an outside agent uses Knowledge Catalog context
A sidebar written during step 3 (2026-11-22), answering two questions:
- If I already have agents with a context layer (a retriever over GCS docs, or an agent that reads OKF Markdown), where do Knowledge Catalog, Studio, kcmd and OKF fit? How does an agent built outside Google (for example LangGraph on a laptop) read the context we build in Knowledge Catalog?
- Table knowledge is only half of it. Where does process context go, meaning playbooks like "for this kind of question, take this approach, use these columns, run this SQL"?
Labels: verified = we saw it in this POC. docs = written in Google's docs or the kcmd README. guess = our reasoning, still to be tested.
Short answer
Think of a .NET team's database:
| Piece | What it is | .NET / SQL Server analogy |
|---|---|---|
| Knowledge Catalog context set | Where context is stored: governed, access-controlled, reviewed, versioned | The production database |
| Knowledge Studio enrichment | A Google-hosted agent that writes draft context from your sources and tests it with your eval set | A code generator that opens a pull request |
| Change request | The review gate: approve or remove each page, then publish | The pull request review |
| OKF | A file format for the same context: an index page plus linked Markdown pages in folders | A .bacpac / SQL script export: portable, readable without the server |
| kcmd | The sync tool between the catalog and local files (init, pull, push, mcp) |
git pull / git push, or sqlpackage |
So OKF is not a competitor to Knowledge Catalog; it is how the catalog's context travels out to an agent as files (and back in). docs: kcmd init --entry-group ... --format okf "keeps the entries as an Open Knowledge Format bundle under bundle/, with entry links in bundle/_links.yaml... the entry group may not exist yet; kcmd push creates it as a context set."
The context Studio produced is already OKF-shaped: a root page agents, folder index pages (assets, documents), and topic pages. Its root page even tells the reader how to navigate: "Look entries up by the ids below. A lookup returns only the entries it names... Budget about three searches and three lookups per question". That's the same index-then-pages reading loop your OKF agent already uses. verified (see results/03-studio.md)
Q1: how an outside agent reads the context
There are three ways, from simplest to most live:
| How | Good for | Watch out for | |
|---|---|---|---|
| S1. Pull to OKF files | kcmd init --kb <project>.<location>.<context-set> --format okf, then kcmd pull on a schedule (cron, CI). The agent reads files from disk. |
Your existing OKF agent works unchanged: no Google dependency at question time, cheap, works offline, easy to diff in git | Stale until the next pull; whoever runs the pull needs read access |
| S2. kcmd MCP server | kcmd mcp --path <workspace> runs locally over stdio. The README lists pull, push, list-entries, lookup-entry, modify-entry, but 0.2.5 actually serves only list-entries, lookup-entry and modify-entry (verified). LangGraph connects through an MCP adapter. |
Agents that already speak MCP; same content as S1 but through tools instead of file reads | It reads the local snapshot, so it's still pull-based. modify-entry is a write tool (it changes the local snapshot, which a later kcmd push would send); give a question-answering agent only the read tools |
| S3. Dataplex API, live | Wrap 2–3 REST calls (get or lookup an entry, search entries) as agent tools, using the agent's own service account | Always current, IAM-enforced per caller; can also feed your own embeddings retriever (index the pages' Markdown) | Needs GCP credentials at question time. Watch latency and quota. Entry links inside a context set can't be fetched directly (400 not allowed for Context Sets, verified) |
Update after steps 3–5: S1 is verified. kcmd init --kb ... --format okf --pull writes the pages; the default layout pulls nothing because of a 403 on Google's document type. S2 is verified with 3 tools (see the step 3 MCP probe). S3's REST reads are verified by our own read-back of the published entries. Step 5 runs a LangGraph agent through S1 and S2.
What this means for your two agent types:
- Embeddings / retriever agent: keep your retriever, but change its source. Instead of indexing raw GCS docs, index the published, reviewed pages from the context set (via S1 files or S3). You get the review gate and the governance (tiers, owner, finality rules) for free. guess
- OKF agent: point it at the folder that
kcmd pull --format okfkeeps up to date. The pull is verified. One detail: Studio's root page isagents.md, notindex.md, so accept both.
Recommendation: treat Knowledge Catalog as the system of record and OKF files as the distribution format. Agents read OKF (S1) by default, and S3 only where freshness or per-user permissions matter.
Q2: process context (playbooks)
What we saw in this POC:
- A context set isn't limited to table descriptions. Studio created
documents/*pages that aren't attached to any table:computing-standard-ecommerce-metricsis effectively a playbook (definition, then the SQL pattern) andpitfallsis a "don't do this" list. So free-standing how-to pages are a normal entry type (documentwithtype: knowledge-base). verified - Studio tried to read BigQuery query history (
bigquery.jobs.listAll, which gave a 403 in our run). That's process context mined automatically from how people actually query the table. verified (the attempt) / what it would have extracted is a guess - Studio's eval set (question plus golden SQL) and curation set are inputs that steer and test the drafts. They aren't served to agents as pages. verified for eval / guess for curation
How we would hold playbooks (partly tested in step 4):
- Write each playbook as one Markdown page: when to use it (the question pattern), approach, columns, the SQL template, traps, a worked example. Keep them in git, in an OKF layout under
documents/playbooks/, listed in aplaybooksindex page so an agent finds them from the root. - Get them into the context set by one route:
- kcmd push of the OKF bundle. Verified in step 4: it publishes directly, with no change request, and isn't atomic.
- Or a change request through the API (
requestBatchMetadataChange). Verified in step 4: it's reviewed, and the author can't approve their own request. - Or put them in the signals bucket and let Studio fold them in. Risk: Studio rewrites and merges them, as it did with our policy doc, so the exact SQL you wrote may not survive word-for-word.
- Put each playbook's question and golden SQL into the eval set too, so every Studio run checks that the published context still produces that answer, like a regression test.
- The agent's instruction says: "check
playbooksfirst; if the question matches one, follow it". That's the same flow as your OKF agent today, now with a review gate and an owner.
Why this split: table context (what the data is, its rules) is something Studio can generate well from documents. In this run, every tracer fact from our made-up policy landed, and query quality rose 67% to 100% on our eval. Process context is your team's judgment, so it's better hand-written and reviewed. Studio's draft pages can still give you a first version.
Tests this added to the plan (and what happened)
| Test | Step | Answers | Result |
|---|---|---|---|
kcmd init --kb ... --pull (default layout) and --format okf |
3 / 4 | Does the published context come out as usable files? Does the OKF bundle match what the console shows? | Yes with --format okf (identical text); the default layout pulls nothing |
kcmd push a hand-written documents/playbooks/*.md |
4 | Is a push reviewed (change request) or published directly? Who can push? | Published directly by anyone with contentEditor; not atomic |
| LangGraph agent with S1 (files) vs S2 (kcmd MCP, read tools only) vs no context | 5 | The 15 questions, compared across access paths | Run once per question per setup (to save cost): see step 5 |
| The same agent with and without the playbook pages | 5 | Does process context improve answers beyond table context? | Not run as a separate A/B; the pushed playbook is part of setups B and C (questions 12 and 15 use it) |
Step 4: OKF, hand-written playbooks and the two ways to write context
What this step answers: what OKF is today, how close Knowledge Catalog's export is to it, and how a team gets its own process knowledge (playbooks) into a context set, with or without review. Commands: poc/04-okf/README.md. Background: docs/context-layer.md.
Run on 2026-11-22/23 (UTC). Labels: verified = we ran it; docs = Google's spec or README; guess = not checked.
Summary
| Question | Answer |
|---|---|
| Is OKF still Google's project? | No. On 2026-11-18 Google marked GoogleCloudPlatform/open-knowledge-format deprecated. OKF now lives at open-knowledge-format/open-knowledge-format, spec v0.3. verified |
| Does Knowledge Catalog's export follow OKF? | Loosely. Every file has valid frontmatter with a type, so the bundle is conformant by §11.1. But it uses none of OKF's richer fields: no title, description, generated, verified or sources, no index.md, and numbered [n] citations instead of footnotes. Google's own OKF sample bundle uses all of them. verified |
| Can a team write context by hand and push it? | Yes, with kcmd push, and it is NOT reviewed. It writes directly (batchChangeMetadata); no change request is created. verified |
| Is there a reviewed route for hand-written context? | Yes, by API. entryGroups:requestBatchMetadataChange creates a change request in state NEW; nothing is published until someone approves it. verified |
| Can the author approve their own change request? | No. The API returns 403 "User is not authorized to approve their own ChangeRequest", even for a project Owner. verified |
| Are playbooks a first-class idea? | In OKF, yes: the spec's own example is type: Playbook with # Trigger / # Steps (§4.4). docs. In Knowledge Catalog a playbook is just another document page; there's no special type or behaviour. verified |
4a. What OKF is (and the deprecation)
- OKF = Open Knowledge Format: "a universal, vendor-neutral format for representing knowledge as plain markdown files with YAML frontmatter", organised in folders, with
index.mdfiles for progressive disclosure. docs - The old repo (
GoogleCloudPlatform/open-knowledge-format, v0.2 spec, a Google ADK reference agent and sample bundles, including one for GA4) is deprecated as of 2026-11-18 (commit8a8ff87, "Mark the repository as deprecated"). The README points toopen-knowledge-format/open-knowledge-format(commit527e81a, same date) with spec v0.3, bundles, and two agent skills:okf-consumeandokf-generate. verified (both cloned intovendor/, git-ignored) - What the v0.3 spec adds beyond "Markdown with frontmatter": docs
- only
typeis required;title,description,resourceandtagsare optional - provenance:
sources(with id, author, usage count, last modified) and per-claim footnotes[^id] - trust:
generated: {by, at}andverified: [{by, at}], giving trust tiers unverified → machine-confirmed → human-reviewed (a human check older than the last rewrite doesn't count) - lifecycle:
status(draft/stable/deprecated),superseded_byandstale_after - attested computations: a sanctioned query a consumer must run as given, not rewrite
- reserved
index.md(directory listing; the root one can carryokf_version,title,description,license) andlog.md - extension keys must start with
x-<producer>-
- only
4b. Knowledge Catalog's export versus OKF v0.3
uv run tools/okf_check.py <bundle> on our pulled context set and on the GA4 bundle in Google's OKF repo. Full tables: 04-okf/okf-check-kc-bundle.md, 04-okf/okf-check-google-ga4-bundle.md. verified
KC context set via kcmd --format okf |
Google's OKF GA4 sample bundle | |
|---|---|---|
Frontmatter parses, type present |
8/8 | 9/9 concepts |
type values |
context-set, knowledge-base-index, knowledge-base, table-context |
BigQuery Dataset, BigQuery Table, Reference |
title / description |
0/8 | 9/9 |
Trust (generated, verified, sources) |
0/8 (the Studio job is kept in x-kcmd) |
generated + sources on 9/9 |
| Folder index files | documents.md next to documents/ (a concept, type: knowledge-base-index) |
documents/index.md style (reserved, no frontmatter) |
| Root | agents.md; no index.md, no okf_version |
index.md with okf_version: "0.3" |
| Citations | numbered [1] plus a "Source References" list (§4.2 says not to do this) |
footnotes [^id] joined to sources |
| Extension keys | x-kcmd (the spec's convention is x-<producer>-<name>) |
none |
What this means: a generic OKF consumer (for example the okf-consume skill) can read KC's export, but it gets no titles or descriptions to scan, and every page shows as "unverified". That holds even though a human approved each one in Studio, because the approval isn't written into the file as verified. The review happened, but the exported files don't record it. verified (fields absent) / impact on consumers is docs (§5.3)
4c. Write path 1: kcmd push (direct, unreviewed)
The workspace was a copy of the step 3 pull. We added a hand-written playbook, documents/playbook-final-daily-net-revenue.md (when to use, approach, SQL, traps; based on eval question 12), and edited the documents.md index to replace the dangling pitfalls row with the playbook.
- Dry run:
3 change(s): 1 create, 2 update, 0 delete, 5 unchanged. It also planned to writeagents.md, which we hadn't changed. 04-okf/push-dry-run.txt verified - First push was partial:
documents/playbook-...: Missing required Aspect(s): .../aspectTypes/documentthen "Pushed 2/3 change(s)". The index update was applied, but the page it points to wasn't. The push isn't atomic, so for a short time the published index linked to a missing page. 04-okf/push.txt verified - Fix: a hand-written page needs
x-kcmd.aspects: {dataplex-types.global.document: {}}in its frontmatter; Google'sdocumententry type requires that aspect. Second push: "Pushed 1/1 change(s)". 04-okf/push-2.txt verified - No review: the change request list was the same before and after (only Studio's
345f4080, APPROVED). Anyone withdataplex.contentEditoron the context set can change what agents read, without review. verified - Round trip: a fresh
kcmd init --kb ... --format okf --pullinto 04-okf/pull-after-push/ wrote 8 concepts. The playbook body came back byte-identical. The only other difference: the rootagents.mdnow saystype: context-set(it wasknowledge-base-root). verified Why is a guess: in step 3, kcmd's MCP server already reported the root's document type ascontext-setwhile the file saidknowledge-base-root, so kcmd seems to map the root's role and the push wrote that mapping back.
4d. Write path 2: change request by API (reviewed)
A second playbook, count engaged sessions (the correct session key, the three engagement rules, golden SQL 11), submitted as a change request. Request body: 04-okf/reviewed-route/request.json.
POST .../entryGroups/ga4-merch-context:requestBatchMetadataChangereturned change request919699e7-...:state: NEW,author= the user,labels: {source: human}. verified- The entry doesn't exist until approval (
GETreturns 404). verified - Approving it ourselves:
POST .../changeRequests/919699e7-...:approvereturned 403 PERMISSION_DENIED: "User is not authorized to approve their own ChangeRequest". The caller is project Owner, so the rule doesn't depend on roles: an author can never approve their own change. (Studio's change request was authored by the service account, which is why the user could approve it in step 3.) verified - We left it pending (NEW). The user chose not to set up a second account, so this playbook isn't published and isn't used in step 5. It's listed in cloud-resources.md.
4e. Where this leaves process context (playbooks)
- Format: OKF already has the right shape:
type: Playbook,# Trigger,# Steps, withgenerated/verifiedfor trust. Knowledge Catalog stores a playbook as adocumentpage and keeps no playbook-specific fields. docs / verified - Writing them: choose deliberately between the two routes:
kcmd pushis fast, git-friendly and unreviewed. It's fine if git pull requests are your review.- A change request gives a review gate where the author can't approve their own change. It has no CLI in kcmd 0.2.5; it's a raw API call.
- Studio as the writer: Studio can also draft playbook-like pages (step 3's
computing-standard-ecommerce-metrics), but it rewrites its inputs. Exact SQL that a team trusts is safer written by hand.
Commands to repeat this step (poc/04-okf/README.md)
Step 4: OKF and hand-written playbooks, commands
Results: results/04-okf.md. Run with export CLOUDSDK_ACTIVE_CONFIG_NAME=kc-okf; KCMD=~/apps/kc-okf/vendor/knowledge-catalog/toolbox/enrichment/node_modules/.bin/kcmd (0.2.5, Node 22 via nvm).
4a. The OKF spec and sample bundles (read-only)
cd ~/apps/kc-okf/vendor
git clone https://github.com/GoogleCloudPlatform/open-knowledge-format # deprecated 2026-11-18, at 8a8ff87
git clone https://github.com/open-knowledge-format/open-knowledge-format okf-v03 # v0.3 spec, at 527e81a
4b. Compare bundles with the spec
cd ~/apps/kc-okf
uv run tools/okf_check.py results/04-okf/pull-after-push/bundle results/04-okf/okf-check-kc-bundle.md
uv run tools/okf_check.py vendor/okf-v03/bundles/ga4 results/04-okf/okf-check-google-ga4-bundle.md
4c. Hand-written playbook through kcmd push (direct write, no review)
The workspace is a copy of the step 3 pull (results/03-studio/kcmd-okf). Add a page under bundle/documents/, with this frontmatter (the document aspect is required, or the push fails for that page):
---
type: knowledge-base
x-kcmd:
v: 1
entryType: projects/dataplex-types/locations/global/entryTypes/document
parentEntry: projects/kc-okf-poc-261122/locations/us/entryGroups/ga4-merch-context/entries/documents
entrySource:
location: us
labels:
source: human
aspects:
dataplex-types.global.document: {}
---
cd ~/apps/kc-okf/results/04-okf/workspace
$KCMD push --dry-run # shows creates / updates, sends nothing
$KCMD push # writes directly to the context set
# round trip: pull into a fresh folder and compare
mkdir -p ~/apps/kc-okf/results/04-okf/pull-after-push && cd ~/apps/kc-okf/results/04-okf/pull-after-push
$KCMD init --kb kc-okf-poc-261122.us.ga4-merch-context --format okf --pull
diff -r ../workspace/bundle bundle
4d. Hand-written playbook through a change request (reviewed)
request.json wraps one createEntryRequest (entry type document, the document aspect with type: knowledge-base, and the Markdown in the overview aspect) in changePayload: see results/04-okf/reviewed-route/request.json.
cd ~/apps/kc-okf && T=$(gcloud auth print-access-token)
curl -s -X POST -H "Authorization: Bearer $T" -H "x-goog-user-project: kc-okf-poc-261122" -H "Content-Type: application/json" \
"https://dataplex.googleapis.com/v1/projects/kc-okf-poc-261122/locations/us/entryGroups/ga4-merch-context:requestBatchMetadataChange" \
-d @results/04-okf/reviewed-route/request.json
# approving your own request is refused with 403 "not authorized to approve their own ChangeRequest"
curl -s -X POST -H "Authorization: Bearer $T" -H "x-goog-user-project: kc-okf-poc-261122" -H "Content-Type: application/json" \
"https://dataplex.googleapis.com/v1/projects/kc-okf-poc-261122/locations/us/changeRequests/919699e7-aa2f-42d9-9bb5-d1f1f8e4ee3b:approve" \
-d '{"comment":"reviewed"}'
Step 5: does the published context help a real agent?
What this step answers: take the context Studio produced and we approved (plus one hand-written playbook), give it to an ordinary agent built outside Google, and measure whether it answers data questions better. We also compare the two ways an outside agent can read the context: OKF files and kcmd's MCP server. Commands and code: poc/05-agent/README.md.
Run on 2026-11-23 (UTC). Everything here is verified unless marked.
Setup
- Agent: a LangGraph ReAct agent (
create_react_agent) on Gemini 3.5 Flash (Vertex AI,global, temperature 0). The instructions are identical in every setup: answer about theeventstable, check your result, and end with the final SQL. The only difference between setups is the context tools.
| Setup | Tools | What it can read |
|---|---|---|
| A: no context | get_table_schema, run_sql |
column names and types only |
| B: OKF files | A + list_files, read_file |
the published context set, pulled with kcmd init --kb ... --format okf --pull: 8 pages (Studio's 7 plus our playbook) |
| C: kcmd MCP | A + list-entries, lookup-entry from kcmd mcp (modify-entry removed) |
the same 8 pages, served as JSON over MCP |
- Questions: 15 (questions.json). Questions 1–12 are Studio's evaluation set, so Studio tuned its pages on them. Questions 13–15 are held out: Studio never saw them. Each one needs a policy rule: exclude
(data deleted)from attribution; cities are Tier C3, so report regions; and only final days, net of refunds. - Scoring (score.py): run the agent's final SQL and the golden SQL in BigQuery and compare the result sets (numbers within 0.5%). Other equally valid readings of a question count as alternates. A SQL that uses
geo.city/geo.metrowhere the policy forbids it fails. No final SQL fails. - One run per question per setup (45 runs). The user chose the smaller run to keep cost down. Gemini still varies at temperature 0, so a difference of one or two questions is within noise.
Results
| Setup | Strict pass | Reviewed pass | Held-out 13–15 | Uses partition filter | Broke the city rule | GB scanned | Avg tool calls | Input / output tokens (all 15) |
|---|---|---|---|---|---|---|---|---|
| A: no context | 6/15 | 6/15 | 0/3 | 9/15 | 2 | 44.9 | 12.7 | 1.0 M / 0.2 M |
| B: OKF files | 10/15 | 13/15 | 3/3 | 14/15 | 0 | 16.6 | 17.5 | 2.3 M / 0.3 M |
| C: kcmd MCP | 12/15 | 14/15 | 3/3 | 15/15 | 0 | 14.9 | 12.5 | 6.4 M / 1.0 M |
"Reviewed" counts answers that differ from the golden SQL only by a defensible reading. A person checked every failure; see the table below. Full per-run data: 05-agent/scores.csv, 05-agent/summary.md, raw runs (answers, SQL, tool calls) in 05-agent/runs-*.jsonl.
Per question
| Q | Question | A: no context | B: OKF files | C: kcmd MCP |
|---|---|---|---|---|
| 1 | Total sessions | ✅ | ✅ | ✅ |
| 2 | Daily active users, Dec 2020 | ✅ | ❌ ran out of steps (no final answer) | ✅ |
| 3 | Top 10 products added to cart | ✅ | ❌ (reviewed: ✅) grouped by name and item ID | ✅ |
| 4 | Top pages on 15 Jan 2021 | ✅ | ❌ (reviewed: ✅) page path instead of full URL | ❌ (reviewed: ✅) page path instead of full URL |
| 5 | Purchases per day, 1–7 Jan 2021 | ✅ | ✅ | ✅ |
| 6 | Net merch revenue, Dec 2020 | ❌ ran out of steps | ✅ | ✅ |
| 7 | Active buyers (28d) | ✅ | ✅ | ✅ |
| 8 | Users "by city", Jan 2021 | ❌ grouped by geo.city (policy broken) |
❌ right rule (regions) but only the top 10 rows | ✅ |
| 9 | Sessions by source, for attribution | ❌ didn't exclude (data deleted) |
❌ (reviewed: ✅) excluded it, also split by medium and dropped the last 3 days (the finality rule) | ❌ (reviewed: ✅) same as B |
| 10 | Cart conversion rate, Dec 2020 | ❌ events, not sessions | ✅ | ✅ |
| 11 | Engaged sessions, Jan 2021 | ❌ GA4's own definition | ✅ | ❌ used GA4's session_engaged flag, not the policy's definition |
| 12 | Daily net revenue, final days only | ❌ ran out of steps | ✅ (read the playbook) | ✅ |
| 13* | Sessions by medium, for attribution | ❌ didn't exclude (data deleted) |
✅ | ✅ |
| 14* | Top 5 cities by purchasers | ❌ grouped by geo.city (policy broken) |
✅ regions, and said why | ✅ |
| 15* | Net revenue, Jan 2021, final days only | ❌ ran out of steps | ✅ $57,001 | ✅ $57,001 |
* held out: not in Studio's eval set.
What we learned
-
The context works for an outside agent, including on questions Studio never saw. With the published pages, the same agent went from 6/15 to 10–12/15 (strict) and from 0/3 to 3/3 on the held-out policy questions. It followed rules that exist only in our made-up policy:
- it refused city-level output
- it excluded
(data deleted)from attribution - it dropped the 3 non-final days
- it subtracted refunds
Without context it broke the city rule twice and never applied the others. 2. The answers explain the policy, which is what you want from a governed agent. For "top 5 cities", setup B answered: "geographic fields such as
geo.cityandgeo.metroare classified as Tier C3 (Restricted). They must never be displayed directly at the city level ... this policy changes the question", and then returned regions. For December net revenue, both B and C gave $160,555 and noted the attribution-filtered figure separately. 3. Context makes queries cheaper. The partition filter went from 9/15 to 14–15/15, and BigQuery bytes scanned fell from 44.9 GB to about 15–17 GB (about 3× less), matching what Studio's own logs showed in step 3. 4. The agents read the pages the way the root page tells them to. Both setups opened the root (agents) first in all 15 runs, then the two topic pages, and the hand-written playbook in 12–14 of 15 runs. Theeventstable page was read less often (6 runs over MCP, 11 as files). The index-then-pages navigation works. 5. OKF files and MCP give the same knowledge; the difference is cost. Their pass rates are within noise of each other (10 vs 12 strict, 13 vs 14 reviewed). But MCP used about 3× the input tokens and 3.5× the output tokens: 6.4 M vs 2.3 M in, and about 190 s vs 92 s per question.lookup-entryreturns each page as a JSON document (escaped Markdown inside an aspect), and the agent's history grows with it. The files route is simpler and cheaper, which supports the recommendation in Where OKF fits. 6. What context didn't fix: - An agent can still prefer its own knowledge over the policy. C used GA4's built-insession_engagedflag for "engaged sessions" (Q11), although the policy defines it differently. Golden SQL questions like this are what catch it. - Long context makes the agent slower and can exhaust its step budget (B, Q2). 7. Failure modes with no context were silent. Four of A's runs ended in "Sorry, need more steps" after the model kept second-guessing itself. On Q15 it guessed what "final days" meant and never settled. A team building an agent without a context layer would see this as flakiness.
Caveats
- One run per question per setup. Treat B vs C as a tie; treat "with context" vs "without context" as a clear difference (the gap is large and consistent across questions, especially the held-out ones).
- Questions 1–12 were Studio's own eval set, so its pages are tuned to them. The held-out questions 13–15 are the fair check; all three need the policy, and both context setups passed all three.
- The scorer is strict by design. Golden SQL encodes one reading of each question; the reviewed column shows where a person would accept another reading. The rules are in score.py and the alternates are in questions.json.
- Throughput was limited by Vertex quota on this new project. The three setups ran in parallel and often hit 429s, which were retried with back-off. That's why the 45 runs took about 2.5 hours; the per-run times above exclude the waits.
- Cost: about 76 GB of BigQuery scans (about USD 0.48 on-demand, inside the free tier) plus about 10 M Gemini 3.5 Flash input tokens and 1.4 M output tokens. Check the Vertex price list for Gemini; we didn't look up the price.
Commands to repeat this step (poc/05-agent/README.md)
Step 5: agent test, commands
Results: results/05-agent.md.
A local LangGraph ReAct agent (create_react_agent) on Gemini 3.5 Flash (Vertex AI, location global, temperature 0), with the same instructions in each of three setups:
| Setup | Tools | Context |
|---|---|---|
| A: no context | get_table_schema, run_sql |
schema only |
| B: OKF files | A + list_files, read_file |
the published context set, pulled with kcmd init --kb ... --format okf --pull (results/04-okf/pull-after-push/bundle) |
| C: kcmd MCP | A + MCP tools from kcmd mcp (list-entries, lookup-entry; modify-entry removed) |
the same pulled snapshot, served over MCP (stdio) |
run_sql refuses queries that would bill more than 3 GB (maximum_bytes_billed). The step limit is 60 graph steps (about 30 tool calls). A run counts only if the agent ends with one final SQL code block.
Pinned versions (pyproject.toml, uv.lock): langgraph 1.2.24, langchain-google-genai 4.5.2, langchain-mcp-adapters 0.3.2, google-cloud-bigquery 3.47.0, Python 3.12.
cd ~/apps/kc-okf/poc/05-agent
export CLOUDSDK_ACTIVE_CONFIG_NAME=kc-okf # ADC must have the POC project as quota project
nvm use default # Node for kcmd (setup C)
uv sync
uv run python -W ignore agent.py B 15 # one question in one setup, prints the run
# all 15 questions, one process per setup (they run in parallel; Vertex 429s are retried with back-off)
for s in A B C; do nohup uv run python -W ignore run_all.py $s > ../../results/05-agent/progress-$s.log 2>&1 & done
# run every final SQL and every golden SQL in BigQuery and compare -> scores.csv, summary.md
uv run python -W ignore score.py
The questions, golden SQL, alternates (other equally valid readings) and policy checks are in questions.json. Questions 1 to 12 are Studio's eval set; 13 to 15 are held out: Studio never saw them.
Step 6: verdict, capability by capability
The question: can Google's Knowledge Catalog stack (Catalog, Knowledge Studio, kcmd, OKF) generate, review, publish and serve the context that data agents need, so a team doesn't have to build that layer itself?
Verdict values: use Google = it does the job as is; combine = use Google's piece plus a thin piece of our own; needs a custom piece = Google doesn't cover it today. All of this is based on one Preview run, one table, 2026-11-22/23.
The verdict table
| # | Capability | Verdict | Why (evidence) |
|---|---|---|---|
| 1 | Column descriptions, sensitivity class and PII flag from my policy document | needs a custom piece | Studio put every policy fact into prose pages (tiers C1/C2/C3, user_pseudo_id C2, geo.city C3), correctly and with citations. But it wrote no column descriptions, no sensitivity aspect and no PII flag: the BigQuery table entry still has 0 of 24 column descriptions. To get structured, column-level classification (for policy tags or masking), write it yourself (kcmd push of aspects, or the API). Step 3 |
| 2 | Glossary, ontology mapping, data rules | combine | The data rules came through well as prose (finality, attribution exclusion, geo aggregation, net revenue). No glossary terms or ontology were created. Studio can read glossaries as signals, and the context set has an "Ontology included in enrichment" field, but we didn't test it. A business glossary has to be authored separately. Step 3 |
| 3 | Per-item review, versions, approve, separate publisher, audit trail | combine | Strong: a per-page review (view, edit, remove, approve), and an author can never approve their own change (403 even for Owner). The change request records author, approver and comments, and change requests are scriptable. Weak: removals are erased (no "rejected" record), the index pages keep links to removed pages, kcmd push bypasses review, pushes aren't atomic, and we saw no version history of a page. Add a git-based review for hand-written context and a check that fails a change set with dangling links. Steps 3–4 |
| 4 | Evidence: which source text a statement came from | combine | Every page cites its sources as [n] with a reference list naming the document, and every tracer fact traced back to the policy doc. But citations are per page, not per claim, and not machine-readable: no OKF sources/footnotes and no link to the exact passage. The confidence score (83–87%) didn't catch a self-contradicting page. Treat Studio's citations as reviewer aids, not as provenance. Steps 3–4 |
| 5 | Serving to agents (MCP, APIs, context sets), NL-to-SQL with OKF | use Google (via OKF files) | Published context comes out as OKF Markdown with kcmd --format okf (the default layout fails), through kcmd's local MCP server, and through the REST API. Any agent, inside or outside Google, can read it. Measured in step 5: a local LangGraph agent went from 6/15 to 10–12/15 (strict) and from 0/3 to 3/3 on held-out policy questions with this context. OKF files and MCP scored the same within noise, but MCP used about 3× the tokens. Steps 3, 5 |
| 6 | Procedural knowledge (playbooks, skills) | combine | Studio drafts how-to pages itself (a "computing metrics" page with SQL). Hand-written playbooks work as ordinary document pages, through kcmd push (direct) or a change request (reviewed). There's no playbook type or behaviour in KC; OKF has type: Playbook. Author playbooks in git as OKF and push them; let Studio draft, but don't trust it with exact SQL. Step 4 |
| 7 | Nested schemas, cost and speed, Preview limits | use Google, with Preview caveats | Nested GA4 schema handled well (UNNEST patterns, session key). One run: 29 min, about 104k tokens (free in Preview), about USD 0.41 of BigQuery, plus about 5 min to create a task (the console doesn't say it's still creating). Preview limits: tasks are console-only (no API), Google's document type definition is unreadable (403), OKF moved out of Google mid-POC, and the run's query-history read failed with a 403 we couldn't explain. Steps 3–4 |
| 8 | Does a custom instruction close the column-coverage gap? (Studio run 2, step 7) | no: needs a custom piece | Asked explicitly for a description, tier and personal-data flag per field, glossary terms and one item per rule. Studio wrote more prose (24 of 24 columns instead of 12, tiers inline, a 5-term glossary section, 8 numbered rules; 4 right, 4 vague, 0 wrong on a 30-field sample) but still 0 column description fields, 0 glossary terms, 0 rule objects, and one wrong tier statement at 84% confidence. The pages still helped an outside agent: 12/15 strict with files and with MCP, 3/3 held-out. Ontology couldn't be tested: nothing sets it. Step 7 |
What I'd tell a team deciding whether to build or use Google
- Use Studio as the drafting engine, not the source of truth. It's genuinely good at turning scattered documents into agent-ready pages and proving, with your own eval set, that the pages change query behaviour. It found and used every fact we planted. Building that yourself means building document ingestion, grounding, an evaluation loop and a review UI.
- Keep the source of truth in git as OKF. Pull what Studio publishes (
kcmd init --kb ... --format okf --pull), commit it, and let your agents read those files. You get diffs, blame, rollback and portability. Hand-written playbooks live in the same tree. - Put one review gate in front of publishing, and make it the only one. Either git pull requests plus
kcmd push(fast, but the catalog won't enforce anything), or change requests through the API (the catalog enforces a two-person rule). Don't mix them without a rule:kcmd pushsilently skips the catalog's review. - Add the missing structure yourself where it matters for control. Column-level sensitivity and PII flags, policy tags and a glossary aren't produced. If masking or access control depends on them, generate them in your own pipeline (for example an LLM pass over Studio's prose; not tested here) and write them as aspects.
- Measure with your own questions. Studio's eval set is the best part of the product. Keep a held-out set it never sees, because its 100% on the questions it tuned for isn't the same as general accuracy. In step 5 the context passed all 3 held-out questions, but one setup still used GA4's own "engaged session" flag instead of the policy's definition, which only a golden-SQL check catches.
Comparing with a home-grown context agent
Your own agents (retriever over GCS docs plus embeddings, or an OKF-reading agent) do the same job. Compare on these dimensions; the right-hand column is what Google's stack did in this POC.
| Dimension | Question to ask of the custom agent | Google stack in this POC |
|---|---|---|
| Inputs | Which sources can it read? | GCS files, glossaries, BigQuery query history; connectors for Drive/Docs/Sheets/Slides, Confluence, Jira, GitHub, SharePoint (console list, not tested) |
| Grounding | Can every statement be traced to a source? | Per-page [n] citations; every planted fact traced; not per claim |
| Output shape | Prose, structured fields, or both? | Prose pages (root, indexes, table page, topic pages); no column fields |
| Evaluation | Does it test its own output against golden questions? | Yes: baseline vs projected on your eval set, plus SQL-behaviour change visible in logs |
| Review | Who approves, per item or all at once, and is it recorded? | Per page; two-person rule enforced for change requests; removals not recorded |
| Bypass | Can someone publish without review? | Yes, kcmd push with contentEditor |
| Serving | How does an agent read it? | OKF files, kcmd MCP (local), REST API; agents anywhere |
| Process knowledge | Where do playbooks live? | document pages; hand-written via push or change request |
| Freshness | How does it stay current? | Rerun the task (on demand or scheduled); pull again; self-learning option not tested |
| Cost and speed | Per run? | About 30 min; Preview tokens free; BigQuery bytes billed to you |
| Lock-in | Can you leave? | Yes: OKF export is plain Markdown (needs a light conversion for full OKF v0.3) |
To get comparable numbers, run the custom agent's context through the same harness: poc/05-agent/questions.json (15 questions with golden SQL, alternates and policy checks) and poc/05-agent/score.py. Add a setup to agent.py that gives the agent your context, then compare pass rates, especially on the held-out questions 13–15.
Step 7: Studio run 2, same inputs plus one custom instruction
The question: in run 1, Studio wrote prose pages only: no column description fields, no sensitivity or personal-data flags, no glossary terms, no separate rules. An in-house tool given the same schema and documents produces all of those, because its prompts ask for them. Is the gap the product, or just the missing instruction? Run 2 changes exactly one thing, the task's custom instruction, and measures the same things as run 1.
Run on 2026-11-24 (UTC). Labels: verified (run and observed), docs (from Google's documentation), guess (not checked).
Run 1 vs run 2 at a glance
| Measure | Run 1 (no instruction) | Run 2 (with instruction) |
|---|---|---|
Column descriptions as catalog fields (schema aspect in the context set, or the BigQuery entry) |
0 of 24 columns, 0 of 109 fields | 0 of 24, 0 of 109 (no schema aspect proposed) |
| Columns described in prose (table page) | 12 of 24 | 24 of 24 |
| Nested fields described in prose (85) | 0 | 4 (geo.city, geo.metro, ecommerce.purchase_revenue_in_usd, ecommerce.refund_value_in_usd) |
| Sensitivity tier per column | only on a separate policy page, by group | inline for 5 columns; wrong for the other 19 on the table page ("no assigned policy tier"; the policy says C1) |
| Personal-data flag | none | prose, 5 columns (C2 personal, C3 "quasi-identifying personal", C1 "non-personal") |
| Glossary terms (Knowledge Catalog objects) | 0 | 0 (no glossary created in us or global) |
| Glossary terms in prose | 4 metric definitions | a "Business Glossary & Metric Definitions" section: 5 terms, all correct |
| Data rules | folded into "How to query" bullets | 8 numbered rules in a Governance section (still prose, not separate items) |
| 14 planted policy facts | 14/14 | 14/14 |
| Description accuracy, 30 fixed fields | 1 right, 1 vague, 0 wrong, 28 not described | 4 right, 4 vague, 0 wrong, 22 not described |
| Proposals | 9 creates (8 pages + 1 link), 4 scored High | 8 creates (7 pages + 1 link), 3 scored High |
| Run time / tokens | 29 min 12 s / 104,025 | 32 min 39 s / 107,845 |
| BigQuery | 209 jobs, 65.2 GB, about USD 0.41 | 217 jobs, 63.9 GB, about USD 0.40 |
| Studio eval (baseline → projected) | 67% (8/12) → 100% | 50% (6/12) → 100% |
| Confidence (Studio's own) | 83–87%, High | 84% overall; events 84, pitfalls 86, metrics 87 |
| Agent test, strict (of 15): files / MCP | B 10 / C 12 (Studio's pages + our playbook) | B2 12 / C2 12 (Studio's pages only) |
| Agent test, reviewed / held-out 13–15 | 13, 14 / 3/3, 3/3 | 14, 13 / 3/3, 3/3 |
Answer: the instruction changed how much Studio wrote, not what kind of thing it wrote. Every output is still a Markdown page (document + overview aspects). The instruction can't make Studio fill column description fields, create glossary terms, or emit rules as separate objects. verified (change request and context set read through the API). That matches the docs: enrichment tasks "don't overwrite descriptions on underlying BigQuery resources or create business glossary terms" (docs, About enrichment tasks).
Setup (identical to run 1 except the instruction)
- New context set
ga4-merch-context-r2inus; taskga4-events-enrichment-r2inus-central1; resource theeventstable only; knowledge signal the whole signals bucket (Google's 8 sample docs plus our policy); same 12-question evaluation set; no curation set, no glossaries, no external sources; auto-publish off, self-learning off; service accountkc-studio-enricher. verified (screenshots below) -
The instruction (the wizard calls it custom instructions, the docs call it the task's goal):
For every column and nested field of the events table, write a description and record its sensitivity tier and whether it is personal data, as stated in the data policy. Also propose business glossary terms with definitions for the policy's metrics and concepts, and state each data rule from the policy as its own item.
-
Ontology setting left empty, as in run 1. The context set's Edit form has no ontology field (only name, ID, description, location, labels), and the task wizard has none either. The docs don't mention ontology at all. So "Ontology included in enrichment" on the context set page is read-only in the console, and we couldn't find what sets it. verified (console) / docs (searched the enrichment, context-set and release-notes pages)
- Self-learning stayed off. It learns from real conversations with Google's data agents; this project has none, and turning it on would change a second variable.
- New on the Run page: a checkbox "Grant access to BigQuery query history (roles/bigquery.resourceViewer)". Left unticked: the service account already has that role at project level. verified
What happened
- Create was fast this time and didn't start a run.
CreateAgentTaskfinished in about 10 seconds (run 1: 4.5 minutes). As in run 1, Create only makes the task; nothing runs until Run now (RunAgentTaskat 19:38:44 UTC). The wizard's "On Run, a new Enrichment job will be started" is misleading. verified (audit logs) - Run
94165469-4f79-4922-ab13-83c9b2bb1d77: started 19:39:13, succeeded 20:11:52 UTC. Same 7-stage pipeline as run 1. Summary: "High confidence overall: 3 proposals scored across 8 changes -- 3 High, 0 Medium, 0 Low." Tokens 84,339 in, 23,506 out, 107,845 total. Model in the log:gemini-3.8-flash. Timeline: 07-studio-run2/run2-agent-log.md. verified - The instruction became the run's topic. The log says
Topic: Document column descriptions, sensitivity tiers, and personal data flags for the events table, and define business glossary terms and data rules from the data policy, and thedocumentsindex page repeats that sentence as its description. verified - Same query-history 403 as run 1 (
bigquery.jobs.listAll), although the account hasroles/bigquery.resourceViewer. Still unexplained. verified / cause guess - A hint of a semantic-model feature:
Semantic model step skipped on a measured turn. Run 1's log has the same line. It may be what the ontology setting feeds (guess). - BigQuery: 217 jobs by the service account, 1 error, 63.9 GB billed (about USD 0.40 on demand, inside the free tier); 24 jobs scanned over 1 GB. Every job and its SQL: 07-studio-run2/run2-bq-jobs.csv. verified
The proposals and the review
Change request 9b4cc44a-6806-44ff-8861-8f02cf21fa0f (author the service account, state NEW, 8 creates): run2-change-request.json. Each page as proposed: 07-studio-run2/run2-proposals/.
| Entry | Type | Size (chars) |
|---|---|---|
agents |
knowledge-base-root | 2,222 |
assets |
knowledge-base-index | 292 |
assets/bigquery/kc-okf-poc-261122/ga4_sample |
knowledge-base-index | 288 |
assets/bigquery/kc-okf-poc-261122/ga4_sample/events |
table-context | 8,991 |
documents |
knowledge-base-index | 789 |
documents/calculating-core-metrics |
knowledge-base | 4,974 |
documents/pitfalls |
knowledge-base | 5,559 |
link events → events |
entry link reference |
Every page carries only the document and overview aspects: the console's proposal viewer says "2 aspects change: Overview, Document aspect" for the table page, which scored 84% confidence. The column list the viewer shows is Markdown inside the Overview aspect, not the table's schema. Run 1 had a third topic page (data-governance-and-quality-boundaries); in run 2 its content moved into the table page's Governance section.
Approved all 8, flaws included, so the agent test measures what Studio produced. State APPROVED at 20:24:27 UTC: run2-change-request-after-approve.json (email redacted). verified
Flaws a reviewer should have caught (verified, by reading):
- Tier contradiction. The table page says columns not named in the policy "carry standard metadata without an assigned policy tier". The policy says "everything else: Tier C1", and the other two pages say so correctly. Same kind of flaw as run 1's
pitfalls: confident pages that disagree. - Missing SQL.
pitfallssays "The snippet demonstrates safe partition boundaries…" with no snippet.calculating-core-metricshas a heading "SQL Pattern: Unnesting Sessions and Items" with no SQL, and its Method list jumps from step 1 to step 4. Run 1's pages kept their SQL (a fenced code block in each of 2 pages; run 2: 0 code blocks in all 7 pages, verified by count). guess: a redaction or size step in "Finalizing models and redaction" removed code blocks. - A meaningless description:
event_value_in_usdis "Monomorphic event value." - Personal data inferred beyond the policy:
geo.city/geo.metroare called "quasi-identifying personal data" (the policy says only "restricted"), whileuser_id(a signed-in user's ID) isn't flagged at all. Neither is in the policy.
What I measured
Column coverage, both ways
- Catalog fields: after approval, the context set has 7 entries with only
documentandoverviewaspects: 0schemaaspects, so 0 field slots. The real BigQuery entry still has 0 of 24 columns and 0 of 109 field paths described, and its overview is still kcagent's text from step 2. verified (run2-snapshot/summary.md, tool tools/dump_context_set.py; run 1 for comparison: run1-snapshot/summary.md) - Prose: the table page lists all 24 columns with type and a one-line description (run 1: 24 listed, 12 with text). Nested fields: 4 of 85 named individually, plus "Other
geo.*fields: standard regional and country geographic descriptors". verified
Tiers and personal data
| Column (policy) | Policy tier | Run 2 table page | Structured? |
|---|---|---|---|
user_pseudo_id |
C2 | C2, "personal data" | prose |
geo.city, geo.metro |
C3 | C3, "quasi-identifying personal data" | prose |
device.* |
C1 | C1, "non-personal" | prose |
traffic_source.* |
C1 | C1, "non-personal" | prose |
| everything else (19 columns) | C1 | "without an assigned policy tier" (wrong) | prose |
The 14 planted policy facts
All 14 appear in run 2's own text (grep over the proposed pages): MSC-417, Merch Store Clickstream, Digital Insights Guild, #msc-417-data, 72-hour finality, tiers C1/C2/C3, 14-month retention, engaged session > 10 s, active buyer 28d, net revenue minus refunds, (data deleted), event_date_dt, 2020-11-01, 92 days. verified
Glossary, rules and ontology
- Glossary: no Knowledge Catalog glossary or term was created (
glossarieslist is empty inusandglobal). In prose: 5 terms (Engaged Session, Session Identification, Active Buyer (28d), Net Merch Revenue, Cart Conversion Rate). The policy's 4 metrics are all present and correct; "Session Identification" is a fair addition from the policy's engaged-session line. verified - Rules: 8 numbered rules in the table page's Governance section: C2 export/CRM ban, C3 geographic roll-up, C1 classification, 14-month retention, 72-hour finality, USD only,
(data deleted)exclusion, partition filter. The policy's ninth rule (data covers 2020-11-01 to 2021-01-31 only) is under Data Quality instead. No rule was invented that the documents don't support. Still one prose page, not separate items. verified - Ontology: not tested (run 2b), because no console screen sets it; see Setup.
Description accuracy on 30 fixed fields
Against Google's published GA4 export schema: run 2 got 4 right, 4 vague, 0 wrong, 22 not described (run 1: 1, 1, 0, 28). Almost everything below the top level is left out. Every pair is in field-accuracy-30.md; Google's text in google-schema-30-fields.md. verified
Studio's own evaluation (read from the console)
The run page now has four tabs, Overview, Evaluation, Artifacts, Logs (run 1's page showed Overview and Logs). Read on 2026-11-24 from the console; Studio's eval and confidence numbers aren't in Cloud Logging or any bucket, and there's no public API for runs. verified
- End-to-end evaluation: baseline 50% (6 of 12), projected 100% (12 of 12), delta +6. Run 1, with the same eval set, same table and no context either time, had a baseline of 67% (8 of 12). So the "before" score moved by 2 questions between two runs with identical inputs: Studio's baseline is noisy, and its delta should be read as "roughly", not exactly.
- How it grades: agent
local:in_process_target_agent, metric "Data result accuracy". Each case has a written reason that cites a rubric ("permitted under rubric rule 8", "acceptable per criteria 6"): an LLM judge comparing the agent's SQL with the golden SQL. Our step 5 scorer runs both queries and compares the results instead. - Per case: baseline failed and enriched passed on cases 3, 5, 7, 8, 9 and 11 (top pages, net revenue, users by city, attribution, cart conversion, final-days net revenue). Still passing: 0, 1, 2, 4, 6, 10. Case 10 (engaged sessions, which needs the policy definition) passed at baseline too, which our step 5 scorer would likely not accept (guess: the judge accepted GA4's own definition).
- Artifacts tab: Learnings ("No learnings are available for this run", presumably fed by self-learning, which is off) and Confidence scores: overall High (84);
events84,pitfalls86,calculating-core-metrics87; "4 index pages are not rated". The reason given for all three is "Every statement traces to a source the run read". The table page's wrong tier claim and the missing SQL snippets didn't lower any score: confidence measures grounding, corroboration and source quality, not correctness. - The instruction was stored in full (task Details tab shows the whole text under Custom instructions), so it wasn't cut off.
Agent test (B2, C2)
Same harness, questions and scorer as step 5; one run per question. Run 2's context set was pulled as OKF (kcmd init --kb kc-okf-poc-261122.us.ga4-merch-context-r2 --format okf --pull: 7 pages, kcmd-okf/) and served by kcmd mcp for C2. Unlike step 5's B and C, there's no hand-written playbook: the user chose to test Studio's pages alone. Raw runs: agent/runs-B2.jsonl, agent/runs-C2.jsonl; scores: agent/summary.md. verified
| Setup | Strict pass | Reviewed pass | Held-out 13–15 | Partition filter | Broke the city rule | GB scanned | Input / output tokens (all 15) |
|---|---|---|---|---|---|---|---|
| A: no context (step 5) | 6/15 | 6/15 | 0/3 | 9/15 | 2 | 44.9 | 1.0 M / 0.2 M |
| B: run 1 + playbook, files (step 5) | 10/15 | 13/15 | 3/3 | 14/15 | 0 | 16.6 | 2.3 M / 0.3 M |
| C: run 1 + playbook, MCP (step 5) | 12/15 | 14/15 | 3/3 | 15/15 | 0 | 14.9 | 6.4 M / 1.0 M |
| B2: run 2, files | 12/15 | 14/15 | 3/3 | 14/15 | 0 | 24.2 | 2.0 M / 0.2 M |
| C2: run 2, MCP | 12/15 | 13/15 | 3/3 | 13/15 | 0 | 26.1 | 2.5 M / 0.5 M |
Failures (each checked by reading the SQL):
- Defensible readings (counted in "reviewed"): Q4 B2 grouped by page path instead of full URL (as B and C did in step 5); Q9 B2 and C2 split sessions by source and medium and campaign (8 rows vs 4), with
(data deleted)correctly excluded. - Real failures, all "no final answer": B2 Q2 stopped mid-thought without SQL; C2 Q3 ran out of steps after 29 tool calls (970 s); C2 Q11 (engaged sessions) stopped while still deciding how to measure session duration.
What it shows:
- Run 2's pages work at least as well as run 1's pages plus our playbook. Strict: B2 12 vs step 5's B 10, C2 12 vs C 12; both setups again passed all three held-out policy questions (final days, regions not cities,
(data deleted)). Q12 and Q15 ("final days only") passed without the playbook, because run 2's pages state the 72-hour rule plainly. With one run per question, treat it as "no worse", not "better". - The agents read differently. Every run opened
agents,pitfallsandcalculating-core-metrics; the table page was read in 11 (B2) and 9 (C2) of 15 runs. The longer column list on the table page didn't change any result we could see. - MCP was far cheaper this time: 2.5 M input tokens (step 5's C: 6.4 M), because C2 looked up about 5 pages per question instead of re-reading many. Files and MCP are now close in cost and equal in accuracy.
- More bytes scanned (24–26 GB vs 15–17 GB) though the partition filter was used as often; the agents ran more exploratory queries. guess: run 2's pages have no SQL examples (the code blocks were dropped), so the agents worked out the SQL themselves.
Verdict on the question
The gap is the product, not the missing instruction. With an explicit instruction, Studio wrote more and better prose (all 24 columns, tiers inline, a glossary section, numbered rules) and the context worked as well for an outside agent. But it still produced no column description fields, no sensitivity or personal-data fields, no glossary terms, no separate rule objects and no ontology mapping. Those need the custom piece from verdict row 1, or a pipeline that turns Studio's prose into aspects and glossary terms (not tested). A team comparing Studio with an in-house tool that fills 109 of 109 fields should compare coverage and correctness of prose (Studio: 28 of 109 field paths in prose, 24 columns plus 4 nested, 0 wrong in a 30-field sample, one wrong tier statement) and accept that Studio's structured output is zero.
Ontology (run 2b) wasn't run: there is no console screen, API field or doc page for "Ontology included in enrichment" as of 2026-11-24.
Commands to repeat this step (poc/07-studio-run2/README.md)
Step 7 commands: Studio run 2 (custom instruction)
Run from the repo root with the gcloud profile active: export CLOUDSDK_ACTIVE_CONFIG_NAME=kc-okf. Results: results/07-studio-run2.md.
7a. Console (no API for tasks)
- Context sets > Create:
ga4-merch-context-r2, location multi-regionus. -
Enrichments > Create enrichment task:
ga4-events-enrichment-r2. Every setting is the same as run 1 (step 3) except Custom instructions:text For every column and nested field of the events table, write a description and record its sensitivity tier and whether it is personal data, as stated in the data policy. Also propose business glossary terms with definitions for the policy's metrics and concepts, and state each data rule from the policy as its own item. -
Create, open the task, Run now (Create doesn't start a run). Review and approve the change request in the run page when it says Needs review.
7b. Read what the run produced (read-only)
# run log from Cloud Logging
python3 tools/export_run_log.py 94165469-4f79-4922-ab13-83c9b2bb1d77 results/07-studio-run2/run2-agent-log
# the change request (proposals) before and after approval
T=$(gcloud auth print-access-token)
curl -s -H "Authorization: Bearer $T" "https://dataplex.googleapis.com/v1/projects/kc-okf-poc-261122/locations/us/changeRequests/9b4cc44a-6806-44ff-8861-8f02cf21fa0f" > results/07-studio-run2/run2-change-request.json
# snapshot: every entry and aspect, entry links, glossaries, and the BigQuery table's column descriptions
python3 tools/dump_context_set.py ga4-merch-context-r2 results/07-studio-run2/run2-snapshot
python3 tools/dump_context_set.py ga4-merch-context results/07-studio-run2/run1-snapshot
BigQuery jobs of the run: bq ls -j -a for the window 19:38–20:13 UTC, filtered to kc-studio-enricher (run2-bq-jobs.csv). Studio's eval and confidence numbers are only in the console (run page, tabs Evaluation and Artifacts).
7c. Agent test on run 2's context (B2, C2)
# pull run 2's context set as OKF files (Node 22 via nvm)
KCMD=$PWD/vendor/knowledge-catalog/toolbox/enrichment/node_modules/.bin/kcmd
mkdir -p results/07-studio-run2/kcmd-okf && cd results/07-studio-run2/kcmd-okf
$KCMD init --kb kc-okf-poc-261122.us.ga4-merch-context-r2 --format okf --pull
cd ../../..
# run setups B and C of step 5 against this bundle; results go to results/07-studio-run2/agent as B2 and C2
cd poc/05-agent
export KC_BUNDLE=$HOME/apps/kc-okf/results/07-studio-run2/kcmd-okf KC_RUNS_DIR=results/07-studio-run2/agent KC_TAG=2
uv run python -W ignore run_all.py B > ../../results/07-studio-run2/agent/progress-B2.log 2>&1 &
uv run python -W ignore run_all.py C > ../../results/07-studio-run2/agent/progress-C2.log 2>&1 &
wait
KC_RUNS_DIR=results/07-studio-run2/agent uv run python -W ignore score.py
The three KC_* variables are optional; without them the harness behaves exactly as in step 5.
For AI agents: what this repo is and the facts it holds
You're reading the record of a proof of concept (POC) run on 2026-11-22/23. It evaluated Google Knowledge Catalog (Dataplex), Knowledge Studio enrichment (Preview), kcmd 0.2.5, kcagent (Google's sample agent) and OKF (Open Knowledge Format) as a context layer for data agents. The main use case is natural-language-to-SQL over BigQuery. Use this file to answer questions about the POC or to compare Google's approach with a home-grown context agent. Every claim in the results files is labelled verified (run and observed), docs (from documentation or a spec) or guess (not checked). Keep those labels when you repeat a claim.
Where things are
| Path | What |
|---|---|
report.html |
Everything below rendered as one page, with screenshots and diagrams (built by uv run tools/build_report.py) |
knowledge-context.html |
Hand-written visual explainer (not generated): Knowledge Catalog by hand, the KC MCP server, Studio, aspects, OKF and kcmd, when to use each. Uses facts from here and from zkrsyed/agent-platform-poc lessons 3, 5 and 26 (Citi Bike) |
docs/start-here.md |
Two-minute summary and reading guide |
results/0N-*.md |
What happened in step N, with evidence; results/0N-*/ holds raw outputs |
poc/0N-*/README.md |
Exact commands for step N |
docs/context-layer.md |
Where KC, Studio, kcmd and OKF sit in an agent's context layer; how outside agents read it; playbooks |
results/06-verdict.md |
Verdict per capability, and a comparison checklist for custom agents |
results/07-studio-run2.md |
Studio run 2: does a custom instruction produce column fields, glossary terms and rules? |
results/cloud-resources.md |
Every cloud resource created and how to remove it |
docs/screenshots/<step>/ |
Console screenshots (personal details removed) |
vendor/ |
Git-ignored third-party checkouts (pinned commits are recorded in results) |
Environment (public sample only; no work data)
- GCP project
kc-okf-poc-261122(number 109873812728), catalog locationus, Studio task regionus-central1. - Data:
kc-okf-poc-261122.ga4_sample.events. One table built from Google's publicbigquery-public-data.ga4_obfuscated_sample_ecommerce.events_*: 4,295,584 rows, 2020-11-01 to 2021-01-31 (92 days), partitioned onevent_date_dt, heavily nested (109 field paths). - Tracer facts come from a made-up policy document (
poc/03-studio/signals/merch-store-data-policy.md) that exists nowhere else: dataset code MSC-417, owner "Digital Insights Guild", channel#msc-417-data, data final 72 hours after the day ends, tiers C1/C2/C3 (user_pseudo_idC2, never export or join with CRM;geo.city/geo.metroC3, region/country only), 14-month retention, engaged session (>10 s, or 2+ page views, or a purchase), active buyer 28d, net merch revenue = purchase revenue in USD minus refunds in USD, excludetraffic_source.source = '(data deleted)'from attribution.
Key results (all verified unless marked)
Raw catalog (step 1). Google auto-creates entries with the schema, but overview, column descriptions, keys, semantic types and glossary terms are all empty. Catalog search doesn't find tables in other projects.
kcagent (step 2).
- It needed 2 patches to run in a new project (errors were silently dropped; the hard-coded
gemini-2.5-flashreturned 404). - It has no retry on 429.
- It writes one Markdown overview per entry. Two identical runs shared 0 sentences.
- Its SQL examples were valid 8/8 for the table but invalid 8/8 for the dataset.
Studio run 1 (step 3).
- Inputs: Google's 8 sample docs plus the policy doc (GCS signal), and a 12-question golden-SQL eval set.
- It ran 29 min 12 s, used 104,025 tokens (free in Preview), and ran 209 BigQuery jobs (65.2 GB, about USD 0.41).
- Studio's own eval: baseline 67% (8/12), projected 100% (12/12).
- The agent's SQL before and after its own context: partition filter 49% → 95%; scans over 1 GB 30 → 1;
(data deleted)excluded 0 → 15. - It proposed 9 creates in one change request: a root page, 3 index pages, a table page, 3 topic pages and 1 entry link.
- Every tracer fact appeared, cited as
[n]to the policy doc. Confidence: 83–87% "High". - One page (
pitfalls) contradicted itself, yet scored 83%.
Review (steps 3–4).
- Per-page approve or remove. Removed pages are erased, not counted as "rejected", and the index pages still link to them.
- Approval needs
dataplex.changeRequests.use(rolesworkflowApprover,workflowAdmin,catalogAdmin,dataplex.admin, basic Editor/Owner).dataplex.editorcan run tasks but not approve. - Authors cannot approve their own change request:
403 "User is not authorized to approve their own ChangeRequest", even as Owner. - The
approverEmailsfield on a context set only notifies; it doesn't restrict who approves (docs). - Change requests have a REST API (
get/list/approve/reject/delete,entryGroups:requestBatchMetadataChange). Studio tasks have none (agentTaskshas IAM methods only).
Where Studio's output lives. Only as document entries inside the context set (entry group type context-set). The real BigQuery table entry still has 0 of 24 column descriptions; Studio wrote no column descriptions, sensitivity aspects or glossary terms.
Reading context out (step 3).
kcmd init --kb <project>.<location>.<context-set> --pull(default layout) pulls nothing:GET entryTypes/documentreturns 403, and kcmd 0.2.5 treats that as fatal for the type.--format okfworks: 7–8 Markdown files with YAML frontmatter (typeplus anx-kcmdblock) and_links.yaml.kcmd mcpserveslist-entries(names only),lookup-entry(JSON with the page inaspects["dataplex-types.global.overview"].content) andmodify-entry(a write). There's no tool for entry links, and the README'spull/pushMCP tools andkcmd statusdon't exist in 0.2.5.- Studio names the root page
agents.md; kcmd treatsagents.mdandindex.mdas interchangeable roots.
OKF (step 4).
GoogleCloudPlatform/open-knowledge-formatwas deprecated on 2026-11-18. OKF moved toopen-knowledge-format/open-knowledge-format(spec v0.3, with agent skillsokf-consumeandokf-generate).- KC's export is only loosely OKF. It parses, but has no
title,description,generated,verified,sourcesorindex.md, and it cites with[n]lists instead of footnotes. So an OKF consumer treats every page as "unverified", even after human approval in Studio. - OKF has a first-class
type: Playbook(docs).
Writing context by hand (step 4).
kcmd pushwrites directly (batchChangeMetadata), with no change request.- Pushes are not atomic: the first push applied 2 of 3 changes and rejected a page that lacked the
dataplex-types.global.documentaspect. - The reviewed route is
requestBatchMetadataChange. It creates a change request in state NEW, and nothing is published until a different person approves.
Agent test (step 5). Strict pass rates: A 6/15, B 10/15, C 12/15. Reviewed for defensible readings: 6, 13, 14. Held-out questions 13–15: A 0/3, B 3/3, C 3/3.
- The city rule was broken twice by A and never by B or C.
- The partition filter was used in 9 / 14 / 15 of 15 runs, and GB scanned was 44.9 / 16.6 / 14.9.
- MCP used about 3× the tokens of the files route for the same accuracy.
- Both context setups opened agents first in 15 of 15 runs, and read the hand-written playbook in 12–14 runs.
- Details are in results/05-agent.md.
Studio run 2 (step 7, 2026-11-24). Same inputs as run 1 plus one custom instruction asking for a description, tier and personal-data flag per field, glossary terms, and one item per rule.
- Still only
document+overviewaspects: 0 column description fields, 0 glossary terms, 0 rule objects; the BigQuery entry still has 0 of 24 columns described. Docs agree: enrichment "doesn't create business glossary terms". - More prose: 24 of 24 columns (run 1: 12), 4 of 85 nested fields, tiers inline for 5 columns (but "no assigned tier" for the rest, which contradicts the policy's C1), a 5-term glossary section, 8 numbered rules. 30-field sample vs Google's schema text: 4 right, 4 vague, 0 wrong, 22 not described.
- Studio eval baseline 50% (run 1: 67%, same inputs, so the baseline is noisy) → projected 100%; confidence 84–87%; graded by an LLM judge. 32 min 39 s, 107,845 tokens, 63.9 GB BigQuery.
- Agent test on run 2's pages only (no playbook): B2 12/15, C2 12/15 strict, 3/3 held-out each, city rule never broken; MCP cost 2.5 M input tokens.
- "Ontology included in enrichment" can't be set from the console, API or docs. Details in
results/07-studio-run2.md.
The setup:
- a local LangGraph ReAct agent on Gemini 3.5 Flash (Vertex)
- 15 questions: Studio's 12, plus 3 held out
- three setups: A, schema only; B, the published context as OKF files; C, the same pages via
kcmd mcp - scoring: the final SQL result is compared with golden SQL in BigQuery
How to compare this with a custom context agent
Use results/06-verdict.md → "Comparing with a home-grown context agent". It lists the dimensions (input sources, grounding and citations, review gate, separation of duties, freshness, serving path, playbooks, evaluation, cost and latency, lock-in) and what Google's stack did on each in this POC. Run the same 15 questions (poc/05-agent/questions.json, golden SQL included) against the custom agent's context with poc/05-agent/score.py to get comparable numbers.
Caveats
- One Studio run, one table, one dataset (public, obfuscated). Studio is in Preview and changes week to week.
- Step 5 ran each question once per setup, to keep cost low. Gemini at temperature 0 still varies between runs, so treat a difference of one or two questions as noise.
- Questions 1–12 were Studio's own eval set, so its context was tuned on them; questions 13–15 are the fair held-out check.
Cloud resources created
Every resource this POC creates, and how to remove it. Remove resources by hand only after review. Deleting the whole project removes everything listed here.
| When | Resource | How to remove |
|---|---|---|
| 2026-11-22 | Project kc-okf-poc-261122 (number 109873812728), no organization |
gcloud projects delete kc-okf-poc-261122 (30-day recovery window). Removes everything inside the project, but not the budget. |
| 2026-11-22 | Billing link to the user's existing billing account | gcloud billing projects unlink kc-okf-poc-261122 |
| 2026-11-22 | Budget kc-okf-poc (20, alerts at 50/90/100 %) on billing account the user's existing billing account, scoped to this project |
Console: Billing > Budgets & alerts > delete. Lives on the billing account, so deleting the project does not remove it. |
| 2026-11-22 | BigQuery dataset ga4_sample (location US) |
bq rm -r -d kc-okf-poc-261122:ga4_sample (asks to confirm; removes its tables too) |
| 2026-11-22 | Service account kc-studio-enricher@kc-okf-poc-261122.iam.gserviceaccount.com (step 3: Studio's agent runs as it) |
gcloud iam service-accounts delete kc-studio-enricher@kc-okf-poc-261122.iam.gserviceaccount.com |
| 2026-11-22 | Project IAM: kc-studio-enricher gets serviceusage.serviceUsageConsumer, bigquery.dataViewer, bigquery.resourceViewer, bigquery.jobUser, dataplex.catalogViewer, dataplex.catalogEditor, dataplex.contentEditor |
Removed when the service account is deleted, or per role: gcloud projects remove-iam-policy-binding kc-okf-poc-261122 --member=serviceAccount:kc-studio-enricher@kc-okf-poc-261122.iam.gserviceaccount.com --role=roles/ROLE |
| 2026-11-22 | Dataplex service agent identity service-109873812728@gcp-sa-dataplex.iam.gserviceaccount.com (created/ensured with gcloud beta services identity create) |
Google-managed; goes with the project. Nothing to remove. |
| 2026-11-22 | On service account kc-studio-enricher: Dataplex service agent gets roles/iam.serviceAccountTokenCreator (lets Studio run as our account) |
Removed with the service account, or gcloud iam service-accounts remove-iam-policy-binding kc-studio-enricher@kc-okf-poc-261122.iam.gserviceaccount.com --member=serviceAccount:service-109873812728@gcp-sa-dataplex.iam.gserviceaccount.com --role=roles/iam.serviceAccountTokenCreator |
| 2026-11-22 | Project IAM: Dataplex service agent gets roles/bigquery.dataViewer (Studio docs ask for it on the target data) |
gcloud projects remove-iam-policy-binding kc-okf-poc-261122 --member=serviceAccount:service-109873812728@gcp-sa-dataplex.iam.gserviceaccount.com --role=roles/bigquery.dataViewer |
| 2026-11-22 | Cloud Storage bucket gs://kc-okf-poc-261122-signals (location US): Studio's knowledge signals |
gcloud storage rm -r gs://kc-okf-poc-261122-signals (removes the files and the bucket) |
| 2026-11-22 | Bucket IAM: kc-studio-enricher gets roles/storage.objectViewer on gs://kc-okf-poc-261122-signals |
Removed with the bucket, or gcloud storage buckets remove-iam-policy-binding gs://kc-okf-poc-261122-signals --member=serviceAccount:kc-studio-enricher@kc-okf-poc-261122.iam.gserviceaccount.com --role=roles/storage.objectViewer |
| 2026-11-22 | Dataplex context set ga4-merch-context (entry group, location us), created in the Studio console |
Console: Knowledge Studio > Context sets > Delete, or gcloud dataplex entry-groups delete ga4-merch-context --location=us (guess: not yet tried) |
| 2026-11-22 | Project IAM: my user account gets roles/dataplex.contentEditor (Owner cannot read context sets) |
gcloud projects remove-iam-policy-binding kc-okf-poc-261122 --member=user:YOUR_EMAIL --role=roles/dataplex.contentEditor |
| 2026-11-22 | Cloud Storage bucket gs://kc-okf-poc-261122-eval (US): eval set, kept apart from the signals; kc-studio-enricher has roles/storage.objectViewer on it |
gcloud storage rm -r gs://kc-okf-poc-261122-eval |
| 2026-11-22 | Knowledge Studio enrichment task ga4-events-enrichment (us-central1), run 1 d3704062-... |
Console: Knowledge Studio > Enrichments > ga4-events-enrichment > Delete (not scriptable: the agentTasks API has IAM methods only) |
| 2026-11-22 | Change request 345f4080-... (state APPROVED) and the 7 published document entries + 1 entry link inside ga4-merch-context |
Removed with the context set (guess); entries can also be deleted one by one from the console |
| 2026-11-23 | Context set entry documents/playbook-final-daily-net-revenue (pushed with kcmd push, step 4); the documents and agents entries were updated by the same push |
Removed with the context set (guess); or delete the page in the console |
| 2026-11-23 | Change request 919699e7-... (state NEW, authored by the user: the engaged-sessions playbook, never approved) |
curl -X DELETE .../changeRequests/919699e7-aa2f-42d9-9bb5-d1f1f8e4ee3b (an author can delete a NEW request with dataplex.changeRequests.delete; guess, not tried) |
| 2026-11-24 | Dataplex context set ga4-merch-context-r2 (us), created in the console for Studio run 2 (step 7) |
Console: Knowledge Studio > Context sets > Delete (needs dataplex.contentAdmin) |
| 2026-11-24 | Knowledge Studio enrichment task ga4-events-enrichment-r2 (us-central1), run 94165469-... |
Console: Knowledge Studio > Enrichments > ga4-events-enrichment-r2 > Delete |
| 2026-11-24 | Change request 9b4cc44a-... (APPROVED) and its 7 document entries + 1 entry link in ga4-merch-context-r2 |
Removed with the context set (guess) |
Remember: Google's OKF connector demo creates a project-wide okf aspect type that its cleanup script does not remove.
Local changes to undo when done
gcloud auth application-default set-quota-project YOUR_PREVIOUS_QUOTA_PROJECT(ADC quota project was switched to the POC project).gcloud config configurations delete kc-okf(local gcloud profile).~/.npmrc: original saved astrash/npmrc.backup(it hadprefix=~/.npm-global).