Semantica — Open-Source Palantir Alternative for AI Agents
Most AI agents operate as black boxes. They store embeddings, not meaning. Make decisions that can’t be explained. Take actions that can’t be audited.
In regulated industries — finance, healthcare, government — that’s not an inconvenience. It’s a compliance exposure. An underwriting agent’s approval needs to survive a regulator’s “why?” months later.
Semantica is the open-source answer: a graph-native infrastructure layer that sits underneath your LLM, vector store, and agent framework. Context graphs. Explainable reasoning. W3C PROV-O audit trails. All deterministic — no LLM required for graph construction or provenance.
GitHub: semantica-agi/semantica
Install: pip install semantica
The Gap Semantica Fills
| Vector DB + RAG | Plain LLM Memory | Semantica | |
|---|---|---|---|
| Recall method | Embedding similarity | Token window | Graph traversal + semantic search |
| Decision history | Not stored | Not stored | First-class queryable objects |
| Provenance | None | None | W3C PROV-O, source-linked |
| Reasoning | None | Black box | Forward chain, Rete, Datalog, SPARQL |
| Conflict detection | Silent overwrite | Silent overwrite | Detected, flagged, resolved |
| Time travel | No | No | Point-in-time graph snapshots |
| Compliance export | None | None | PROV-O, SHACL, OWL, RDF |
Decision Intelligence: The Core Idea
In Semantica, a decision isn’t a log line. It’s a first-class graph node with a full lifecycle:
from semantica.context import ContextGraph
graph = ContextGraph(advanced_analytics=True)
# Record with full structured context
decision_id = graph.record_decision(
category="credit_application",
scenario="Personal loan, $85k income, 31% DTI",
reasoning="Income meets threshold; employment stable; no adverse credit events",
outcome="proceed_to_underwriting",
confidence=0.88,
metadata={"applicant_id": "A-7291"},
)
# Query the intelligence
chain = graph.trace_decision_chain(decision_id) # full causal ancestry
similar = graph.find_similar_decisions("personal loan approval", max_results=5) # precedents
impact = graph.analyze_decision_impact(decision_id) # downstream influence
compliant = graph.check_decision_rules({"category": "credit_application"}) # policy gate
Every decision links to upstream causes and downstream effects. You can export the entire chain as W3C PROV-O — the format regulators actually accept.
Context Graphs vs. Embeddings
A Context Graph answers different questions than embeddings:
- Embeddings: “What is similar?”
- Context Graph: “What is connected, why, and how?”
Every entity, relationship, decision, and fact is a node. Entities link to source documents. Decisions link to evidence. Facts carry provenance. Conflicts are detected, not silently overwritten.
graph = ContextGraph(advanced_analytics=True)
# Add nodes with typed properties
graph.add_node("acme_corp", "Organization", name="Acme Corp", industry="SaaS")
graph.add_node("alice_chen", "Person", name="Alice Chen", role="CTO")
graph.add_node("contract_001", "Contract", value=2_400_000, currency="USD")
# Add typed edges
graph.add_edge("alice_chen", "acme_corp", edge_type="works_for", since="2019-03-01")
graph.add_edge("acme_corp", "contract_001", edge_type="party_to", signed="2024-01-15")
# Traverse
neighbors = graph.get_neighbors("acme_corp", hops=2)
# Time travel — the graph as it existed on any past date
snapshot = graph.state_at("2024-01-01")
The Full Pipeline
Semantica is an end-to-end system, not a single library:
Sources → Ingest → Parse → Normalize → Split → Extract → Conflict Detection → Deduplication
→ Knowledge Graph → [ Ontology · Reasoning · Provenance · Decisions ] → Enriched KG
→ Vector Store + Polyglot Graph Store (RDF & LPG) → Export / Visualize / REST · MCP · CLI
Ingestion: Files, web, databases, Databricks (Unity Catalog), Snowflake, Kafka, Git, email, MCP servers
Extraction: NER, relations, events, triplets — with conflicts flagged before merge
Storage: Polyglot by design. RDF stores (Oxigraph, Blazegraph, Jena, RDF4J) and Labeled Property Graphs (Neo4j, FalkorDB, Apache AGE, Neptune)
Reasoning: Forward chaining, Rete network, Datalog, SPARQL — fully explainable, not black boxes
Who It’s For
- AI/ML platform teams shipping agents that make consequential decisions
- Data platform teams on Databricks/Snowflake who need governed knowledge graphs without exporting to third-party SaaS
- Compliance, risk, and audit teams who need structured answers to “why did the AI do that?”
- Regulated enterprises (finance, healthcare, legal, government) that can’t ship black boxes
- Platform engineers who want KG + reasoning + provenance self-hosted and swappable
Audit Trail Recipe
The flagship pattern: record a causally-linked decision chain, attach provenance, export regulator-ready artifacts.
from semantica.context import ContextGraph
from semantica.provenance import ProvenanceManager
from semantica.export import RDFExporter
graph = ContextGraph(advanced_analytics=True)
prov = ProvenanceManager(storage_path="./audit.db")
# Record decision chain (healthcare example)
d1 = graph.record_decision(
category="drug_interaction_check",
scenario="Patient P-4821: warfarin + amiodarone co-prescribed",
reasoning="Amiodarone potentiates warfarin's anticoagulant effect",
outcome="flag_for_review",
confidence=0.91,
)
d2 = graph.record_decision(
category="dosage_adjustment",
scenario="INR monitoring plan for P-4821",
reasoning="Reduce warfarin dose per interaction severity",
outcome="dose_reduced_30pct",
confidence=0.87,
)
graph.add_causal_relationship(d1, d2, relationship_type="CAUSED")
# Track entity provenance
prov.track_entity("patient_P4821", source="ehr/medication_orders_2024.json",
metadata={"extractor": "NamedEntityRecognizer"})
# Export W3C PROV-O for regulator submission
graph_dict = graph.to_dict()
kg = {
"entities": [{"id": n["id"], "type": n["type"], "text": n["content"]}
for n in graph_dict["nodes"]],
"relationships": [{"source_id": e["source"], "target_id": e["target"], "type": e["type"]}
for e in graph_dict["edges"]],
}
RDFExporter().export(kg, "audit_trail.ttl", format="turtle")
Enterprise Data Platform Integration
Pull directly from Databricks or Snowflake — no export/import hop:
from semantica.ingest import DatabricksIngestor
databricks = DatabricksIngestor(
host="https://adb-xxx.azuredatabricks.net",
token="dapi-xxxxxxxx",
http_path="/sql/1.0/warehouses/xxxxxxxx",
catalog="main",
)
customers = databricks.ingest_table("customers", limit=10_000)
lineage = databricks.get_table_lineage("customers", catalog="main", schema="default")
Tables become graph nodes with provenance automatically.
Why “Open-Source Palantir”?
Palantir’s Foundry/Ontology is powerful but proprietary. Semantica offers:
- Same core primitives: Knowledge graphs, ontology management, decision intelligence, provenance
- Open source (MIT): Self-host, fork, extend, no lock-in
- Polyglot storage: Bring your own graph database
- Modern stack: Python-native, designed for LLM-era agents
- Deterministic reasoning: No LLM required for graph construction
You don’t need Palantir’s enterprise sales process to get enterprise-grade decision intelligence.
Quick Start
pip install semantica
semantica doctor # verify install
from semantica.context import ContextGraph
graph = ContextGraph(advanced_analytics=True)
decision = graph.record_decision(
category="vendor_selection",
scenario="Choose cloud provider for HIPAA workload",
reasoning="AWS offers BAA, mature HIPAA tooling, existing team expertise",
outcome="selected_aws",
confidence=0.93,
)