# Cognita

> TrueFoundry's modular, API-driven RAG framework with a no-code UI (archived March 2026)

- Category: Retrieval & Knowledge (RAG) / RAG Frameworks & Platforms
- Language: Python
- Licence: Apache-2.0
- Repository: https://github.com/truefoundry/cognita
- Canonical page: https://ai-tldr.dev/tools/cognita/

## In short

Cognita is an open-source framework from TrueFoundry for organising a retrieval-augmented generation (RAG) codebase so it can move from a notebook to production. It sits in the RAG Frameworks & Platforms category of the Retrieval & Knowledge (RAG) tools and is open-source, written in Python and licensed Apache-2.0. To get started: clone the repository.

## Overview

Cognita is an open-source framework from TrueFoundry for organising a retrieval-augmented generation (RAG) codebase so it can move from a notebook to production. Its README frames the problem directly: LangChain and LlamaIndex are easy to prototype with, but in production the chunking and embedding code has to run as a job, the answering code has to be a scalable API service, models have to be served behind an API and the vector database has to be deployed properly. Cognita uses LangChain and LlamaIndex under the hood and wraps each of those pieces as a modular, API-driven component.

A deployment is split into data sources (local disk, web URLs, S3-style storage, TrueFoundry artifacts), a Postgres-backed metadata store that records each collection's data sources, parser settings and embedding model, a model gateway configured from a single models_config.yaml, a vector database (Qdrant is the one wired in by default), an indexing job, and a FastAPI API server. The indexing job scans data sources, compares them with what is already in the vector database and only downloads, parses, chunks and embeds new or changed files, so incremental indexing is the default. On the query side, each application is a query controller class whose decorated methods become FastAPI routes.

It ships with a web frontend where non-developers can create data sources and collections, start indexing and ask questions while choosing the model, retriever, retriever configuration and prompt template. Cognita can run entirely locally through Docker Compose, with Ollama and an Infinity server as optional profiles for local LLMs, embeddings and reranking, or be deployed through TrueFoundry's application catalogue. The project is no longer actively maintained: a note to that effect was added to the README in March 2026 and the GitHub repository is archived read-only, so treat it as a reference architecture you fork rather than a dependency that will receive updates.

## What it does

- Modular, registry-based components: write your own data loader, parser or vector-DB adapter by subclassing BaseDataLoader, BaseParser or BaseVectorDB and registering it
- Incremental indexing job that diffs data sources against the vector database and only processes new or updated files, run manually or on a cron schedule
- Query controllers: a decorated Python class whose methods become FastAPI endpoints, with retrievers such as similarity search, query decomposition and document reranking
- A single models_config.yaml model gateway for LLM, embedding and reranking providers, including OpenAI, Ollama and an Infinity server
- Parsers for documents via Unstructured, multimodal (vision), web pages, audio (via a faster-whisper server) and video
- A no-code UI for managing data sources and collections and running Q&A with configurable model, retriever and prompt

## Getting started

The README recommends running the whole stack locally with Docker Compose (version 25+). It starts Postgres for metadata, a Qdrant server, the FastAPI backend and the frontend.

1. Clone the repository

```bash
git clone https://github.com/truefoundry/cognita.git
cd cognita
```

2. Configure model providers

   Copy the sample model config. By default it enables local providers that need Ollama and an Infinity server; to use OpenAI instead, uncomment the openai provider in models_config.yaml and set OPENAI_API_KEY in compose.env.

```bash
cp models_config.sample.yaml models_config.yaml
```

3. Start the services

   This brings up cognita-db (Postgres), qdrant-server, cognita-backend and cognita-frontend. Qdrant listens on http://localhost:6333, the backend on http://localhost:8000 and the UI on http://localhost:5001.

```bash
docker-compose --env-file compose.env up
```

4. Add local models (optional)

   Enable the ollama and infinity profiles to serve LLMs, embeddings and reranking locally; the Infinity server is then on http://localhost:7997. Add --build after pulling changes or adding packages.

```bash
docker-compose --env-file compose.env --profile ollama --profile infinity up
```

5. Index documents and ask questions in the UI

   In the frontend, create a data source (local directory, web URL, GitHub URL or TrueFoundry artifact), then create a collection by choosing an embedding model and linking the data source; indexing starts when you click Process. In the DocsQA tab, select the collection, LLM, retriever and prompt, and ask your question.

6. Write your own query controller

   Add a class under backend/modules/query_controllers/, decorate it, and import it in that package's __init__.py. Each decorated method is exposed as a FastAPI route — here POST /my-controller/answer.

```python
from backend.server.decorator import query_controller, post

@query_controller("/my-controller")
class MyCustomController():
    @post("/answer")
    def answer(query: str):
        # your retrieval + generation logic
        ...
```

## When to use it

- Reach for it as a reference layout when turning a notebook RAG prototype into separate indexing-job and query-service components
- Reach for it when non-technical colleagues need a UI to upload documents, build collections and try different retrievers and prompts
- Reach for it when you want a self-hosted document Q&A stack you can run end to end on one machine with Docker Compose, Ollama and Infinity
- Reach for it as a fork-and-own starting point — the repository is archived, so plan to maintain your copy yourself
