Skip to content

feat(observe): attribute runs and costs to explicit tenants - #139

Merged
Shashankss1205 merged 1 commit into
mainfrom
feat/tenant-cost
Oct 9, 2026
Merged

Shashankss1205 merged 1 commit into
mainfrom
feat/tenant-cost

Conversation

@Shashankss1205

@Shashankss1205 Shashankss1205 commented Oct 9, 2026 •

Copy link
Copy Markdown
Collaborator

Explicit tenant labels now travel with graph, planner and agent traces, so recorded runs can be attributed to a tenant without assigning older unlabelled runs to an implicit default. grapharc cost trace.jsonl --tenant acme --json reports that tenant's runs, tokens and costs; --run-id selects an individual run instead.

  • Propagate optional labels through all five compiled runtime entry points, planner and admission events, native and delegated agent events, and server broadcast payloads. Explicit CLI flag, environment and config tenants are recorded, including an explicitly selected default.
  • Add TenantCost and attribute_tenant, retaining per-run node/model detail and reading one trace snapshot. Reject inconsistent labels within a run; exclude legacy unlabelled runs. Tenant labels are attribution metadata, not authorization.
  • Keep provider-recorded USD and caller-supplied rate-card estimates separate. Include planner tokens in pricing and expose unpriced tokens rather than reporting an incomplete bill as complete.
  • Preserve the bytes of unlabelled recorder events and exact tenant labels, including long Unicode labels. CLI read failures use structured errors.
  • Update the README, roadmap, cookbook and verified test-count snapshot.

Validation: all 47 tenant regression cases fail against the integrated pre-feature tree and pass with this change. Focused replay/CLI/documentation checks: 303 passed; tenant plus UTF-8 trace checks: 74 passed. Ruff and git diff --check pass. The unchanged Python 3.12/3.13/3.14 CI matrix passes the full suite; lint, distribution packaging and the live-test guard also pass.

The local server timeout test also fails on the pre-feature tree because the installed LangGraph default permits 10,007 iterations. A separate local full-suite attempt with LANGGRAPH_DEFAULT_RECURSION_LIMIT=25 was stopped after the unchanged repository CI passed on all three Python versions. Provider prices missing from planner and failed-node trace events are tracked separately in #138; attribution preserves what producers actually record.

Closes #8.

Propagate optional tenant labels through runtime, planner, agent and server traces. Add tenant cost aggregation and CLI reports while preserving unlabelled legacy traces, separating recorded prices from estimates, and counting planner spend.
@Shashankss1205
Shashankss1205 merged commit 41ea115 into main Oct 9, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

observability: no tenant on a trace event, so per-tenant cost cannot be attributed

1 participant