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
| Object | Import | Role |
|---|---|---|
Graph | from agrag.ingestion import Graph | Opens a graph. Adds, updates, and deletes documents. Consolidates duplicates and detects communities. See agrag.ingestion. |
GraphSchema, DEFAULT_SCHEMA, OPERATIONS, LEGAL | from agrag.common.data_models import DEFAULT_SCHEMA, GraphSchema, LEGAL, OPERATIONS | The 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. |
Neo4jGraphStore | from agrag.graphdb import Neo4jGraphStore, build_graph_store | The graph store. It reads the NEO4J_* settings. See agrag.graphdb. |
| Vector stores | from agrag.vectordb import QdrantVectorStore, WeaviateVectorStore, MilvusVectorStore, build_vector_store | Optional dedicated vector stores for dense and hybrid search. See agrag.vectordb. |
build_embedder | from agrag.embedding import build_embedder | Builds a dense embedder from a model name. See agrag.embedding. |
| Extractors | from agrag.ingestion import GlinerExtractor, BAMLExtractor | Read 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. |
ErrorPolicy | from agrag.loaders import ErrorPolicy | The action for a source that fails: RAISE, SKIP, or QUARANTINE. See agrag.loaders. |
SearchEngine, RetrievalSettings | from agrag.retrieval import SearchEngine, RetrievalSettings | Runs retrieval recipes over the graph. See agrag.retrieval. |
build_agent | from agrag.agents import build_agent | Builds the planner, researcher, and verifier agent. Accessing it needs the agents extra. See agrag.agents. |
get_tracer | from agrag.observability import get_tracer | Returns 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
| Object | Import | Role |
|---|---|---|
AddResult | from agrag.ingestion import AddResult | The counts and failures that Graph.add returns. |
AgentRunResult | from agrag.agents import AgentRunResult | The messages and the citation ledger that an agent run returns. |
Ledger | from agrag.agents import Ledger | Maps citation keys such as E1 and C3 to the evidence behind them. |
AgentLLMSettings | from agrag.agents import AgentLLMSettings | The LLM clients that the agent uses. |
SearchFilters | from agrag.retrieval import SearchFilters | Limits 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,
Chunkingrules, and the default preset. - agrag.eval: metrics that score answers, retrieval, and agent runs. Needs the
evalextra.
Related
- Tutorial: Quickstart.
- How-to: Ingest documents, Retrieve and answer.
- Explanation: Architecture.