Ratel: an in-process BM25 tool catalog that cuts AI agent context spend 87% on BFCL v3

ratelratel-aicontext-engineeringtool-callingtool-selectionbm25+22
Benchmark.ratel.sh 'Token Spend by Model' dumbbell chart on 2026-07-11, showing the Version 0.4.0 (stable) header and the four-row dumbbell: Claude Sonnet 4.6 (3.7k With Ratel vs 29.3k Baseline, Oracle floor 1.8k), Qwen3 4b (2.5k vs 28.1k, Oracle 714), Claude Haiku 4.5 (3.7k vs 25.6k, Oracle 1.4k), and GPT 5.4 Mini (1.7k vs 15.0k, Oracle 431). The legend lists Oracle (gold tools only), With Ratel (search_tools gateway), and Baseline (full tool pool).
Source: benchmark.ratel.sh (project's own published benchmark page) · Captured 2026-07-11 via Playwright Chromium with @sparticuz/chromium (the ai-newsroom scripts/browser.mjs helper) · Benchmark framework: BFCL v3, 599 scenarios, 100-tool pool · License: project is Apache-2.0 (core) + MIT (SDKs); the benchmark page screenshot is a primary source used editorially for the Ratel article · Desktop 1280×900, mobile 375×812.

Ratel is the in-process tool catalog that addresses the “tools in context” problem on every agent stack. As of 2026-07-11 the ratel-ai/ratel repository sits at 186 stars, 9 forks, 18 open issues, primary language Rust, created 2025-11-12, last pushed 2026-07-10 (GitHub REST API). The project’s benchmark page is now pinned to Version 0.4.0 (stable), Evaluated with BFCL v3 — 100-tool pool, 599 scenarios, Claude Sonnet 4.6 drops from 29,301 mean tokens to 3,688 (−87%) with tool selection 97.5% (Ratel) vs 98.0% (no Ratel) and task completion 92.5% vs 92.0%.

![Benchmark.ratel.sh ‘Token Spend by Model’ dumbbell chart on 2026-07-11 showing the four-model comparison and the legend Oracle / With Ratel / Baseline under the Version 0.4.0 (stable) header.]({{ ‘/images/articles/ratel-context-engineering-tool-catalog/hero-benchmark-desktop.png’ | url }})

What happened

A 4-release burst on 2026-07-09/10 (releases index, 2026-07-11): core-v0.4.0 on 2026-07-09, sdk-py-v0.4.1 on 2026-07-10T23:07:31Z, sdk-ts-v0.4.1 on 2026-07-10T23:08:30Z, telemetry-ts-v0.1.1 on 2026-07-10T22:54:38Z, and telemetry-py-v0.1.1 on 2026-07-10T22:54:40Z. The 0.4.0 line is the first stable “with Ratel” benchmark on the project site. Two changes matter: PR #86 (ratel-ai/ratel#86) renamed the discovery surface from gateway to capability tools, and PR #101 (#101) made re-register replace tools/skills in place. The repo is 8 months old and daily-active.

The README’s hero line is direct: “Your AI agent is paying for tools it never uses. Ratel fixes that.” (README, 2026-07-11). The Introduction: “The context engineering layer for AI agents. Selects only the tools and skills relevant to each turn, recovering accuracy lost to tool overload and cutting what you pay per call. No vector DB, no infra.”

Why it matters

Two problems converge here, and Ratel addresses both at the same layer.

Ratel is the only open-source in-process BM25 catalog (no vector DB, no embedding pipeline) that drops into either TypeScript or Python agent code with a one-line ToolCatalog registration and a two-call interface (search_capabilities + invoke). The Rust core is in-process, deterministic, and adds no infra.

What Ratel actually is

SurfaceWhat Ratel exposes
Engineratel-ai-core (Rust, crates.io) — BM25 index by default, opt-in semantic / hybrid per catalog or per call
TypeScript SDK@ratel-ai/sdk on npm — NAPI-bound; prebuilt .node binaries for darwin-arm64, darwin-x64, linux-arm64-gnu, linux-x64-gnu, win32-x64-msvc
Python SDKratel-ai on PyPI — PyO3-bound; pip install ratel-ai
Local distribution@ratel-ai/mcp-server / ratel-mcpnpx -y @ratel-ai/mcp-server mcp import drops Ratel in front of an existing Claude Code / Cursor / ChatGPT MCP setup with no code changes
Catalog contractprotocol/ — wire contract for catalog sources (Slack, Notion, custom tool stores)
TelemetryOpenTelemetry ratel.* / gen_ai.* funnel spans (ADR-0007)
LicenseApache-2.0 for ratel-ai-core (explicit patent grant for the engine others embed), MIT for SDKs / telemetry helpers / examples (see ADR-0009)

The core install is two lines per language:

pnpm add @ratel-ai/sdk
pip install ratel-ai

A ToolCatalog object, register() to add tools, search_capabilities_tool(catalog) to expose the search, invoke_tool_tool(catalog) to expose the call. Both SDKs expose the same two-call interface; the README’s TypeScript and Python snippets use the same names on both sides.

Practical implications for builders

Four install paths cover the common setups. Pick one.

PathCommandWhat it addsBest for
TypeScript SDKpnpm add @ratel-ai/sdkNAPI binding to ratel-ai-coreAny TS / Node agent (Claude Code plugins, Vercel AI SDK)
Python SDKpip install ratel-aiPyO3 binding to ratel-ai-coreAny Python agent (Pydantic AI, smolagents, custom harnesses)
MCP shimnpx -y @ratel-ai/mcp-server mcp importNo-code wrapper that fronts an existing MCP setupClaude Code, Cursor, ChatGPT with MCP servers today
Rust embedcargo add ratel-ai-coreEngine only, no SDKNative Rust agents (oh-my-pi, custom runtimes)

The BFCL v3 benchmark is the load-bearing evidence. Mean total tokens per task, four models:

ModelBaseline (full pool)With Ratel (search_tools)Oracle (gold only)Tool selection (With Ratel vs no Ratel)
Claude Sonnet 4.629,3013,6881,82997.5% vs 98.0% (−0.5 pt)
Claude Haiku 4.525,6063,6741,38696.7% vs 84.1% (+12.6 pt)
GPT 5.4 Mini15,0061,66943195.3% vs 96.5% (−1.2 pt)
Qwen3 4b28,0602,53571491.5% vs 95.8% (−4.3 pt)

The README’s protocol/ catalog-source contract means future catalog sources (Slack, Notion, custom tool stores) plug in without re-indexing. The Rust core’s BM25 index is in-process, deterministic, and adds no latency to the agent loop. Semantic and hybrid ranking are opt-in per catalog or per call, running a local embedding model in the same process.

Risks and caveats

What to watch

Sources