Repo of the Day
growgraph/ontocast: Agentic Ontology Assisted Framework for Semantic Triple Extraction
Published: Jul 18, 2026
Open repository ↗Agentic Ontology Assisted Framework for Semantic Triple Extraction - growgraph/ontocast
Summary
OntoCast is a Python framework that turns documents into RDF knowledge graphs, building both the ontology and the extracted facts through language models. It runs as an HTTP service, a batch command, or embedded inside LangChain and LangGraph agents, and is licensed under Apache-2.0.
What it is useful for
OntoCast fits work where both the schema and the data need to be constructed from text together. Concrete uses include:
- Pulling RDF triples from PDFs, Office files, HTML, Markdown, or images.
- Maintaining a versioned, evolving ontology alongside the facts it describes, with the model emitting insert/delete patches rather than rewriting the graph.
- Validating output with SHACL shapes and tracing each fact back to its source text via RDF 1.2 provenance.
- Multi-tenant projects using Apache Jena Fuseki for partitioned persistence.
- Augmenting LangChain or LangGraph agents with ontology editing tools so they can edit the schema as the user types.
Entity mentions across a document are merged into a single node, and ontology changes go through a render-and-critique loop before facts are extracted against them.
How engineers can use it
The README documents three modes. Install with the extras you need:
pip install "ontocast[server,openai,doc-processing]"
The openai extra provides a model provider (anthropic, google, and ollama are also listed); doc-processing enables PDF, Office, HTML, Markdown, and image conversion.
Run as an HTTP service:
export LLM_API_KEY=sk-...
ontocast serve
curl -X POST http://127.0.0.1:8999/process -F "[email protected]" -o result.json
The response holds the facts and ontology as Turtle. Configuration is read from environment variables, or from files passed via ontocast --env-file my.env serve (later files override earlier ones).
For batch processing without a server:
ontocast process --input-path ./papers --output-dir ./out
Supply your own ontologies by pointing at a Turtle directory at startup, or uploading to a running server:
ontocast serve --ontology-dir ./my-ontologies
curl -X POST http://127.0.0.1:8999/ontologies -F "[email protected]"
Embed inside a LangChain agent:
from langchain.agents import create_agent
from ontocast import Config, ToolBox, ontocast_tools
tools = await ToolBox.acreate(Config.in_memory())
await tools.initialize()
agent = create_agent(
model,
tools=[*ontocast_tools(tools)],
prompt="Edit the ontology from the user's text.",
)
For LangGraph, make_ontocast_node adds OntoCast as a node, and run_unit_pipeline handles a single passage.
Documented notes and limitations:
- The base install is light and excludes document processing and the ML runtime; both require the relevant extras.
- An LLM API key must be provided at runtime.
- Storage is in-memory by default; persistence requires Apache Jena Fuseki.
- Ontology context can be selected from a catalog, retrieved from a vector store (LanceDB or Qdrant), or fixed.
- Contributors accept a Contributor License Agreement once, on their first pull request.
For configuration reference, the HTTP API, and the Python API, see the documentation at growgraph.github.io/ontocast.