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, and error hooks are unavailable because they can mutate execution after the mandatory input gates have run.

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

    Properties

    computeStateSignal?: undefined
    description?: string
    id: string
    name?: string
    onViolation?: (violation: ProcessorViolation) => void | Promise<void>
    processAPIError?: undefined
    processDataParts?: boolean
    processInput: (
        args: ProcessInputArgs<unknown>,
    ) => ProcessInputResult | Promise<ProcessInputResult>

    Type Declaration

      • (
            args: ProcessInputArgs<unknown>,
        ): ProcessInputResult | Promise<ProcessInputResult>
      • Process input messages before they are sent to the LLM

        Parameters

        • args: ProcessInputArgs<unknown>

        Returns ProcessInputResult | Promise<ProcessInputResult>

        Either:

        • MessageList: The same messageList instance passed in (indicates you've mutated it)
        • MastraDBMessage[]: Transformed messages array (for simple transformations)
        • { messages, systemMessages }: Object with both messages and modified system messages
    processInputStep?: undefined
    processLLMRequest?: undefined
    processLLMResponse?: undefined
    processOutputResult?: undefined
    processOutputStep?: undefined
    processOutputStream?: undefined