v0.10.0 — Metric Taxonomy and Impact Graph
What's New
Metric taxonomy and impact graph — agents can now reason about metric roles (north-star vs team KPI, leading vs lagging) and walk a causal graph between metrics to ground recommendations in evidence. When asked "why did revenue drop?", an agent can follow upstream edges like active_customers → total_revenue (positive, verified): A/B test exp-042, +3.2% lift rather than blindly requerying revenue.
Added
- Metric role metadata on
MetricDefinition: optionaldomains/tier(north_star/department_kpi/team_kpi) /indicator_kind(leading/lagging). All defaulted — existing contracts parse unchanged. MetricImpactdataclass — directed, annotated edges withdirection,confidence(verified/correlated/hypothesized), free-textevidencethe agent can cite verbatim. Declared via a top-levelmetric_impacts:block in the semantic YAML.trace_metric_impactstool (13th tool) — BFS through the impact graph.direction="upstream"returns drivers (root-cause analysis);direction="downstream"returns affected metrics (action-impact reasoning).max_depthclamped to[1, 10].build_metric_impact_index()andwalk_metric_impacts()helpers insemantic.base, mirroring the existingbuild_relationship_index/find_join_pathpattern. Dual-keyed index, cycle-safe BFS.get_metric_impacts()onSemanticSource—YamlSourceparses from YAML;DbtSource/CubeSourcereturn[](impacts live in the contract YAML regardless of where metrics come from — dbt and Cube have no native causal-graph concept).meta.tier/meta.indicator_kind/meta.domainsread from each metric'smetadict inDbtSourceandCubeSource. String→list coercion fortier/domainsis consistent across YAML, dbt, and Cube.- Factory validation warnings for unknown metric references in
metric_impacts, mirroring the existing domain-reference validation. - Public API surface:
MetricDefinition,MetricImpact,Relationship,SemanticSourcenow re-exported from the top-levelagentic_data_contractspackage.
Changed
- Tool count: 13 tools (was 12).
lookup_metricresponse enriched withdomains,tier,indicator_kind, and citation-readyimpacts/impacted_byedges (e.g."positive impact on total_revenue (verified): A/B test exp-042, +3.2% lift"). Optional fields omitted when empty.list_metricsfilters: optionaltierandindicator_kindalongside the existingdomainfilter. Entries includetierandindicator_kindwhen set.list_metricsdomain semantics: filtering now unions contract-sideDomain.metricswith self-declaredmetric.domains. Metrics that self-declare a domain are discoverable via the filter even if the contract'sDomain.metricslist doesn't include them.- Example (
examples/revenue_agent/) demonstrates the new fields, an impact edge, and atrace_metric_impactsstep in the demo.
Breaking
SemanticSourceprotocol extension: gains requiredget_metric_impacts() -> list[MetricImpact]. Custom third-party implementations must add this method (returning[]is fine); without it,isinstance(source, SemanticSource)returnsFalse. All built-in sources (YamlSource,DbtSource,CubeSource) implement it — no migration for users of the built-in sources.
Full Changelog: v0.9.2...v0.10.0