Skip to main content

Core API

This page lists the objects that most programs use. Each row gives the import line and links to the full reference for that package.

The top-level agrag package exports nothing. Import each name from the package in the table.

Entry points​

ObjectImportRole
Graphfrom agrag.ingestion import GraphOpens a graph. Adds, updates, and deletes documents. Consolidates duplicates and detects communities. See agrag.ingestion.
GraphSchema, GENERICfrom agrag.common.data_models import GENERIC, GraphSchemaThe entity types, relation types, and valid patterns of a graph. GENERIC is a preset with five entity types. See agrag.common.
Neo4jGraphStorefrom agrag.graphdb import Neo4jGraphStore, build_graph_storeThe graph store. It reads the NEO4J_* settings. See agrag.graphdb.
Vector storesfrom agrag.vectordb import QdrantVectorStore, WeaviateVectorStore, MilvusVectorStore, build_vector_storeOptional dedicated vector stores for dense and hybrid search. See agrag.vectordb.
build_embedderfrom agrag.embedding import build_embedderBuilds a dense embedder from a model name. See agrag.embedding.
Extractorsfrom agrag.ingestion import GlinerExtractor, BAMLExtractor, EscalatingExtractorRead one chunk and return entities and relations. GLiNER runs locally. BAML calls an LLM. The escalating extractor runs GLiNER first and calls the LLM for weak chunks.
ErrorPolicyfrom agrag.loaders import ErrorPolicyThe action for a source that fails: RAISE, SKIP, or QUARANTINE. See agrag.loaders.
SearchEngine, RetrievalSettingsfrom agrag.retrieval import SearchEngine, RetrievalSettingsRuns retrieval recipes over the graph. See agrag.retrieval.
build_agentfrom agrag.agents import build_agentBuilds the planner, researcher, and verifier agent. Accessing it needs the agents extra. See agrag.agents.
get_tracerfrom agrag.observability import get_tracerReturns the tracer you pass, or a no-op tracer. See agrag.observability.

Tracing​

Every component takes an OpenTelemetry Tracer in a tracer= argument. When you pass None, the component records no spans.

Results and settings​

ObjectImportRole
AddResultfrom agrag.ingestion import AddResultThe counts and failures that Graph.add returns.
AgentRunResultfrom agrag.agents import AgentRunResultThe messages and the citation ledger that an agent run returns.
Ledgerfrom agrag.agents import LedgerMaps citation keys such as E1 and C3 to the evidence behind them.
AgentLLMSettingsfrom agrag.agents import AgentLLMSettingsThe LLM clients that the agent uses.
SearchFiltersfrom agrag.retrieval import SearchFiltersLimits a search to labels, documents, or properties.

Environment variables for every settings class are in the Configuration reference.

Other packages​

  • agrag.chunking: the chunkers, Chunking rules, and the default preset.
  • agrag.eval: metrics that score answers, retrieval, and agent runs. Needs the eval extra.