All projects

The Sovereign

A self-hosted research lab. Give it a topic and every night it reads the web, keeps each fact with its source in a knowledge graph, answers with citations, and proves what it learned on an exam written from sources it is never allowed to read.

Status
Shipped
Stack
Python, Pydantic AI, FastAPI, ArcadeDB, MCP, Ollama, Claude API, Docker
Highlights
  • ./sovereign up starts every service in Docker
  • 77-check test suite and a nightly security self-check
  • Runs on a local qwen3.6:35b or on Claude
  • LangFuse traces with one flag
Decisions
  • Rules live in code, not in prompts In The Sovereign, agents never touch the database. Every read and write goes through an API that enforces the ontology and validation.
  • A fact needs its source The Sovereign's Validator checks each extracted fact against the text it came from before it becomes an edge in the graph.

What it is

A multi-tenant platform where each user creates research workspaces, one per domain. Each domain gets its own knowledge graph and a team of agents that keeps researching, validating and storing what it finds. It does not act in the world. It finds out what is true and explains it, with sources and how sure it is.

The team

  • Head (Hermes) talks to you and decides. It writes a research charter with you: the goal, the core questions, what to leave out, how deep.
  • Researcher (DeerFlow) reads the web.
  • Learning is the pipeline that turns what was read into checked facts and keeps the graph in shape: extract, validate, resolve, link, ontology, plan, summaries, briefing.

The Head assigns work with assign_task, whose inputs are checked by a Pydantic model, and asks questions with ask_agent. When a teammate finishes, it reports on the thread and the Head is woken to read it and decide. A thread can wake the Head at most 4 times, and a domain 12 times an hour.

Decisions

  • Agents never touch the database. Every read and write goes through the KG API, where the ontology and validation are enforced in code, not in prompts.
  • REST is the core and MCP is a thin adapter. The same functions back both, so Hermes discovers the graph tools over MCP with no glue code.
  • The graph only stores facts the pipeline checked against their source. Superseded facts are kept as history, not deleted.

Measured

Every number comes from the lab’s own records.

Result What was measured
41 → 55 Held-out exam score after research missions on the practice questions it got wrong
9× faster Extraction on a local 35B model with reasoning off: about 19s instead of 171s, at the same quality
47 pages, 1,010 facts Read and stored in one night

The exam is written from held-out sources the lab is never allowed to read, and the questions it misses become the next night’s research.

Query

Graph RAG: a question goes to entity and fact vector search, then to the strongest facts around them, then to their sources.

Running it

./sovereign up writes the config with generated secrets, pulls the models it needs, builds the images and starts ArcadeDB, SearXNG, crawl4ai, the KG API, Hermes, Research and the web UI. It runs on a local qwen3.6:35b through Ollama, or on Claude. --observability adds LangFuse traces.