Skip to main content
Version: 0.0.6

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 only __version__. Import each other 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.
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.
Evidence functionsfrom agrag.evidence import discover, fetch, navigate, find_entities, explore, check_citations, render_citations, source_statusFind passages, fetch the exact text behind an evidence id, move between passages, find entities, and check citations. source_status reports a document's current, pending, failed, deleted, or unknown state. See agrag.evidence.
TaskMemory, DecisionMemoryfrom agrag.memory import TaskMemory, DecisionMemoryRecord task events and steps, and record, replace, review, and search decisions. See agrag.memory.
build_agentfrom agrag.agents import build_agentBuilds the task-scoped evidence 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​

Components that record spans accept an OpenTelemetry Tracer in a tracer= argument. None uses a no-op tracer, so the component records no spans. Components do not all expose tracing.

Results and settings​

ObjectImportRole
AddResultfrom agrag.ingestion import AddResultThe counts and failures that Graph.add returns.
AgentRunResultfrom agrag.agents import AgentRunResultWhat an agent run returns: the answer with numbered sources, the status, the validated citations, the invalid citations, any recording failures, the task name with its last event number, and the messages.
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.