Anchorage API reference
    Preparing search index...

    Application input processor accepted by createGuardedAgent.

    It can transform or reject the initial input only. Per-step, provider, output, tool-result, and error hooks are unavailable because they can mutate execution after the mandatory input gates have run.

    Its return value is applied to the call's message list as Mastra's durable runner applies one, on every loop, except that a returned message Mastra holds as both remembered and call input stays both, such as a remembered assistant message with the caller's client tool outcome. A processor that throws other than through its abort or a TripWire, or returns a value that cannot be applied, stops the call with one agent.input.processor error event and the reason input processor failed.

    The input policies read what the processor adds to the prompt, or changes in it, outside the call's input, as they read the input: system messages with their provider options, and messages of every other source, a history message it rewrites through any source included, and a remembered message carrying the caller's client tool outcome it keeps but moves out of the call's input, read whole, stored history included. Client tool result mapping applies to messages of the call's input; a moved message gets no new toModelOutput mapping, and cached output is read and sent. A system message it adds or changes must hold text alone in data properties, and what it adds or changes must be a value structuredClone can copy, or the call stops as above.

    A call that RBAC, an input policy or an application input processor refuses has its input, its response messages, and every other non-system message its application input processors added or changed, the refusing processor's own included, and a remembered message carrying the caller's client tool outcome a processor keeps but moves out of the input, even before aborting or throwing, removed from Mastra's message list before it stops. It saves none of them to memory, Mastra's durable loop generates no thread title from them, and on generate() and stream() the result's messages and rememberedMessages omit them, a history message such a processor changed included.

    interface GuardedInputProcessor {
        computeStateSignal?: undefined;
        description?: string;
        id: string;
        name?: string;
        onViolation?: (violation: ProcessorViolation) => void | Promise<void>;
        processAPIError?: undefined;
        processDataParts?: boolean;
        processInput: (
            args: ProcessInputArgs,
        ) =>
            | void
            | ProcessInputResult
            | Promise<(void | ProcessInputResult | null | undefined)>
            | null
            | undefined;
        processInputStep?: undefined;
        processLLMRequest?: undefined;
        processLLMResponse?: undefined;
        processOutputResult?: undefined;
        processOutputStep?: undefined;
        processOutputStream?: undefined;
        processToolResult?: undefined;
    }
    Index

    Properties

    computeStateSignal?: undefined
    description?: string
    id: string
    name?: string
    onViolation?: (violation: ProcessorViolation) => void | Promise<void>
    processAPIError?: undefined
    processDataParts?: boolean
    processInput: (
        args: ProcessInputArgs,
    ) =>
        | void
        | ProcessInputResult
        | Promise<(void | ProcessInputResult | null | undefined)>
        | null
        | undefined
    processInputStep?: undefined
    processLLMRequest?: undefined
    processLLMResponse?: undefined
    processOutputResult?: undefined
    processOutputStep?: undefined
    processOutputStream?: undefined
    processToolResult?: undefined