Interface QueryRouterResult

Final result returned by the QueryRouter after classification, retrieval, and answer generation.

This surface is intentionally provenance-oriented: it includes not only the generated answer and citations, but also the tier path actually exercised and the fallback names that were activated during routing.

interface QueryRouterResult {
    answer: string;
    classification: ClassificationResult;
    sources: SourceCitation[];
    researchSynthesis?: string;
    durationMs: number;
    tiersUsed: QueryTier[];
    fallbacksUsed: string[];
    grounding?: VerifiedResponse;
    recommendations?: {
        skills: {
            skillId: string;
            reasoning: string;
            confidence: number;
        }[];
        tools: {
            toolId: string;
            reasoning: string;
            confidence: number;
        }[];
        extensions: {
            extensionId: string;
            reasoning: string;
            confidence: number;
        }[];
    };
}

Properties

answer: string

The generated answer text, grounded in retrieved sources.

classification: ClassificationResult

The classification result that determined routing behaviour.

sources: SourceCitation[]

Citations for the sources used in generating the answer.

researchSynthesis?: string

Synthesized narrative from the deep research phase, when tier-3 routing exercised external or host-provided research.

durationMs: number

Total wall-clock duration of the entire query pipeline in milliseconds.

tiersUsed: QueryTier[]

Which tiers were actually exercised during this query.

Example

[0] for trivial, [1, 2] for multi-source with fallback
fallbacksUsed: string[]

Names of fallback strategies that were activated during this query. Empty array if no fallbacks were needed.

Example

['keyword-fallback', 'tier-escalation']
grounding?: VerifiedResponse

Citation verification results. Populated when deep research runs or when verifyCitations is explicitly requested in config or query options.

recommendations?: {
    skills: {
        skillId: string;
        reasoning: string;
        confidence: number;
    }[];
    tools: {
        toolId: string;
        reasoning: string;
        confidence: number;
    }[];
    extensions: {
        extensionId: string;
        reasoning: string;
        confidence: number;
    }[];
}

Recommended skills, tools, and extensions based on query analysis.

Populated when the plan-aware classifier (classifyWithPlan) produces capability recommendations. When no recommendations are made (or the plan-aware classifier is not used), this field is undefined.

Each recommendation includes a confidence score (0-1) and a human-readable reasoning string explaining why the capability was recommended.

Type declaration

  • skills: {
        skillId: string;
        reasoning: string;
        confidence: number;
    }[]
  • tools: {
        toolId: string;
        reasoning: string;
        confidence: number;
    }[]
  • extensions: {
        extensionId: string;
        reasoning: string;
        confidence: number;
    }[]