Skip to main content
Version: 0.0.5 (stable)

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, DEFAULT_SCHEMA, OPERATIONS, LEGALfrom agrag.common.data_models import DEFAULT_SCHEMA, GraphSchema, LEGAL, OPERATIONSThe entity types, relation types, and valid patterns of a graph. DEFAULT_SCHEMA has nine entity types and eight relation types. OPERATIONS and LEGAL add entity types to it. 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, BAMLExtractorRead one chunk and return entities and relations. GLiNER runs locally. BAML calls an LLM. Graph selects extractors by mode and can build an LLM extractor from environment settings. See Choose an extraction mode.
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.candidates: list, approve, reject, and prune extraction candidates, and write schema patches.
  • agrag.chunking: the chunkers, Chunking rules, and the default preset.
  • agrag.eval: metrics that score answers, retrieval, and agent runs. Needs the eval extra.