Member Junction
    Preparing search index...

    Interface AgentPreExecutionRAGParams

    Parameters for executing pre-execution RAG for an agent.

    interface AgentPreExecutionRAGParams {
        activeSkillIDs?: string[];
        agent: MJAIAgentEntity;
        audienceReaders?: UserInfo[];
        contextUser: UserInfo;
        conversationSummary?: string;
        lastUserMessage: string;
        payload?: unknown;
        primaryScopeEntityId?: string;
        primaryScopeRecordId?: string;
        recentMessages?: ChatMessage[];
        secondaryScopes?: Record<string, SecondaryScopeValue>;
        streamingEnabled?: boolean;
        streamingTrace?: string[];
    }
    Index

    Properties

    activeSkillIDs?: string[]

    The skills active for this run (BaseAgent.activeSkillIDsForRun). Phase 1 of BaseAgent.Execute() activates requested and persisted conversation skills before this phase runs, so the set is already settled here. When exactly one skill is active it is the skill principal for the permission gate and the search, as in the Scoped Search action.

    The agent currently being executed.

    audienceReaders?: UserInfo[]

    The run's audience (ExecuteAgentParams.Audience): everyone besides contextUser who will see the injected context, as hydrated users. Each must pass the scope gate the caller passes — a refused reader skips the scope and writes a Forbidden row naming them — and each search carries them as SearchParams.Audience, so only results every reader may read are injected. The caller, or a reader listed twice, is checked once. Empty or omitted: no audience.

    contextUser: UserInfo

    Calling user — threaded through to SearchEngine + Metadata.

    conversationSummary?: string

    Optional conversation summary.

    lastUserMessage: string

    The most recent user message — used as the default query when no template is configured.

    payload?: unknown

    Agent's current payload state. Available to templates under payload.

    primaryScopeEntityId?: string

    Multi-tenant primary scope entity ID.

    primaryScopeRecordId?: string

    Multi-tenant primary scope record ID (flows into SearchContext.PrimaryScopeRecordID).

    recentMessages?: ChatMessage[]

    Optional recent messages (role + content) for template rendering.

    secondaryScopes?: Record<string, SecondaryScopeValue>

    Multi-tenant secondary scope dimensions.

    streamingEnabled?: boolean

    Phase 2C: when true, consume SearchEngine.streamSearch() instead of the synchronous Search() per scope. The final aggregate is identical — what changes is that intermediate provider traces are written to streamingTrace (when supplied) so the agent's pre-execution scratchpad can show "while you wait" progress. Default false.

    streamingTrace?: string[]

    Optional sink for streamingEnabled traces. Caller pushes nothing itself — the RAG hook appends one markdown line per provider event per scope. Caller decides what to do with the lines (typically concat into the agent's pre-prompt scratchpad).