Python SDK for Ratel — context engineering platform for AI agents. BM25 tool retrieval, MCP ingestion, framework-neutral capability tools.
Project description
ratel-ai retrieves the tools and skills relevant to each agent turn instead of sending the full catalog to the model. It bundles Ratel's Rust engine in-process: BM25 by default, with configurable semantic and hybrid retrieval available when needed. The default and local-model paths require no API key, vector database, or service. Installing a published package on a supported prebuilt target also requires no Rust toolchain.
Use ToolCatalog for ranked tools with sync or async handlers and SkillCatalog for ranked Markdown playbooks loaded on demand. Expose search_capabilities_tool, invoke_tool_tool, and get_skill_content_tool so an agent can discover tools and skills, invoke tools, and load full skill instructions. Tools from existing MCP servers can be ingested into the tool catalog with the mcp extra.
Semantic and hybrid retrieval use a configurable embedding model (ADR 0012), set per catalog via the embedding argument: the built-in default, a HuggingFace repo or local directory (in-process), or an OpenAI-compatible endpoint (OpenAI, Ollama, TEI, vLLM).
For semantic or hybrid retrieval, register() folds embedding in: it accepts one tool or a whole batch and embeds on a worker thread, so model loading, HTTP, and inference never block the asyncio loop or hold the GIL — and embedding errors surface right at register():
async def retrieve(tools):
catalog = ToolCatalog(method="semantic", embedding={"ollama": "nomic-embed-text"})
await catalog.register(tools) # embeds the batch here
return await catalog.search_async("deploy the service", 5)
register() is async for every method (BM25 too); search() stays synchronous for BM25 only, and search_async() covers all three. To change the endpoint's model or vector dimension, construct a new catalog and re-register.
Install
pip install ratel-ai
# MCP ingestion: pip install 'ratel-ai[mcp]'
Quickstart
Save as quickstart.py, then run python quickstart.py:
import asyncio
from ratel_ai import ExecutableTool, ToolCatalog
async def main():
catalog = ToolCatalog()
await catalog.register(
ExecutableTool(
id="get_weather",
name="get_weather",
description="Get the current weather for a city.",
input_schema={"properties": {"city": {"type": "string"}}},
output_schema={"type": "object"},
execute=lambda args: {"forecast": f"Sunny in {args['city']}"},
)
)
hit = catalog.search("What is the weather in Rome?", 1)[0]
print(await catalog.invoke(hit.tool_id, {"city": "Rome"}))
asyncio.run(main())
Continue with the Python guide, capability tools, API reference, or the Pydantic AI example.
Telemetry export is optional. With the otlp extra installed, configure_telemetry() reads RATEL_OTLP_ENDPOINT (falling back to the superseded RATEL_URL, which warns) and RATEL_API_KEY, wires trace and Logs exporters, and returns a shutdown handle. It exports only gen_ai.*/ratel.* signal spans and EventRecords by default — export_all_spans=True widens spans only. Message/tool content stays off by default; opt in with capture_content/include_span_and_events (see the telemetry guide for the capture modes and their privacy implications). Hosts that already own OpenTelemetry providers add both ratel_span_processor and ratel_log_record_processor instead.
Package layout: ratel_ai/ is the Python surface, native/ contains the PyO3 binding, and tests/ exercises both. For local development, create .venv with uv, install maturin, pytest, pytest-asyncio, ruff, and mypy, then run .venv/bin/maturin develop and .venv/bin/pytest.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ratel_ai-0.6.0.tar.gz.
File metadata
- Download URL: ratel_ai-0.6.0.tar.gz
- Upload date:
- Size: 195.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8d2890b0d72d6f6632818232aa4681b7251df73b08c5d6bfc79c492064d686a4
|
|
| MD5 |
d0a5bcb8ea45d06e68f0a4b23bb76f8f
|
|
| BLAKE2b-256 |
d9dfc744e81ef1f830875076723c0403a28a9560ba0839aa8e2721b30d7a736e
|
Provenance
The following attestation bundles were made for ratel_ai-0.6.0.tar.gz:
Publisher:
release.yml on ratel-ai/ratel
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ratel_ai-0.6.0.tar.gz -
Subject digest:
8d2890b0d72d6f6632818232aa4681b7251df73b08c5d6bfc79c492064d686a4 - Sigstore transparency entry: 2277202985
- Sigstore integration time:
-
Permalink:
ratel-ai/ratel@764540f72a8fb9a89de26591a2fb49c07828ba42 -
Branch / Tag:
refs/tags/sdk-py-v0.6.0 - Owner: https://github.com/ratel-ai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@764540f72a8fb9a89de26591a2fb49c07828ba42 -
Trigger Event:
push
-
Statement type:
File details
Details for the file ratel_ai-0.6.0-cp39-abi3-win_amd64.whl.
File metadata
- Download URL: ratel_ai-0.6.0-cp39-abi3-win_amd64.whl
- Upload date:
- Size: 4.0 MB
- Tags: CPython 3.9+, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e2ee7c3b8861f0cae17f0fa7a84114993d8757cd13be4e8f64d2628d52defda5
|
|
| MD5 |
cbfd835ae5146b7a0c1a0c02b99a109f
|
|
| BLAKE2b-256 |
070782aa7cfe4b8957f0ad9dcf6c2576377e3b4c30dcc8b8664e1337719202ff
|
Provenance
The following attestation bundles were made for ratel_ai-0.6.0-cp39-abi3-win_amd64.whl:
Publisher:
release.yml on ratel-ai/ratel
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ratel_ai-0.6.0-cp39-abi3-win_amd64.whl -
Subject digest:
e2ee7c3b8861f0cae17f0fa7a84114993d8757cd13be4e8f64d2628d52defda5 - Sigstore transparency entry: 2277204978
- Sigstore integration time:
-
Permalink:
ratel-ai/ratel@764540f72a8fb9a89de26591a2fb49c07828ba42 -
Branch / Tag:
refs/tags/sdk-py-v0.6.0 - Owner: https://github.com/ratel-ai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@764540f72a8fb9a89de26591a2fb49c07828ba42 -
Trigger Event:
push
-
Statement type:
File details
Details for the file ratel_ai-0.6.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: ratel_ai-0.6.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 4.1 MB
- Tags: CPython 3.9+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f2750ec1f5b0edb94fd0e43cd51436b5f6351cfdec849fe716370e9fcd77f849
|
|
| MD5 |
fc50c4ff20a210c722d4fbdd93f1d750
|
|
| BLAKE2b-256 |
3591db0355b2ce9a3d4b0fd65c98f5c76409948382f8f9a19d5158f996d24bed
|
Provenance
The following attestation bundles were made for ratel_ai-0.6.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:
Publisher:
release.yml on ratel-ai/ratel
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ratel_ai-0.6.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl -
Subject digest:
f2750ec1f5b0edb94fd0e43cd51436b5f6351cfdec849fe716370e9fcd77f849 - Sigstore transparency entry: 2277204513
- Sigstore integration time:
-
Permalink:
ratel-ai/ratel@764540f72a8fb9a89de26591a2fb49c07828ba42 -
Branch / Tag:
refs/tags/sdk-py-v0.6.0 - Owner: https://github.com/ratel-ai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@764540f72a8fb9a89de26591a2fb49c07828ba42 -
Trigger Event:
push
-
Statement type:
File details
Details for the file ratel_ai-0.6.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: ratel_ai-0.6.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 3.8 MB
- Tags: CPython 3.9+, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0680783d3383f426430ceceb5ca42d04b88cf0d6a38e9282630aee1e25f0bb3a
|
|
| MD5 |
2946fcd65ec1874778cc56cd00600688
|
|
| BLAKE2b-256 |
f1883b36e57034836afa6eaf14a4cabb08185cbe946df5882cf748f1c400c100
|
Provenance
The following attestation bundles were made for ratel_ai-0.6.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:
Publisher:
release.yml on ratel-ai/ratel
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ratel_ai-0.6.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl -
Subject digest:
0680783d3383f426430ceceb5ca42d04b88cf0d6a38e9282630aee1e25f0bb3a - Sigstore transparency entry: 2277204028
- Sigstore integration time:
-
Permalink:
ratel-ai/ratel@764540f72a8fb9a89de26591a2fb49c07828ba42 -
Branch / Tag:
refs/tags/sdk-py-v0.6.0 - Owner: https://github.com/ratel-ai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@764540f72a8fb9a89de26591a2fb49c07828ba42 -
Trigger Event:
push
-
Statement type:
File details
Details for the file ratel_ai-0.6.0-cp39-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: ratel_ai-0.6.0-cp39-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 3.6 MB
- Tags: CPython 3.9+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8d6560396d188f221db86eb26643db866c5ec06e30e7d8928153411d4a7c4a48
|
|
| MD5 |
d41525dd3f4b5738d23276e73fc58bfa
|
|
| BLAKE2b-256 |
c7e5ef81b41112daf5b040280c89b634c3e1f1bb4201ad051cf99a902b570bc8
|
Provenance
The following attestation bundles were made for ratel_ai-0.6.0-cp39-abi3-macosx_11_0_arm64.whl:
Publisher:
release.yml on ratel-ai/ratel
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ratel_ai-0.6.0-cp39-abi3-macosx_11_0_arm64.whl -
Subject digest:
8d6560396d188f221db86eb26643db866c5ec06e30e7d8928153411d4a7c4a48 - Sigstore transparency entry: 2277203442
- Sigstore integration time:
-
Permalink:
ratel-ai/ratel@764540f72a8fb9a89de26591a2fb49c07828ba42 -
Branch / Tag:
refs/tags/sdk-py-v0.6.0 - Owner: https://github.com/ratel-ai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@764540f72a8fb9a89de26591a2fb49c07828ba42 -
Trigger Event:
push
-
Statement type:
File details
Details for the file ratel_ai-0.6.0-cp39-abi3-macosx_10_12_x86_64.whl.
File metadata
- Download URL: ratel_ai-0.6.0-cp39-abi3-macosx_10_12_x86_64.whl
- Upload date:
- Size: 3.8 MB
- Tags: CPython 3.9+, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
031439215ecb41ddd9278f8a1bcdc8ad81b24eee8919ac9eab1db4fb4ebca98e
|
|
| MD5 |
ecec94186d141ec3579de778b5ca042d
|
|
| BLAKE2b-256 |
f1cdb8d32498af17be618b2d6355a91579f4e77465cce77f83282bc75abb42cd
|
Provenance
The following attestation bundles were made for ratel_ai-0.6.0-cp39-abi3-macosx_10_12_x86_64.whl:
Publisher:
release.yml on ratel-ai/ratel
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ratel_ai-0.6.0-cp39-abi3-macosx_10_12_x86_64.whl -
Subject digest:
031439215ecb41ddd9278f8a1bcdc8ad81b24eee8919ac9eab1db4fb4ebca98e - Sigstore transparency entry: 2277205501
- Sigstore integration time:
-
Permalink:
ratel-ai/ratel@764540f72a8fb9a89de26591a2fb49c07828ba42 -
Branch / Tag:
refs/tags/sdk-py-v0.6.0 - Owner: https://github.com/ratel-ai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@764540f72a8fb9a89de26591a2fb49c07828ba42 -
Trigger Event:
push
-
Statement type: