Docs/Product guide

Product guide

Retrieval and source tracing

Use fast and precise retrieval, then verify every result against its source evidence.
Updated 2026-07-22Applies to SAG v1.2.2

SAG provides global retrieval and retrieval within a source. Every result preserves its chunk ID, source, and ranking information and can open the original text directly. This makes retrieval quality verifiable before an Agent uses the result.

Fast and precise modes

UI namePython strategyBest for
Fast (default)vectorClear topics, single-hop facts, and lower latency
PrecisemultiMulti-hop relationships, cross-passage evidence, and a more complete candidate set

Precise mode combines entity relationships with LLM reranking, but it remains part of SAG's own retrieval pipeline. It does not start a separate GraphRAG service.

  1. Select the global scope or one specific source.
  2. Describe the fact you need in natural language instead of entering only broad keywords.
  3. Start with fast mode; switch to precise mode when results lack relational evidence.
  4. Open the source text for the top results and verify that the content, title, and source agree.

Global and source scope

The global endpoint accepts source_ids to narrow candidate partitions. A source endpoint is inherently restricted to one knowledge base. A precise scope usually reduces noise and makes citation provenance easier to explain.

json
{
  "query": "Why is SAG suitable for multi-hop retrieval?",
  "source_ids": ["<SOURCE_ID>"],
  "strategy": "multi",
  "top_k": 5
}

top_k ranges from 1 to 50. Larger values increase transfer, reranking, and downstream context costs. Raising it should not be the first attempt to repair a low-quality query.

Read the response

SearchResponse primarily contains:

  • sections: final source chunks with heading, content, score, rank, and source;
  • events: event candidates used during structural retrieval;
  • entities and relations: local relationships suitable for graph display;
  • source_hits: hit counts by source;
  • stats: retrieval latency and pipeline statistics.

Scores are useful for comparison within one query. Do not treat a fixed score as a universal quality threshold across models and versions.

Query guidance

  • Prefer semantic retrieval for questions and conceptual descriptions.
  • Use the MCP grep tool for code identifiers, serial numbers, and exact proper names.
  • Narrow the source scope before increasing top_k.
  • Open the source text for every important result used in a decision or generated answer.

See MCP and Agent Skill for the external Agent retrieval funnel.

Found an issue? Treat the public repository as the source of truth.View SAG source