-
-
Notifications
You must be signed in to change notification settings - Fork 0
Async and Adapter Integration
Hermes is turnkey, but the core can be connected to another agent runtime.
Your host needs:
- stable
session_id, request ID, and tool-call ID values; - a tool-result transformation boundary;
- a final provider-request middleware boundary;
- a model-visible recovery tool backed by
Runtime.tool.
The host must treat None or an adapter exception as pass-through.
from pathlib import Path
from rtk_hermes_plus.config import Config
from rtk_hermes_plus.plugin import Runtime
runtime = Runtime(
Config(
mode="balanced",
db_path=Path(".token-terminator/artifacts.sqlite3"),
ledger_enabled=False,
),
profile_name="my-agent",
)
reduced = runtime.transform_tool_result(
tool_name=name,
args=arguments,
result=result,
session_id=session_id,
tool_call_id=call_id,
)
provider_result = reduced if reduced is not None else resultCall runtime.llm_request_middleware(...) immediately before provider dispatch and use its returned request only when the decision is non-None.
from rtk_hermes_plus import AsyncRuntime, CancellationToken
async_runtime = AsyncRuntime(runtime)
cancel = CancellationToken()
reduced = await async_runtime.transform_tool_result(
tool_name="search_files",
args={"pattern": "ContextEngine"},
result=large_result,
session_id=session_id,
tool_call_id=call_id,
cancellation=cancel,
)Compiler, SQLite, and telemetry work can run in an executor. Active RTK subprocesses use cancellation-aware async paths. If a caller cancels while an atomic SQLite operation is already running in a worker, that worker may finish; its result is discarded at the adapter boundary.
Token Terminator does not intercept provider response streams.
For the built-in native compressor, adapters should map equivalent host tools to canonical names such as:
search_filesprocess- optionally
read_filein aggressive mode -
terminalfor terminal rewriting/temporal logic
Do not silently change the semantics of the host tool while mapping names.
Token Terminator v0.6.0 · Repository · Releases · crates.io · MIT
Documentation is source-controlled from the repository wiki/ directory.
Token Terminator
Core mechanics
- Vault & Exact Recovery
- Temporal Delta Compression
- Request Compiler & Context Compaction
- Async & Adapter Integration
Operations
Development