Ratel Docs
ReferenceTypeScript packages

@ratel-ai/mastra

Raw API of @ratel-ai/mastra — the official Mastra adapter: the mastra() factory for ratel().adaptTo() plus recallProcessor(), speaking @mastra/core tool and message shapes.

v0.2.0 · TypeScript · npm · source

Generated from the doc comments at ratel-ai/ratel@d8635d5 — do not edit by hand. Regenerate with pnpm sync:api in apps/docs.

@ratel-ai/mastra — the Mastra adapter for Ratel. Implements the @ratel-ai/sdk framework-adapter SPI (ADR-0013) for @mastra/core, so ratel(config).adaptTo(mastra()) speaks Mastra's native Tool (from createTool) and MastraDBMessage shapes and adds a per-turn recall input processor for an Agent's inputProcessors.

Interfaces

MastraExt

The Mastra-idiomatic per-turn recall helper mastra merges onto the adapted view via the SPI's extend hook.

Methods

recallProcessor()

recallProcessor(): InputProcessor

A fresh Mastra InputProcessor for an Agent's inputProcessors. Its processInput runs once at the start of each generation (= once per user turn): it ranks the catalog against the last user message and injects the synthetic search_capabilities call+result before the model runs. A no-op that spends no call id unless the last message is a user turn with text and there are hits. A factory (not a shared instance) so several agents each get their own processor.

Returns

InputProcessor

Type Aliases

MastraTool

MastraTool = ToolsInput[string]

A Mastra tool — the per-entry type of Mastra's ToolsInput (a createTool result, or an AI SDK / provider tool a Mastra Agent accepts). Deliberately broad so an app can register any tool its Agent could hold; ingest duck-types it.

Functions

mastra()

mastra(): RatelAdapter<ToolAction<any, any, any, any, any, string, unknown> | VercelTool | VercelToolV5 | ProviderDefinedTool, MastraDBMessage, MastraExt>

The Mastra adapter: ratel(config).adaptTo(mastra()) gives the framework-neutral core @mastra/core's native MastraTool (from createTool) and MastraDBMessage shapes. The core owns every guard (reserved ids, top-K clamp, first-registration-wins, recall-id counter), so the adapter is just the three codecs — ingest / expose / recallMessages — plus the MastraExt recall processor.

Returns

RatelAdapter<ToolAction<any, any, any, any, any, string, unknown> | VercelTool | VercelToolV5 | ProviderDefinedTool, MastraDBMessage, MastraExt>

A RatelAdapter over Mastra's tool and message types.

On this page