bigquery-agent-analytics 0.2.1__tar.gz → 0.2.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (237) hide show
  1. bigquery_agent_analytics-0.2.2/CHANGELOG.md +50 -0
  2. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/PKG-INFO +9 -1
  3. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/docs/README.md +1 -0
  4. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/docs/design.md +30 -9
  5. bigquery_agent_analytics-0.2.2/docs/entity_resolution_primitives.md +348 -0
  6. bigquery_agent_analytics-0.2.2/docs/implementation_plan_concept_index_runtime.md +250 -0
  7. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/docs/ontology/binding.md +3 -2
  8. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/docs/ontology/cli.md +11 -1
  9. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/docs/ontology/compilation.md +5 -0
  10. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/docs/ontology/ontology.md +61 -12
  11. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/docs/ontology/owl-import.md +414 -12
  12. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/docs/ontology/scaffold.md +7 -0
  13. bigquery_agent_analytics-0.2.2/examples/agent_improvement_cycle/DEMO_SCRIPT.md +255 -0
  14. bigquery_agent_analytics-0.2.2/examples/agent_improvement_cycle/README.md +506 -0
  15. bigquery_agent_analytics-0.2.2/examples/agent_improvement_cycle/agent/agent.py +127 -0
  16. bigquery_agent_analytics-0.2.2/examples/agent_improvement_cycle/agent/prompts.py +40 -0
  17. bigquery_agent_analytics-0.2.2/examples/agent_improvement_cycle/agent/tools.py +142 -0
  18. bigquery_agent_analytics-0.2.2/examples/agent_improvement_cycle/agent_improvement/__init__.py +44 -0
  19. bigquery_agent_analytics-0.2.2/examples/agent_improvement_cycle/agent_improvement/config.py +71 -0
  20. bigquery_agent_analytics-0.2.2/examples/agent_improvement_cycle/agent_improvement/config_loader.py +137 -0
  21. bigquery_agent_analytics-0.2.2/examples/agent_improvement_cycle/agent_improvement/eval_runner.py +193 -0
  22. bigquery_agent_analytics-0.2.2/examples/agent_improvement_cycle/agent_improvement/improver_agent.py +1001 -0
  23. bigquery_agent_analytics-0.2.2/examples/agent_improvement_cycle/agent_improvement/prompt_adapter.py +347 -0
  24. bigquery_agent_analytics-0.2.2/examples/agent_improvement_cycle/agent_improvement/prompts.py +71 -0
  25. bigquery_agent_analytics-0.2.2/examples/agent_improvement_cycle/agent_improvement/tool_introspection.py +69 -0
  26. bigquery_agent_analytics-0.2.2/examples/agent_improvement_cycle/config.json +14 -0
  27. bigquery_agent_analytics-0.2.2/examples/agent_improvement_cycle/eval/eval_cases.json +28 -0
  28. bigquery_agent_analytics-0.2.2/examples/agent_improvement_cycle/eval/generate_traffic.py +203 -0
  29. bigquery_agent_analytics-0.2.2/examples/agent_improvement_cycle/eval/run_eval.py +244 -0
  30. bigquery_agent_analytics-0.2.2/examples/agent_improvement_cycle/overview.png +0 -0
  31. bigquery_agent_analytics-0.2.2/examples/agent_improvement_cycle/reset.sh +38 -0
  32. bigquery_agent_analytics-0.2.2/examples/agent_improvement_cycle/run_cycle.sh +622 -0
  33. bigquery_agent_analytics-0.2.2/examples/agent_improvement_cycle/run_improvement.py +86 -0
  34. bigquery_agent_analytics-0.2.2/examples/agent_improvement_cycle/setup.sh +136 -0
  35. bigquery_agent_analytics-0.2.2/examples/agent_improvement_cycle/setup_vertex.py +159 -0
  36. bigquery_agent_analytics-0.2.2/examples/agent_improvement_cycle/show_prompt.sh +103 -0
  37. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/pyproject.toml +8 -2
  38. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/scripts/quality_report.py +111 -8
  39. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/src/bigquery_agent_analytics/_streaming_evaluation.py +45 -16
  40. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/src/bigquery_agent_analytics/cli.py +320 -0
  41. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/src/bigquery_agent_analytics/evaluators.py +170 -33
  42. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/src/bigquery_agent_analytics/resolved_spec.py +49 -5
  43. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/src/bigquery_agent_analytics/runtime_spec.py +32 -3
  44. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/src/bigquery_ontology/binding_loader.py +21 -0
  45. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/src/bigquery_ontology/cli.py +11 -0
  46. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/src/bigquery_ontology/docs/user_manual.md +88 -3
  47. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/src/bigquery_ontology/ontology_loader.py +109 -13
  48. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/src/bigquery_ontology/ontology_models.py +2 -0
  49. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/src/bigquery_ontology/owl_importer.py +673 -44
  50. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/src/bigquery_ontology/scaffold.py +34 -24
  51. bigquery_agent_analytics-0.2.2/tests/bigquery_ontology/__init__.py +0 -0
  52. bigquery_agent_analytics-0.2.2/tests/bigquery_ontology/test_owl_importer.py +1584 -0
  53. bigquery_agent_analytics-0.2.2/tests/fixtures/mixed_owl_skos.ttl +41 -0
  54. bigquery_agent_analytics-0.2.2/tests/fixtures/skos_taxonomy.ttl +27 -0
  55. bigquery_agent_analytics-0.2.2/tests/test_abstract_adapter_filter.py +484 -0
  56. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/tests/test_cli.py +535 -0
  57. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/tests/test_sdk_evaluators.py +154 -10
  58. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/tests/test_udf_kernels.py +95 -68
  59. bigquery_agent_analytics-0.2.1/tests/bigquery_ontology/test_owl_importer.py +0 -636
  60. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/.github/workflows/ci.yml +0 -0
  61. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/.github/workflows/release.yml +0 -0
  62. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/.gitignore +0 -0
  63. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/CODE_OF_CONDUCT.md +0 -0
  64. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/CONTRIBUTING.md +0 -0
  65. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/LICENSE +0 -0
  66. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/README.md +0 -0
  67. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/SDK.md +0 -0
  68. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/SECURITY.md +0 -0
  69. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/autoformat.sh +0 -0
  70. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/dashboard/README.md +0 -0
  71. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/dashboard/agent_analytics_dashboard.ipynb +0 -0
  72. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/dashboard/app.py +0 -0
  73. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/dashboard/requirements.txt +0 -0
  74. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/deploy/README.md +0 -0
  75. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/deploy/continuous_queries/README.md +0 -0
  76. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/deploy/continuous_queries/bigtable_dashboard.sql +0 -0
  77. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/deploy/continuous_queries/pubsub_alerting.sql +0 -0
  78. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/deploy/continuous_queries/realtime_error_analysis.sql +0 -0
  79. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/deploy/continuous_queries/session_scoring.sql +0 -0
  80. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/deploy/continuous_queries/setup_reservation.md +0 -0
  81. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/deploy/python_udf/README.md +0 -0
  82. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/deploy/python_udf/register.sql +0 -0
  83. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/deploy/remote_function/README.md +0 -0
  84. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/deploy/remote_function/deploy.sh +0 -0
  85. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/deploy/remote_function/dispatch.py +0 -0
  86. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/deploy/remote_function/main.py +0 -0
  87. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/deploy/remote_function/register.sql +0 -0
  88. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/deploy/streaming_evaluation/README.md +0 -0
  89. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/deploy/streaming_evaluation/main.py +0 -0
  90. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/deploy/streaming_evaluation/requirements.txt +0 -0
  91. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/deploy/streaming_evaluation/setup.sh +0 -0
  92. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/deploy/streaming_evaluation/trigger_query.sql +0 -0
  93. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/deploy/streaming_evaluation/worker.py +0 -0
  94. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/docs/context_graph_v2_design.md +0 -0
  95. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/docs/context_graph_v3_design.md +0 -0
  96. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/docs/hatteras_evaluation.md +0 -0
  97. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/docs/implementation_plan_remote_function.md +0 -0
  98. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/docs/learning_ontology_and_context_graph.md +0 -0
  99. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/docs/ontology_graph_v4_design.md +0 -0
  100. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/docs/ontology_graph_v5_design.md +0 -0
  101. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/docs/prd_unified_analytics_interface.md +0 -0
  102. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/docs/proposal_bigquery_agent_cli.md +0 -0
  103. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/docs/python_udf_support_design.md +0 -0
  104. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/docs/remote_function_rationale.md +0 -0
  105. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/docs/sdk_usage_tracking.md +0 -0
  106. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/examples/README.md +0 -0
  107. {bigquery_agent_analytics-0.2.1/tests/bigquery_ontology → bigquery_agent_analytics-0.2.2/examples/agent_improvement_cycle/agent}/__init__.py +0 -0
  108. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/examples/ai_classify_side_by_side.sql +0 -0
  109. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/examples/ai_forecast_side_by_side.sql +0 -0
  110. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/examples/ai_ml_integration_demo.ipynb +0 -0
  111. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/examples/ai_similarity_validation.sql +0 -0
  112. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/examples/categorical_dashboard.sql +0 -0
  113. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/examples/categorical_evaluation_demo.ipynb +0 -0
  114. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/examples/ci_eval_pipeline.sh +0 -0
  115. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/examples/cli_agent_tool.py +0 -0
  116. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/examples/context_graph_adcp_demo.ipynb +0 -0
  117. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/examples/continuous_query_alerting.sql +0 -0
  118. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/examples/dashboard_v2.ipynb +0 -0
  119. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/examples/dashboard_v2_bigframes.ipynb +0 -0
  120. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/examples/e2e_demo.py +0 -0
  121. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/examples/e2e_demo_output.txt +0 -0
  122. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/examples/e2e_notebook_demo.ipynb +0 -0
  123. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/examples/event_semantics_views_bigframes_demo.ipynb +0 -0
  124. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/examples/memory_service_demo.ipynb +0 -0
  125. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/examples/migration_v5_demo_notebook.ipynb +0 -0
  126. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/examples/nba_agent_trace_analysis_notebook.ipynb +0 -0
  127. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/examples/ontology_graph_v4_demo.ipynb +0 -0
  128. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/examples/ontology_graph_v5_demo.ipynb +0 -0
  129. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/examples/python_udf_eval_summary.sql +0 -0
  130. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/examples/python_udf_evaluation.sql +0 -0
  131. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/examples/python_udf_event_semantics.sql +0 -0
  132. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/examples/remote_function_dashboard.sql +0 -0
  133. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/examples/ymgo_graph_spec.yaml +0 -0
  134. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/scripts/README.md +0 -0
  135. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/scripts/quality_report.sh +0 -0
  136. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/scripts/sample_report.md +0 -0
  137. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/src/bigquery_agent_analytics/__init__.py +0 -0
  138. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/src/bigquery_agent_analytics/_deploy_runtime.py +0 -0
  139. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/src/bigquery_agent_analytics/_telemetry.py +0 -0
  140. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/src/bigquery_agent_analytics/ai_ml_integration.py +0 -0
  141. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/src/bigquery_agent_analytics/bigframes_evaluator.py +0 -0
  142. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/src/bigquery_agent_analytics/categorical_evaluator.py +0 -0
  143. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/src/bigquery_agent_analytics/categorical_views.py +0 -0
  144. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/src/bigquery_agent_analytics/client.py +0 -0
  145. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/src/bigquery_agent_analytics/context_graph.py +0 -0
  146. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/src/bigquery_agent_analytics/eval_suite.py +0 -0
  147. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/src/bigquery_agent_analytics/eval_validator.py +0 -0
  148. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/src/bigquery_agent_analytics/event_semantics.py +0 -0
  149. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/src/bigquery_agent_analytics/extracted_models.py +0 -0
  150. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/src/bigquery_agent_analytics/feedback.py +0 -0
  151. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/src/bigquery_agent_analytics/formatter.py +0 -0
  152. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/src/bigquery_agent_analytics/grader_pipeline.py +0 -0
  153. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/src/bigquery_agent_analytics/insights.py +0 -0
  154. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/src/bigquery_agent_analytics/memory_service.py +0 -0
  155. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/src/bigquery_agent_analytics/multi_trial.py +0 -0
  156. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/src/bigquery_agent_analytics/ontology_graph.py +0 -0
  157. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/src/bigquery_agent_analytics/ontology_materializer.py +0 -0
  158. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/src/bigquery_agent_analytics/ontology_models.py +0 -0
  159. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/src/bigquery_agent_analytics/ontology_orchestrator.py +0 -0
  160. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/src/bigquery_agent_analytics/ontology_property_graph.py +0 -0
  161. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/src/bigquery_agent_analytics/ontology_schema_compiler.py +0 -0
  162. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/src/bigquery_agent_analytics/serialization.py +0 -0
  163. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/src/bigquery_agent_analytics/structured_extraction.py +0 -0
  164. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/src/bigquery_agent_analytics/trace.py +0 -0
  165. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/src/bigquery_agent_analytics/trace_evaluator.py +0 -0
  166. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/src/bigquery_agent_analytics/ttl_importer.py +0 -0
  167. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/src/bigquery_agent_analytics/udf_kernels.py +0 -0
  168. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/src/bigquery_agent_analytics/udf_sql_templates.py +0 -0
  169. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/src/bigquery_agent_analytics/views.py +0 -0
  170. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/src/bigquery_ontology/__init__.py +0 -0
  171. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/src/bigquery_ontology/binding_models.py +0 -0
  172. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/src/bigquery_ontology/graph_ddl_compiler.py +0 -0
  173. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/src/bigquery_ontology/graph_ddl_models.py +0 -0
  174. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/tests/__init__.py +0 -0
  175. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/tests/bigquery_ontology/test_binding_loader.py +0 -0
  176. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/tests/bigquery_ontology/test_binding_models.py +0 -0
  177. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/tests/bigquery_ontology/test_cli.py +0 -0
  178. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/tests/bigquery_ontology/test_graph_ddl_compiler.py +0 -0
  179. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/tests/bigquery_ontology/test_ontology_models.py +0 -0
  180. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/tests/bigquery_ontology/test_scaffold.py +0 -0
  181. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/tests/bigquery_ontology/test_scaffold_cli.py +0 -0
  182. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/tests/fixtures/lineage_sessions.json +0 -0
  183. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/tests/fixtures/mixed_events.json +0 -0
  184. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/tests/fixtures/test_binding.yaml +0 -0
  185. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/tests/fixtures/test_combined_spec.yaml +0 -0
  186. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/tests/fixtures/test_ontology.yaml +0 -0
  187. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/tests/fixtures/yamo_sample.ttl +0 -0
  188. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/tests/test_ai_ml_integration.py +0 -0
  189. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/tests/test_ai_ml_integration_labels.py +0 -0
  190. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/tests/test_bigframes_evaluator.py +0 -0
  191. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/tests/test_bridge_hardening.py +0 -0
  192. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/tests/test_categorical_evaluator.py +0 -0
  193. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/tests/test_categorical_views.py +0 -0
  194. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/tests/test_client_labels.py +0 -0
  195. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/tests/test_context_graph.py +0 -0
  196. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/tests/test_context_graph_labels.py +0 -0
  197. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/tests/test_dual_loader.py +0 -0
  198. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/tests/test_eval_suite.py +0 -0
  199. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/tests/test_eval_validator.py +0 -0
  200. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/tests/test_event_semantics.py +0 -0
  201. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/tests/test_extracted_models.py +0 -0
  202. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/tests/test_feedback_labels.py +0 -0
  203. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/tests/test_formatter.py +0 -0
  204. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/tests/test_grader_pipeline.py +0 -0
  205. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/tests/test_integration_ontology_binding.py +0 -0
  206. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/tests/test_memory_service.py +0 -0
  207. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/tests/test_memory_service_labels.py +0 -0
  208. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/tests/test_multi_trial.py +0 -0
  209. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/tests/test_ontology_graph.py +0 -0
  210. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/tests/test_ontology_labels.py +0 -0
  211. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/tests/test_ontology_materializer.py +0 -0
  212. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/tests/test_ontology_models.py +0 -0
  213. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/tests/test_ontology_orchestrator.py +0 -0
  214. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/tests/test_ontology_property_graph.py +0 -0
  215. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/tests/test_ontology_schema_compiler.py +0 -0
  216. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/tests/test_owl_import_bridge.py +0 -0
  217. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/tests/test_pr16_fixes.py +0 -0
  218. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/tests/test_pr17_fixes.py +0 -0
  219. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/tests/test_pr19_fixes.py +0 -0
  220. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/tests/test_quality_report_helpers.py +0 -0
  221. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/tests/test_remote_function.py +0 -0
  222. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/tests/test_resolved_spec.py +0 -0
  223. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/tests/test_runtime_factory.py +0 -0
  224. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/tests/test_runtime_spec.py +0 -0
  225. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/tests/test_sdk_client.py +0 -0
  226. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/tests/test_sdk_feedback.py +0 -0
  227. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/tests/test_sdk_insights.py +0 -0
  228. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/tests/test_sdk_trace.py +0 -0
  229. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/tests/test_serialization.py +0 -0
  230. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/tests/test_streaming_evaluation.py +0 -0
  231. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/tests/test_surface_tags.py +0 -0
  232. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/tests/test_telemetry.py +0 -0
  233. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/tests/test_trace_evaluator.py +0 -0
  234. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/tests/test_trace_filter_factory.py +0 -0
  235. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/tests/test_udf_sql_generation.py +0 -0
  236. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/tests/test_v5_golden.py +0 -0
  237. {bigquery_agent_analytics-0.2.1 → bigquery_agent_analytics-0.2.2}/tests/test_views.py +0 -0
