Anchorage API reference
    Preparing search index...

    Input passed to one policy evaluation.

    interface PolicyContext {
        channel: OutputChannel;
        messages: MastraDBMessage[];
        phase: PolicyPhase;
        requestContext?: RequestContext<unknown>;
        streamState?: Record<string, unknown>;
        text: string;
    }
    Index

    Properties

    channel: OutputChannel

    Output channel text came from. Always 'answer' in the input phase.

    messages: MastraDBMessage[]

    The gated messages. Empty during streaming output — processOutputStream exposes no discrete messages; the shipped evaluators read only text.

    Lifecycle phase being evaluated.

    requestContext?: RequestContext<unknown>

    Mastra request context associated with the agent call.

    streamState?: Record<string, unknown>

    Streaming only: a scratch object private to this policy instance that persists across the chunks of one stream (absent in the input/result phases). Evaluators MAY keep incremental-scan cursors here (see denyPatterns); evaluators that ignore it stay pure and re-scan text.

    text: string

    Concatenated text of the gated content: input messages, one channel of the streamed output accumulated so far, or the final output result.