feat(python): usage-estimation bindings in ratel-ai#81
Draft
kayraucklnc wants to merge 1 commit into
Draft
Conversation
This was referenced Jun 27, 2026
PyO3 wrappers for estimate_tokens/estimate_cost_usd and registry catalog_tokens()/tokens_for(); ToolCatalog(observe=True) records the full-catalog-vs-top-K saving into last_savings (in-memory only). No rollup wire format — usage/cost telemetry rides ratel-ai-cloud (ADR-0015). Closes RAT-308. Part of RAT-291.
c45d593 to
fe4fb6b
Compare
723d4d4 to
3c8a263
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part 3 of 3 — surfaces the core usage-estimation maths in the
ratel-aiPython SDK. Stacked on #79.What's here
estimate_tokens/estimate_cost_usdand registrycatalog_tokens()/tokens_for(), exported fromratel_ai.ToolCatalog(observe=True)records the full-catalog-vs-selected-top-K saving on each search intolast_savings— in-memory only, best-effort, never emitted.Retired vs the original PR
The whole
observability/package (the rollup client/exporter that shipped to/api/v1/events) is dropped — usage/cost telemetry rides theratel-ai-cloudADR-0013 event. See ADR-0015.Verified locally
maturin develop✓ ·ruff✓ ·mypy(strict) ✓ ·pytest56/56 ✓ · workspacefmt/clippy -D warnings✓Closes RAT-308. Part of RAT-291.