@@ -0,0 +1,50 @@
1
+ # Changelog
2
+
3
+ All notable changes to `bigquery-agent-analytics` are documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ## [0.2.2] - 2026-04-24
11
+
12
+ ### Changed (breaking)
13
+
14
+ - **Prebuilt `CodeEvaluator` gates now compare raw observed values
15
+ directly against the user-supplied budget.** `CodeEvaluator.latency`,
16
+ `.turn_count`, `.error_rate`, `.token_efficiency`, `.ttft`, and
17
+ `.cost_per_session` return `1.0` when the observed metric is within
18
+ budget and `0.0` otherwise. The previous implementation scored sessions
19
+ on a normalized `1.0 - (observed / budget)` scale against a `0.5` pass
20
+ cutoff, which effectively fired every gate at roughly half the budget
21
+ the user typed (e.g. `latency(threshold_ms=5000)` failed sessions at
22
+ `avg_latency_ms > 2500`). Users relying on the old sub-budget fail
23
+ behavior should lower their budgets to match their intent.
24
+ - The scheduled streaming evaluator (`streaming_observability_v1`) uses
25
+ the same raw-budget gate semantics for consistency with the prebuilt
26
+ `CodeEvaluator` factories.
27
+
28
+ ### Added
29
+
30
+ - `CodeEvaluator.add_metric` accepts `observed_key`, `observed_fn`, and
31
+ `budget` arguments that flow into `SessionScore.details[f"metric_{name}"]`
32
+ for downstream reporting. The CLI uses these to emit readable failure
33
+ lines without re-running the scorer.
34
+ - `bq-agent-sdk evaluate --exit-code` now prints a per-session failure
35
+ summary on stderr before exiting non-zero. Each line names the
36
+ session_id, failing metric, observed value, and the budget it blew
37
+ through. Output is capped at the first 10 failing sessions to keep
38
+ CI logs scannable.
39
+ - `bq-agent-sdk categorical-eval` gains `--exit-code`,
40
+ `--min-pass-rate`, and `--pass-category METRIC=CATEGORY`
41
+ (repeatable) flags. Declare which classification counts as passing
42
+ per metric, set a minimum pass rate across the run, and fail CI when
43
+ any metric falls below it. Multiple pass categories per metric are
44
+ OR'd together (e.g. `--pass-category tone=positive --pass-category
45
+ tone=neutral`). Missing metric names warn on stderr without failing
46
+ the run so configuration mistakes are visible in CI logs.
47
+
48
+ ## [0.2.1]
49
+
50
+ - See `git log` for prior changes.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bigquery-agent-analytics
3
- Version: 0.2.1
3
+ Version: 0.2.2
4
4
  Summary: SDK for analyzing and evaluating agent traces stored in BigQuery.
5
5
  Author: Google LLC
6
6
  License-Expression: Apache-2.0
@@ -23,11 +23,14 @@ Requires-Dist: pyyaml>=6.0
23
23
  Requires-Dist: typer>=0.9.0
24
24
  Provides-Extra: all
25
25
  Requires-Dist: bigframes>=1.0.0; extra == 'all'
26
+ Requires-Dist: google-cloud-aiplatform>=1.148.0; extra == 'all'
26
27
  Requires-Dist: google-genai>=1.0.0; extra == 'all'
27
28
  Requires-Dist: isort>=5.0; extra == 'all'
29
+ Requires-Dist: pandas>=2.0.0; extra == 'all'
28
30
  Requires-Dist: pyink>=24.3.0; extra == 'all'
29
31
  Requires-Dist: pytest-asyncio>=0.21; extra == 'all'
30
32
  Requires-Dist: pytest>=7.0; extra == 'all'
33
+ Requires-Dist: python-dotenv>=1.0.0; extra == 'all'
31
34
  Requires-Dist: rdflib>=7.0; extra == 'all'
32
35
  Provides-Extra: bigframes
33
36
  Requires-Dist: bigframes>=1.0.0; extra == 'bigframes'
@@ -37,6 +40,11 @@ Requires-Dist: isort>=5.0; extra == 'dev'
37
40
  Requires-Dist: pyink>=24.3.0; extra == 'dev'
38
41
  Requires-Dist: pytest-asyncio>=0.21; extra == 'dev'
39
42
  Requires-Dist: pytest>=7.0; extra == 'dev'
43
+ Provides-Extra: improvement
44
+ Requires-Dist: google-cloud-aiplatform>=1.148.0; extra == 'improvement'
45
+ Requires-Dist: google-genai>=1.0.0; extra == 'improvement'
46
+ Requires-Dist: pandas>=2.0.0; extra == 'improvement'
47
+ Requires-Dist: python-dotenv>=1.0.0; extra == 'improvement'
40
48
  Provides-Extra: llm
41
49
  Requires-Dist: google-genai>=1.0.0; extra == 'llm'
42
50
  Provides-Extra: owl
@@ -25,6 +25,7 @@ architecture, rationale, and implementation plans behind key SDK features.
25
25
  | [ontology_graph_v4_design.md](ontology_graph_v4_design.md) | YAML-driven ontology extraction and materialization |
26
26
  | [ontology_graph_v5_design.md](ontology_graph_v5_design.md) | V5: TTL import, mixed extraction, temporal lineage |
27
27
  | [learning_ontology_and_context_graph.md](learning_ontology_and_context_graph.md) | Learning guide for ontology and context graph |
28
+ | [implementation_plan_concept_index_runtime.md](implementation_plan_concept_index_runtime.md) | Phased implementation plan for concept index + runtime entity resolution (issue #58) |
28
29
 
29
30
  ## Ontology Reference
30
31
 
@@ -408,15 +408,36 @@ _metrics: list[dict] # [{"name": str, "fn": Callable[[dict], float], "threshold
408
408
 
409
409
  Each metric function receives a session summary dict (aggregated from BigQuery) and returns a score in `[0.0, 1.0]`.
410
410
 
411
- **Pre-built factory methods:**
412
-
413
- | Factory | Metric Logic | Default Threshold |
414
- |---------|-------------|-------------------|
415
- | `latency(threshold_ms)` | `1.0 - min(avg_latency_ms / threshold_ms, 1.0)` | 0.5 |
416
- | `turn_count(max_turns)` | `1.0 - min(turn_count / max_turns, 1.0)` | 0.5 |
417
- | `error_rate(max_error_rate)` | `1.0 - min(actual_rate / max_rate, 1.0)` | 0.5 |
418
- | `token_efficiency(max_tokens)` | `1.0 - min(total_tokens / max_tokens, 1.0)` | 0.5 |
419
- | `cost_per_session(max_cost_usd, ...)` | `1.0 - min(computed_cost / max_cost, 1.0)` | 0.5 |
411
+ **Pre-built factory methods** (Python path — raw-budget binary gates):
412
+
413
+ Since v0.2.2 the Python prebuilts compare the observed metric directly
414
+ against the user-supplied budget: `score = 1.0 if observed <= budget
415
+ else 0.0`, with `threshold = 1.0`. A session fails iff the observed
416
+ value strictly exceeds the budget.
417
+
418
+ | Factory | Observed Value | Pass Condition |
419
+ |---------|----------------|----------------|
420
+ | `latency(threshold_ms)` | `avg_latency_ms` | `observed <= threshold_ms` |
421
+ | `turn_count(max_turns)` | `turn_count` | `observed <= max_turns` |
422
+ | `error_rate(max_error_rate)` | `tool_errors / tool_calls` (0 when no calls) | `observed <= max_error_rate` |
423
+ | `token_efficiency(max_tokens)` | `total_tokens` | `observed <= max_tokens` |
424
+ | `ttft(threshold_ms)` | `avg_ttft_ms` | `observed <= threshold_ms` |
425
+ | `cost_per_session(max_cost_usd, ...)` | `(input_tokens/1K)*input_rate + (output_tokens/1K)*output_rate` | `observed <= max_cost_usd` |
426
+
427
+ > **Prior to v0.2.2** these factories used a normalized score
428
+ > `1.0 - min(observed / budget, 1.0)` with a `0.5` pass cutoff, which
429
+ > effectively fired every gate at roughly half the budget the user
430
+ > typed (e.g. `latency(threshold_ms=5000)` failed at `avg_latency_ms >
431
+ > 2500`). See `CHANGELOG.md` for the migration note.
432
+
433
+ **SQL-native UDF path** (`udf_kernels.score_*`, used by
434
+ `udf_sql_templates.py`):
435
+
436
+ Unchanged — keeps the normalized `1.0 - min(observed / budget, 1.0)`
437
+ score because BigQuery SQL callers (e.g. scorecard dashboards) may
438
+ already interpret the normalized value. The divergence from the Python
439
+ path is intentional: Python prebuilts are binary CI gates; SQL UDFs
440
+ are normalized metrics for analytical workloads.
420
441
 
421
442
  **`evaluate_session(session_summary) -> SessionScore`:**
422
443
 
@@ -0,0 +1,348 @@
1
+ # **RFC: Entity resolution primitives for BigQuery-Agent-Analytics-SDK**
2
+
3
+ **Scope:** Two packages in one repo — `bigquery_ontology` (compiler) and `bigquery_agent_analytics` (Consumption/analytics layer for trace data from BQ Agent Analytics). The RFC does **not** standardize agent-side ranking and business policy.
4
+
5
+ ---
6
+
7
+ ## **1\. Problem**
8
+
9
+ The SDK today has **two directions** through the ontology stack. A third is missing.
10
+
11
+ ```
12
+ Direction 1 (shipping): Schema bridge
13
+ bigquery_ontology.Ontology + Binding
14
+ ↓ runtime_spec / resolved_spec
15
+ SDK GraphSpec / ResolvedGraph
16
+
17
+ OntologyMaterializer (SQL DDL)
18
+ # Hardened by #68 (abstract-element adapter filter).
19
+
20
+ Direction 2 (shipping): Population via agent traces
21
+ Agent trace rows in BigQuery
22
+ ↓ extract_graph / extract_biz_nodes / extract_decision_points
23
+ Typed entity + relationship rows (data layer)
24
+ # Uses AI.GENERATE server-side.
25
+
26
+ Direction 3 (MISSING — this RFC): Trace resolution
27
+ Free-text input from users / tools / sibling agents
28
+ ↓ EntityResolver → concept_index lookup
29
+ Candidate matching a DECLARED entity (schema layer)
30
+ ```
31
+
32
+ **What Direction 3 is, in one sentence:** given a free-text string observed in a trace or handed to a pipeline — a geo like `"San Francisco-Stockton-Modesto"`, a format like `"display_static"`, a tool-call argument recorded in the trace — return the ontology entity it refers to.
33
+
34
+ **What Direction 3 is *not*:**
35
+
36
+ - Not agent-trace input. The caller supplies the string explicitly.
37
+ - Not new graph rows. The output is a match against entities *declared* in the ontology YAML, whether or not Direction 2 has populated them yet.
38
+ - Not a competitor to the `AI.GENERATE` extraction path. Direction 3 is pure lookup — it finds declared things; it does not create new ones.
39
+
40
+ **Why this matters.** Before \#58, every vertical reinvented Direction 3 on top of ad-hoc SQL. One production user (agentic media buying) quantified the gap at **\~85% of brief-validation value** and built a 5-layer resolver (notation → lexical → token-set → Jaccard → Levenshtein) over \~10K lines of TTL (274 SKOS concepts, 942 synonyms, 210 GAM DMA display names). It works. Every vertical reinventing the same thing is a missing primitive.
41
+
42
+ **Scope of this repo.** Two packages, both **not** live-agent libraries:
43
+
44
+ - **`bigquery_ontology`** — build-time compiler \+ model classes. Consumed by operators (via `gm` CLI) and by any downstream package that needs `Ontology` / `Binding` objects in memory.
45
+ - **`bigquery_agent_analytics`** — **consumption/analytics layer for trace data already in BigQuery.** Consumed by evaluation pipelines, observability dashboards, analysis notebooks, curation scripts, and batch orchestrators. The live-agent side is owned by the **BQ AA Plugin** (separate package — runs inside the agent and writes traces to BQ). This SDK reads what the plugin wrote.
46
+
47
+ Neither package is designed as a turn-time agent SDK. This RFC does not add an in-agent runtime surface.
48
+
49
+ **How the three directions compose in production:**
50
+
51
+ | Direction | Who calls it | When | What happens |
52
+ | :---- | :---- | :---- | :---- |
53
+ | 1 | Operator / CI | Once per ontology change (build-time) | `gm compile` → emits DDL \+ concept-index SQL; operator executes the emitted SQL to publish the tables to BigQuery. |
54
+ | 2 | Batch orchestrator | Scheduled over accumulated traces (post-processing) | `extract_graph` / `extract_biz_nodes` from `bigquery_agent_analytics` → `AI.GENERATE` populates entity / relationship tables. |
55
+ | 3 | Eval / analysis / curation pipeline (this RFC) | On accumulated data, at the pipeline's cadence | Pipeline imports `OntologyRuntime` \+ a resolver from `bigquery_agent_analytics` and calls `.resolve(...)` or `.validate_against_ontology(...)`. Each call is a BQ query against the concept index. |
56
+
57
+ **Typical Direction 3 callers:**
58
+
59
+ - An eval step that checks "of N free-text `geo:` values in yesterday's traces, how many resolve against the GAM DMA scheme?" — observability and drift reporting.
60
+ - A curation script that canonicalizes a column of historical user inputs into declared entity keys for a training / eval dataset.
61
+ - A pre-processing job that resolves brief parameters against the ontology before briefs are enqueued for downstream processing.
62
+
63
+ The three directions compose at the **data layer** (entity-key joins in SQL), not via shared Python state. \#58 adds Direction 3 only; Directions 1 and 2 are untouched. **Live-agent resolution at turn time is not solved here** — if a future design requires it, it would live in a separate agent-facing package that may reuse the `EntityResolver` `Protocol` contract but does not belong in a trace-consumption SDK.
64
+
65
+ ## **2\. Goals and non-goals**
66
+
67
+ **Goals — Direction 3 only.**
68
+
69
+ - Stable typed read surface over loaded ontologies: annotations, synonyms, notations, scheme membership, abstract-relationship traversal.
70
+ - BigQuery-native concept index compiled from `(Ontology, Binding)` — enables SQL fuzzy via `EDIT_DISTANCE` / `JACCARD` / `SOUNDEX` in one line.
71
+ - `EntityResolver` Protocol \+ two SQL-only references (exact, synonym-aware). Protocol is the contract; implementations swap.
72
+ - Strict provenance by default — no matches from an index that doesn't correspond to the loaded models.
73
+
74
+ **Non-goals.**
75
+
76
+ - **A live-agent integration surface.** `bigquery_agent_analytics` is the **consumption/analytics layer** for trace data the BQ AA Plugin already wrote to BQ. It is not designed to be imported by a live agent at turn time. The BQ AA Plugin (separate package) handles the in-agent side. Live-agent resolution — an agent calling a resolver on every turn — would need a separate agent-facing package; pending design, out of scope here.
77
+ - **Direction 1 and 2 behavior.** `runtime_spec` / `resolved_spec` / `OntologyMaterializer` / `extract_graph` / `extract_biz_nodes` all unchanged.
78
+ - A general string-matching library. BigQuery already has the primitives.
79
+ - A 5-layer resolver in core. Domain-tuned thresholds are not portable. See §12 for user-composed variants.
80
+ - Sub-50ms SLA. Latency depends on index size and resolver choice.
81
+ - Concept-scheme browser UI.
82
+ - **Agent-side ranking, business policy, or user-facing copy.** SDK returns structured candidates; the agent composes everything else.
83
+
84
+ ## **3\. Guiding principles**
85
+
86
+ - **SDK returns candidates; the caller composes policy.** SDK exposes read access over what's declared and returns structured matches. The calling pipeline (eval, curation, analysis — or, in a future agent-facing package, an agent) decides matcher order, thresholds, phrasing. Two reference resolvers ship; domain packs live in `contrib/` or external.
87
+ - **Additive, not coupling.** Direction 3 has no dependency on Direction 2 having run. The concept index is built from the *declared* ontology, not from populated data. A pure-SKOS taxonomy with zero Direction 2 population still supports the full Direction 3 surface.
88
+ - **SQL-first, LLM-optional.** Core resolvers are deterministic SQL. LLM-backed variants compose against the Protocol — see §12.
89
+
90
+ ## **4\. Proposed primitives**
91
+
92
+ ### **4.1 `OntologyRuntime` — read accessor**
93
+
94
+ Stateless wrapper over a validated `(Ontology, Binding)` pair. No BQ round-trip on construction.
95
+
96
+ ```py
97
+ from bigquery_agent_analytics import OntologyRuntime, SynonymResolver
98
+
99
+ rt = OntologyRuntime.load(
100
+ ontology_path="ontology.yaml",
101
+ binding_path="binding.yaml",
102
+ concept_index_table="my-proj.my_ds.ontology_concept_index",
103
+ # defaults: verify_concept_index="strict", verify_ttl_seconds=60
104
+ )
105
+
106
+ rt.synonyms("DMA") # ["Designated Market Area", ...]
107
+ rt.annotation("DMA", "skos:notation") # "807"
108
+ rt.in_scheme("NielsenDMA") # list[Entity]
109
+ rt.broader("RetailBanking") # list[Entity] via skos:broader
110
+
111
+ result = SynonymResolver(runtime=rt).resolve(
112
+ input_value="Consumer Banking",
113
+ scheme="BankingTaxonomy", # scheme= XOR entity=, mutually exclusive
114
+ limit=5,
115
+ )
116
+ ```
117
+
118
+ **Identity rules:** entities are name-addressed (singular). Relationships are **traversal-first** — after \#62's relaxed `(name, from, to)` uniqueness, a `skos_broader` can repeat across endpoint pairs, so no `rt.relationship(name)`.
119
+
120
+ ### **4.2 Concept index (opt-in at compile time)**
121
+
122
+ Emitted when `gm compile --emit-concept-index --concept-index-table <fqn>` is passed. Default shape: single atomic `CREATE OR REPLACE TABLE ... AS SELECT * FROM UNNEST([...])`. Shadow-swap fallback at \> 50K rows.
123
+
124
+ ```sql
125
+ CREATE TABLE `{dataset}.ontology_concept_index` (
126
+ entity_name STRING NOT NULL,
127
+ label STRING NOT NULL, -- for label_kind='notation', holds notation value
128
+ label_kind STRING NOT NULL, -- 'name'|'pref'|'alt'|'hidden'|'synonym'|'notation'
129
+ notation STRING, -- per-entity display, repeats across rows
130
+ scheme STRING, -- NULL = not in any scheme
131
+ language STRING,
132
+ is_abstract BOOL NOT NULL,
133
+ compile_id STRING NOT NULL, -- 12 hex chars; display/debug token only
134
+ compile_fingerprint STRING NOT NULL -- 64 hex chars; canonical integrity key
135
+ );
136
+ ```
137
+
138
+ **Two provenance columns, one role each.**
139
+
140
+ | Column | Role | Width | Used by |
141
+ |---|---|---|---|
142
+ | `compile_id` | Display/debug token — human-readable short tag for reports, queue rows, error messages, log lines. **Never the sole freshness check.** | 12 hex chars | Operator UX, dashboards, triage output |
143
+ | `compile_fingerprint` | Canonical integrity key — full SHA-256 over the NUL-delimited UTF-8 of `(ontology_fingerprint, binding_fingerprint, compiler_version)`. Consumers must call `_fingerprint.compile_fingerprint()`; do not reimplement. | 64 hex chars | Strict pair-consistency + runtime verification (§5) |
144
+
145
+ Structural invariant: `compile_id == compile_fingerprint[:12]`. The short form is always derivable from the full form; never the other way around. Enforced at the `_fingerprint.py` module boundary so a future refactor cannot make them diverge.
146
+
147
+ **Row multiplicity:** one row per `(entity_name, label, label_kind, language, scheme)` tuple — concept in 3 schemes × 5 labels \= 15 rows. Resolvers filter by scheme without JOIN.
148
+
149
+ **Scope rule:** all abstract entities (informational — always included); concrete entities iff bound in the binding being compiled.
150
+
151
+ ### **4.3 `EntityResolver` Protocol \+ references**
152
+
153
+ - `ExactMatchResolver` — `WHERE label = @input`. Catches name \+ notation \+ synonym.
154
+ - `SynonymResolver` — extends with label-kind preference order.
155
+
156
+ **Scope:** `scheme=` and `entity=` mutually exclusive. Neither or both → `ValueError`. Narrower-closure deferred to v2.
157
+
158
+ **Dedup:** one candidate per entity. Winning-label priority: `name > pref > alt > hidden > synonym > notation`, lexicographic tiebreak. `limit=N` returns N distinct entities.
159
+
160
+ ### **4.4 Validation**
161
+
162
+ `rt.validate_against_ontology(values, *, scheme=None, entity=None, sample_limit=20) → ValidationResult` with bounded output (`known_value_count`, `known_values_sample`). `candidates` stays `None` unless the caller composes validation with a resolver — keeps `validate` pure set-membership.
163
+
164
+ ### **4.5 Trace-native consumption is a composition, not the primitive**
165
+
166
+ A `Trace` is not a single resolvable value — it's a container of many candidate values with different semantics and potentially different scopes (tool args, extracted structured values, user text, event metadata; probably **not** arbitrary model-response prose). Making the resolver Protocol accept `Trace | str` would blur two layers:
167
+
168
+ - **Matching** a value against ontology entities (resolver's job).
169
+ - **Extracting** candidate values from telemetry (consumer's job — scope, field choice, and extraction policy all vary by domain).
170
+
171
+ v1 keeps the two layers separate by design:
172
+
173
+ - **Interactive / single-value** — use the Python `EntityResolver` Protocol (`resolve(input_value, scheme=...)`). Atomic operation.
174
+
175
+ - **Bulk analytics over trace/event tables** — use documented **SQL pushdown** patterns against the concept-index table. BigQuery's natural execution model; no Python loop required. For example:
176
+
177
+ ```sql
178
+ -- Resolve every tool-call geo arg in yesterday's traces against the GAM DMA scheme.
179
+ SELECT
180
+ JSON_VALUE(e.content, '$.args.geo') AS raw_geo,
181
+ ci.entity_name AS resolved,
182
+ COUNT(*) AS n
183
+ FROM `proj.ds.agent_events` e
184
+ LEFT JOIN `proj.ds.ontology_concept_index` ci
185
+ ON LOWER(ci.label) = LOWER(JSON_VALUE(e.content, '$.args.geo'))
186
+ AND ci.scheme = 'NielsenDMA'
187
+ WHERE e.event_type = 'TOOL_STARTING'
188
+ AND DATE(e.timestamp) = CURRENT_DATE() - 1
189
+ GROUP BY raw_geo, resolved;
190
+ ```
191
+
192
+ Docs (`docs/ontology/concept-index.md`, from A8) will carry two or three canonical SQL patterns: bulk resolution report, resolution-drift report, coverage by scheme.
193
+
194
+ **What is explicitly out of v1:** a trace-field helper (e.g., a `TraceFieldResolver` wrapper that iterates configured trace fields and calls the Protocol per field). See §12 — it's deferred until real field patterns stabilize, and when it lands it should be a separate wrapper class rather than methods on `OntologyRuntime` (which would mix ontology access, extraction policy, and resolver orchestration into one surface).
195
+
196
+ ## **5\. Verification — defaults and behavior matrix**
197
+
198
+ **This is the correctness gate. These defaults ship.**
199
+
200
+ | `verify_concept_index` | First access: missing `__meta` | First access: fingerprint mismatch | TTL re-check stale |
201
+ | :---- | :---- | :---- | :---- |
202
+ | `"strict"` (**default**) | `ConceptIndexProvenanceMissing` | `ConceptIndexMismatchError` | `ConceptIndexInconsistentPair` / `ConceptIndexRefreshed` |
203
+ | `"missing_ok"` | Silently proceed | `ConceptIndexMismatchError` | Same as strict |
204
+ | `"off"` | Silently proceed | Silently proceed | Skipped |
205
+
206
+ | `verify_ttl_seconds` | Behavior |
207
+ | :---- | :---- |
208
+ | `60` (**default**) | Cached verification is fresh for 60s of wall time; past that → re-check |
209
+ | `0` | Re-check on every resolve / validate call |
210
+ | `None` | Snapshot-bound — verify once on first access, never re-check |
211
+
212
+ **TTL re-check queries (stale cache):**
213
+
214
+ 1. `SELECT DISTINCT compile_fingerprint FROM {output_table} LIMIT 2` — asserts exactly one value (pair consistency at full-fingerprint resolution). More than one → refresh in progress.
215
+ 2. `SELECT compile_fingerprint, ontology_fingerprint, binding_fingerprint FROM {output_table}__meta LIMIT 1`.
216
+ 3. Require: `main.compile_fingerprint == meta.compile_fingerprint` (pair consistency) **and** `meta.ontology_fingerprint == cached.ontology_fingerprint` **and** `meta.binding_fingerprint == cached.binding_fingerprint` (component freshness).
217
+
218
+ No short-ID arithmetic anywhere on the verification path. `compile_id` never appears in a strict-mode query.
219
+
220
+ Main/meta disagreement → 2s one-shot retry → persistent \= `ConceptIndexInconsistentPair`. Cache drift \= `ConceptIndexRefreshed` (operator recreates `OntologyRuntime` with updated models).
221
+
222
+ Why full fingerprints on both tables: see §10 W2.
223
+
224
+ ## **6\. Tie to issue \#57**
225
+
226
+ Concept-index value is \~80% from SKOS annotations preserved through import (\#57, merged in \#62):
227
+
228
+ | SKOS | Becomes | Enables |
229
+ | :---- | :---- | :---- |
230
+ | `skos:notation` | `notation` annotation \+ first-class row | L1 code match trivial |
231
+ | `skos:prefLabel` / `altLabel` / `hiddenLabel` | Row per label with `label_kind` | L2 lexical trivial |
232
+ | `skos_broader` abstract relationship | `rt.broader()` / `rt.narrower()` traversal | Taxonomy-aware suggestions |
233
+ | Abstract entities with `skos_` prefix | `rt.in_scheme()` enumeration | Agent gets taxonomy context |
234
+
235
+ ## **7\. Package changes (status as of main@b7e7361, 2026-04-23)**
236
+
237
+ ### **`bigquery_ontology` — version bump: minor**
238
+
239
+ | File | Change | Status |
240
+ | :---- | :---- | :---- |
241
+ | `_fingerprint.py` | **New internal** — `fingerprint_model`, `compile_fingerprint` (canonical integrity key), `compile_id` (display token, derived as `compile_fingerprint(...)[:12]`) | **\#71 open** |
242
+ | `concept_index.py` | New row builder | Pending A2 |
243
+ | `graph_ddl_compiler.py` | Add `compile_concept_index`. `compile_graph` unchanged | Pending A3–A5 |
244
+ | `cli.py:299` | Add `--emit-concept-index` \+ `--concept-index-table`; no-flag byte-identical | Pending A7 |
245
+ | `__init__.py` | Re-export `compile_concept_index` | Pending |
246
+ | `ontology_models.py` / `binding_models.py` | **No changes** | — |
247
+
248
+ ### **`bigquery_agent_analytics` — version bump: minor**
249
+
250
+ | File | Change | Status |
251
+ | :---- | :---- | :---- |
252
+ | `ontology_runtime.py` | **New** — `OntologyRuntime` \+ verification \+ 4 exceptions | Pending B1–B3, C1–C6 |
253
+ | `entity_resolver.py` | **New** — Protocol, `Candidate`, `ResolveResult`, `ExactMatchResolver`, `SynonymResolver` | Pending B4–B7 |
254
+ | `__init__.py` | Re-export above | Pending |
255
+ | All other modules | **No changes** | — |
256
+
257
+ **Exceptions** (all raised from `ontology_runtime`):
258
+
259
+ - `ConceptIndexMismatchError` — first-access fingerprint disagreement.
260
+ - `ConceptIndexProvenanceMissing` — no `__meta` sibling.
261
+ - `ConceptIndexInconsistentPair` — main/meta disagree after 2s retry.
262
+ - `ConceptIndexRefreshed` — TTL re-check detects cache drift.
263
+
264
+ ## **8\. Rollout — shippable per phase**
265
+
266
+ Each phase leaves `main` shippable. Independently mergeable.
267
+
268
+ | Phase | Scope | User-visible outcome | Weeks |
269
+ | :---- | :---- | :---- | :---- |
270
+ | 1 | Compiler foundation (A1–A5, A7, A8 partial) | `gm compile --emit-concept-index` produces a byte-deterministic index \+ meta sibling. Nothing reads it yet. | 2 |
271
+ | 2 | SDK read accessors \+ resolver Protocol (verification **off** intermediate) | `OntologyRuntime.load(...)` \+ `ExactMatchResolver` / `SynonymResolver` return correctly deduped candidates. | 2 |
272
+ | 3 | Verification layer (strict default on) \+ full shadow-swap | Strict provenance ships. Four exception types raise in documented conditions. | 2 |
273
+ | 4 | Integration \+ quickstart \+ docs | `examples/concept_index_quickstart.py` runs end-to-end on a real BQ dataset. Migration note published. | 1 |
274
+ | 5 | `contrib/` scaffolding | Reference advertising resolver available as `from bigquery_ontology.contrib.advertising import ...`. | 0.5 |
275
+
276
+ Single developer ≈ 7.5 weeks. Phases 1 \+ 2 parallelizable → \~4 weeks wall-clock for two developers.
277
+
278
+ ## **9\. Alternatives considered, rejected — with decisive drawback**
279
+
280
+ | Alternative | Decisive drawback (not reopening) |
281
+ | :---- | :---- |
282
+ | Methods on `Ontology` / `Binding` directly | Couples pure-data models to runtime verification state — BQ I/O doesn't belong on a validated schema model. |
283
+ | Opt-out concept index (emit by default) | `gm compile` has always been pure SQL-text; silent BQ DDL on every compile breaks that contract. |
284
+ | YAML-text fingerprints | Non-semantic YAML edits (whitespace, comments, key order) would fire strict verification constantly → operators disable it → worse than no verification. |
285
+ | Single-table sentinel for TTL re-check | Reintroduces the meta/main refresh-window race; strict mode then serves wrong data under the banner of "verified." |
286
+ | Short-compile-id-only freshness check | 48 bits \= birthday bound \~16M compiles; small probability is not "zero." Strict contract cannot rely on it. |
287
+ | Polymorphic `entity=` (scheme if scheme-typed, entity if entity-typed) | Ontology authors changing an entity's shape silently change API semantics; callers need ontology knowledge to predict. |
288
+ | Ship full 5-layer resolver in core | Becomes everyone's default despite being domain-tuned for advertising — users in healthcare or legal get the wrong matcher with no warning. |
289
+ | Auto-promote `skos:broader` → `extends` (\#57-related) | Silent semantics drift per W3C SKOS primer — informational claim silently becomes formal subsumption. |
290
+ | `asyncio` resolver in v1 | No real user has asked; adding sync \+ async both now doubles surface for speculative value. |
291
+ | Binding-side index toggle (`index:` on Binding) | v1 ships one surface (CLI). Adding a second without precedence rule invites contradictory configs. |
292
+ | "Verify once, cache forever" | Long-lived services sail past an index refresh, returning matches from the new index under stale verification. |
293
+
294
+ ## **10\. Risks and deferred watchlist**
295
+
296
+ ### **Contract watchpoints — invariant, failure mode, regression test**
297
+
298
+ | \# | Invariant | Failure mode if broken | Regression test |
299
+ | :---- | :---- | :---- | :---- |
300
+ | W1 | `_fingerprint.py` is the **single** source of canonical serialization; both packages import it | Compiler writes fingerprint X, runtime computes fingerprint Y, strict mode rejects every valid index | `tests/bigquery_ontology/test_fingerprint.py`: round-trip YAML → load → fingerprint; semantic edits change it, whitespace edits don't (landed in \#71) |
301
+ | W2 | Strict verification uses `compile_fingerprint` (full 64-hex) on both tables — short `compile_id` never appears on the verification path | A reducer "optimization" to `SELECT compile_id FROM ...` would reintroduce the 48-bit collision hole under an out-of-band swap. A meta-only sentinel would reintroduce the refresh-window race | Assert strict-mode queries reference `compile_fingerprint` only; assert short-ID reducer fails a reintroduction test. Mock main/meta full-fingerprint mismatch and assert `ConceptIndexInconsistentPair` |
302
+ | W3 | Shadow-swap is **non-self-healing**; compiler errors out and next `gm compile` resumes | Background retry loops mask partial-swap states; operator "pause traffic during shadow refresh" guidance becomes unenforceable | Inject mid-swap `DROP`/`RENAME` failure → `gm compile` errors with clear message; subsequent `gm compile` completes the swap without recompiling |
303
+
304
+ ### **Deferred (tracked, not blocking)**
305
+
306
+ - Ontologies \> 100K concepts — shadow-swap activates at 50K; a LOAD-job path may be needed at the next order of magnitude.
307
+ - `{output_table}__current` pointer indirection as a v2 mitigation for shadow transient failures.
308
+ - `asyncio` variants of `EntityResolver.resolve()`.
309
+ - Binding-side opt-in (`index:` block on Binding) with precedence rule.
310
+ - **Opinionated ADK/plugin field mappings** for a future `TraceFieldResolver`. Default field-path → scheme mappings for known ADK plugin trace shapes (`tool_starting.content.args.*`, `hitl_*.content.tool`, etc.). Deferred because the right defaults depend on how users' ontologies carve up tool-call argument schemas — no point ossifying a default before field feedback from v1 pipelines.
311
+
312
+ ## **11\. Decisions pinned (closed)**
313
+
314
+ - Wrapper (`OntologyRuntime`), not methods on `Ontology`/`Binding`.
315
+ - Opt-in concept index.
316
+ - `typing.Protocol`, not `ABC`.
317
+ - `validate_against_ontology` returns pure set-membership; `candidates` caller-composed.
318
+ - `scheme=` XOR `entity=` in v1. Narrower-closure in v2 only if real callers ask.
319
+ - `contrib/` for reference resolvers; external packages for user-owned domains.
320
+ - Strict verification on by default; `verify_concept_index="off"` is the explicit opt-out.
321
+ - **Option 2 for provenance columns: `compile_fingerprint` is the canonical integrity key; `compile_id` is display-only.** Invariant `compile_id == compile_fingerprint[:12]` enforced at the `_fingerprint.py` module boundary. Short-ID arithmetic is forbidden on the strict verification path.
322
+
323
+ ## **12\. Future directions — LLM composition (not in v1)**
324
+
325
+ v1 ships two deterministic SQL-based resolvers (`ExactMatchResolver`, `SynonymResolver`). The `EntityResolver` `Protocol` is the integration point for LLM-backed variants. All BQ-side LLM calls use `AI.EMBED` / `AI.GENERATE` (GA, no remote-model creation) — the same functions the SDK already uses in `feedback.py`, `insights.py`, and `extract_biz_nodes`.
326
+
327
+ | Pattern | What it catches | BQ function | Cost per call | Primary risk |
328
+ | :---- | :---- | :---- | :---- | :---- |
329
+ | **P1. Embedding fuzzy** — compile-time `AI.EMBED` over each label, runtime `ML.DISTANCE` against an input embedding | Typos, casing, rough paraphrases ("consumer banking" ≈ "retail banking") | `AI.EMBED` once per label at compile; one `AI.EMBED` per input \+ one `ML.DISTANCE` query at runtime | Low — one embedding per query, no generation | Confident-but-wrong matches across unrelated domains. Mitigation: threshold \+ `limit=N` |
330
+ | **P2. LLM disambiguation pass** — run P0/P1 first; invoke `AI.GENERATE` only when multiple candidates tie or zero match | Ambiguous multi-match ("which Priya?"), empty-result recovery | `AI.GENERATE` on hard cases only | Medium — most calls stay SQL-only | LLM picks something outside top-K. Mitigation: require output to be one of the provided candidates |
331
+ | **P3. LLM pre-normalization** — `AI.GENERATE` maps input to canonical form before `ExactMatchResolver` | Informal/free-text → canonical form | `AI.GENERATE` every call | High — LLM on the hot path | Canonical form may not exist in the index. Mitigation: verify match, fall back to P1 candidates |
332
+ | **P4. Ontology-grounded LLM resolver** — custom resolver calls `AI.GENERATE` with `rt.in_scheme(...)` enumeration as prompt context, typed `output_schema` | Cross-language, cross-phrasing, anything semantic | `AI.GENERATE` every call, large prompts | Highest — generation \+ grounding overhead | Same hallucination discipline: LLM-output entity must exist in the provided scheme enumeration |
333
+
334
+ **Rule of thumb:** exact codes / notations → P0 (shipped). Typos, phrasing drift → P1. Ambiguous multi-match → P2. Truly fuzzy / cross-language → P4.
335
+
336
+ **What's in-scope for a follow-up RFC, not v1:**
337
+
338
+ - Promoting P1 into core as a reference `EmbeddingResolver`. Requires: compile-time index-augmentation step (a `--embed-labels` flag on `gm compile`?); versioning of the embedding endpoint, because drift between compile-time and query-time embeddings is a **new verification concern** — possibly a W4 watchpoint alongside W1-W3; the `sdk_ai_function` telemetry dimension already lists `ai-embed`, but the compile-site label needs wiring.
339
+ - Whether P2 / P3 / P4 belong in `contrib/` or stay user code.
340
+ - Embedding-model rotation policy: if the operator changes the `AI.EMBED` endpoint, is it a `ConceptIndexRefreshed`\-style signal or silent drift? Likely needs a new `embedding_endpoint` column in `__meta` and a verification hop.
341
+ - **A live-agent resolver package.** `bigquery_agent_analytics` is a trace-consumption SDK; it's not designed to be imported by a live agent at turn time. If real users need turn-time resolution (e.g., an agent grounding a brief argument before calling a tool), the right home is a separate agent-facing package that reuses the `EntityResolver` `Protocol` contract but lives on the live-agent side. Scoping, packaging, and BQ-latency mitigations (caching layer? materialized name→entity map in memory?) belong to that future RFC, not this one.
342
+ - **A trace-field resolver wrapper** (separate class, not methods on `OntologyRuntime`). Takes a `Trace` / `Span` \+ a `{field_path: scheme}` mapping, extracts each field, calls the Protocol per field, returns structured results aligned to the trace. Deliberately kept out of v1: the right field set and extractor policies differ across ontologies and won't stabilize until pipelines built on v1 report which fields actually carry resolvable values. Keeping it as a separate class (tentatively `TraceFieldResolver`) avoids co-mingling ontology access, extraction policy, and resolver orchestration in one surface.
343
+
344
+ The feedback gist that motivated \#58 implemented P0 \+ P1 \+ P2 \+ P3 \+ P4 as a 5-layer stack. v1 ships P0; users wanting the rest wire them against the Protocol today, and a follow-up issue promotes P1 into core once the telemetry / versioning questions are resolved.
345
+
346
+ ## **13\. References**
347
+
348
+ [Issue \#58](https://github.com/GoogleCloudPlatform/BigQuery-Agent-Analytics-SDK/issues/58) · [Issue \#57](https://github.com/GoogleCloudPlatform/BigQuery-Agent-Analytics-SDK/issues/57) · [PR \#68](https://github.com/GoogleCloudPlatform/BigQuery-Agent-Analytics-SDK/pull/68) · [PR \#71](https://github.com/GoogleCloudPlatform/BigQuery-Agent-Analytics-SDK/pull/71) · [In-repo plan](https://github.com/GoogleCloudPlatform/BigQuery-Agent-Analytics-SDK/blob/main/docs/implementation_plan_concept_index_runtime.md) · [Feedback gist](https://gist.github.com/haiyuan-eng-google/54c3d3366b3d75b659561ef4e24e9374)