Introduction
"A vector database tells you 'what's relevant.' A knowledge graph tells you 'why it's relevant.' A provenance layer tells you 'where this conclusion came from.'"
This is article #193 in the "One Open Source Project a Day" series. Today's project is Semantica — graph-native AI decision infrastructure from semantica-agi, self-positioned as "The Open Source Palantir for AI Agents."
One sentence on what it does: make every AI agent decision explainable, traceable, and auditable.
It's not a RAG framework, not a vector database, not an agent framework. It sits beneath all of those, providing a deterministic reasoning layer and a provenance layer. When an agent makes a decision, you can query exactly which context data it used, which reasoning steps it followed, which policies it applied, and where every piece of evidence came from.
8,200 Stars. MIT license. Python 3.8+.
What You'll Learn
- How Semantica's positioning differs from RAG and vector databases
- Decisions as first-class citizens: why AI decisions shouldn't just be log entries
- Deterministic reasoning engine: explainable reasoning that doesn't need an LLM
- W3C PROV-O provenance: source chains for every fact
- Conflict detection and time travel
- Use cases: financial compliance, healthcare, legal, cybersecurity
Prerequisites
- Basic understanding of AI agents and LLMs
- Familiarity with what a vector database does
- Basic knowledge graph concepts (nodes, edges, triples)
Background: The AI Accountability Gap
Current AI agents share a widespread problem: the decision process is opaque.
An agent makes a recommendation. Why? What data did it use? Where did that data come from? Is it contradicted by anything else? Will this recommendation reproduce in a month?
In low-risk scenarios, this is acceptable. In financial loan approvals, clinical decision support, legal contract analysis, or government policy enforcement, "the AI said so" isn't enough. Regulators require complete decision logs, data sourcing, reasoning evidence, and compliance proof.
Existing tooling handles semantic retrieval (vector databases) and conversational memory (various memory solutions), but nothing addresses:
- Decision history: structured records of every agent decision
- Causal provenance: this conclusion, from this data, through this reasoning step
- Conflict handling: when new data contradicts old data, silently overwrite or flag it?
- Cross-agent shared context: multiple agents working on one intelligence layer, not isolated silos
- Temporal dimension: what did the knowledge state look like at a given point in time (time travel)?
Semantica treats all of these as first-class concerns.
Core Concepts
Decisions Are Graph Nodes, Not Log Entries
Traditional approaches record AI operations as log files — timestamp + string. Hard to query, nearly impossible to cross-reference.
Semantica models every AI decision as a complete graph node with a full lifecycle:
from semantica.context import AgentContext, record_decision
ctx = AgentContext(agent_id="loan-agent-01", session_id="session-xyz")
decision = record_decision(
context=ctx,
decision_type="loan_approval",
inputs={"applicant_id": "A123", "amount": 50000},
output={"approved": True, "confidence": 0.87},
reasoning_steps=[...],
policies_applied=["credit_policy_v3", "risk_limit_2024"],
provenance_sources=[...]
)This decision node can:
- Link causally to other decisions ("this decision influenced that one")
- Retrieve historical precedents ("how was a similar case handled before")
- Export for compliance (generate audit reports for regulators)
Deterministic Reasoning Engine
Semantica's reasoning layer uses classical AI deterministic algorithms — no LLM required:
- Rete network: rule engine with efficient pattern matching
- Datalog: declarative logic queries
- SPARQL: standard query language for RDF graphs
- Forward chaining: derive new conclusions incrementally from known facts
from semantica.reasoning import ForwardChainReasoner
reasoner = ForwardChainReasoner()
# Rule: if X is a customer of Y and Y is a Bank, then X has an account at Y
reasoner.add_rule(
condition=["?x customer_of ?y", "?y type Bank"],
conclusion="?x has_account_at ?y"
)
results = reasoner.reason(facts=[
("Alice", "customer_of", "HSBC"),
("HSBC", "type", "Bank")
])
# → [("Alice", "has_account_at", "HSBC")]Every intermediate step in the reasoning chain is preserved. A complete derivation trace can be exported for auditors.
W3C PROV-O Provenance
Every fact in the knowledge graph carries provenance metadata, following the W3C PROV-O standard:
from semantica.provenance import ProvenanceTracker
tracker = ProvenanceTracker()
tracker.record(
entity="Alice",
attribute="credit_score",
value=750,
source="TransUnion API",
retrieved_at="2026-08-17T10:00:00Z",
agent="data-ingestion-agent",
confidence=0.99
)Query it later:
provenance = tracker.get_provenance("Alice", "credit_score")
# → {source: "TransUnion API", retrieved_at: ..., agent: ..., confidence: ...}In regulated environments, this is the technical foundation for "prove that your AI decision was based on trustworthy data."
Conflict Detection — No Silent Overwrites
When two data sources disagree on the same fact, standard RAG silently overwrites (newer replaces older) or picks arbitrarily. Semantica treats this as a problem requiring explicit handling:
from semantica.conflicts import ConflictResolver
resolver = ConflictResolver()
conflicts = resolver.detect(
entity="Alice",
attribute="annual_income",
values=[
{"value": 80000, "source": "Tax Bureau", "date": "2025-01"},
{"value": 120000, "source": "Bank Statement", "date": "2025-06"}
]
)
# → Conflict detected: value conflict (80000 vs 120000)
# → Resolution strategy: most_recent winsSupported resolution strategies: most recent, highest confidence, preferred source, flag for human review.
Core Module Overview
Knowledge Graph Construction (semantica.kg)
from semantica.kg import KnowledgeGraph
kg = KnowledgeGraph(backend="neo4j") # or falkordb / oxigraph
kg.ingest_document("contract.pdf")
kg.ingest_web("https://example.com/news")
kg.ingest_database(conn="postgresql://...", table="customers")
# Graph analysis
centrality = kg.betweenness_centrality()
communities = kg.community_detection()
links = kg.link_prediction(entity="Alice")Semantic Extraction (semantica.semantic_extract)
from semantica.semantic_extract import SemanticExtractor
extractor = SemanticExtractor()
result = extractor.extract("Apple acquired Beats Electronics for $3 billion in 2014.")
# → entities: [Apple, Beats Electronics]
# → relations: [(Apple, acquired, Beats Electronics)]
# → events: [acquisition, 2014]
# → triples: [(Apple, acquisition_of, Beats Electronics, {amount: 3B, year: 2014})]Multi-Source Ingestion (semantica.ingest)
Supported sources: PDF, Word, CSV, JSON, XML, web URLs (including JS-rendered), PostgreSQL, MySQL, MongoDB, Databricks, Snowflake, Kafka.
GraphRAG-Native Chunking (semantica.split)
from semantica.split import GraphRAGSplitter
splitter = GraphRAGSplitter()
chunks = splitter.split("contract.pdf", entity_aware=True)
# → chunk boundaries respect entity integrityPositioning vs. Other Solutions
| Dimension | Vector DB + RAG | LangChain Memory | Semantica |
|---|---|---|---|
| Decision history | Not stored | Not stored | First-class, queryable |
| Provenance | None | None | W3C PROV-O, full source chain |
| Reasoning | Similarity retrieval | None | Deterministic (no LLM needed) |
| Conflict handling | Silent overwrite | Silent overwrite | Detect, flag, resolve |
| Time travel | None | None | Point-in-time graph snapshots |
| Compliance export | None | None | PROV-O / SHACL / OWL / RDF |
| Multi-agent context | Isolated silos | Isolated silos | Shared intelligence layer |
| LLM dependency | Required | Required | Reasoning layer is LLM-free |
Semantica doesn't replace vector databases or RAG — it adds a deterministic reasoning and accountability layer beneath them.
Use Cases
Financial compliance: record every loan decision's data sourcing, reasoning steps, and credit policies applied — satisfying regulatory audit requirements.
Clinical decision support: drug interaction knowledge graphs with evidence provenance chains attached to every clinical recommendation. HIPAA-compliant export.
Legal contract analysis: case law reasoning with every legal conclusion traceable to specific precedents and statutes.
Cybersecurity: IOC (indicator of compromise) correlation graphs, attack attribution chains, incident response timelines.
AI/ML platform teams: build a shared structured context layer for multiple agents — agents work on a shared intelligence layer rather than in isolated silos.
Installation
pip install semantica # core
pip install semantica[all] # everything
# specific backends
pip install semantica[graph-neo4j] # Neo4j
pip install semantica[tripletstore-oxigraph] # embedded RDF (no external service needed)
pip install semantica[vectorstore-qdrant] # Qdrant
pip install semantica[llm-litellm] # LLM support
pip install semantica[crewai] # CrewAI integration
pip install semantica[explorer] # visualization workbenchSimplest start (embedded Oxigraph, no external database):
pip install semantica[tripletstore-oxigraph]Docker deployment:
git clone https://github.com/semantica-agi/semantica
cd semantica
docker-compose up -d
# Knowledge Explorer: http://localhost:3000
# REST API: http://localhost:8000Agent Framework Integration
MCP server (Claude Code, Claude Desktop, and any MCP-compatible client):
{
"mcpServers": {
"semantica": {
"command": "python",
"args": ["-m", "semantica.mcp.server"]
}
}
}CrewAI native integration:
from semantica.integrations.crewai import SemanticalKGTool
tool = SemanticalKGTool(kg=my_knowledge_graph)
# Use directly as a CrewAI agent toolSupported agent frameworks: Agno, CrewAI (native), LangChain, LangGraph, LlamaIndex, AutoGen, OpenAI Agents SDK, Google ADK (via REST/MCP).
Project Links
- GitHub: semantica-agi/semantica
- Website: getsemantica.ai
- Docs: docs.getsemantica.ai
- Discord: discord.gg/sV34vps5hH
- Twitter/X: @BuildSemantica
Summary
Semantica addresses one of the hardest problems in AI enterprise deployment: accountability.
Vector databases solve "find relevant content." RAG solves "answer questions using relevant content." But "how was this answer derived, what data supported it, were there contradictions, who is responsible if something goes wrong" — this entire layer is a gap in the current AI toolchain.
Semantica fills that gap. It doesn't compete with RAG — it sits beneath RAG, adding deterministic reasoning chains and provenance tags to every AI decision. In regulated industries like finance, healthcare, and law, this layer is what separates "internal experiment" from "production deployment that regulators can accept."
The "Open Source Palantir for AI Agents" positioning is accurate: Palantir's core value is connecting data, analysis, and decision processes so operators at government agencies and financial institutions can explain their decisions. Semantica's goal is to make the same accountability possible for AI agents — open source and self-hosted.
Explore PrimeSkills — A marketplace for handpicked AI Agents and skills. Each is validated in real enterprise workflows, stripping away hype and keeping only what truly works.
Welcome to my Homepage for more useful insights and interesting products.