Knowledge Flow is a modular FastAPI backend that extracts and structures knowledge from documents or tabular data for intelligent applications.
It is used by the open-source Fred multi-agent assistant, exposing both REST and MCP (Model Composition and Prompting) endpoints to serve structured knowledge to agents.
Warning
PyMuPDF (fitz) is being removed from this project. PyMuPDF is licensed under AGPL-3.0, which is incompatible with the Apache 2.0 license of this project. A permissively-licensed replacement will ship in a future release. Until then, if license compliance is a concern for your deployment, disable PDF ingestion or audit your PyMuPDF usage carefully.
Knowledge Flow provides two primary services:
-
Document Ingestion
Converts unstructured files (PDF, DOCX, PPTX, etc.) into clean Markdown and metadata, splits the content into chunks, and vectorizes them using an embedding model. The results can be stored locally or in a vector store for semantic search (e.g., RAG pipelines). -
Structured Data Ingestion
Processes CSV files into dataset-scoped Parquet artifacts stored in the sharedcontent_storageobject area. The primary ingestion path inspects delimiter and encoding once, converts CSV to Parquet directly with DuckDB, then derives row counts and column schema from the generated Parquet artifact instead of materializing a full pandas DataFrame. These datasets are then exposed through read-only REST and MCP endpoints and queried on demand with DuckDB, instead of being materialized into one global SQL database.
Knowledge Flow supports one tabular data runtime that can be queried with SQL:
| Runtime | Main config | Backing storage | Status |
|---|---|---|---|
| Dataset-centric runtime | content_storage + storage.tabular_store |
One Parquet artifact per document + DuckDB at query time | Recommended |
All processing pipelines are defined declaratively in config/configuration.yaml.
To learn how to:
- Add custom input or output processors
- Create new storage backends
- Extend the ingestion and search logic
→ See the Developer Guide
For shared startup config and policy conventions across all Fred backends, read:
Key point: Knowledge Flow uses the same ENV_FILE + CONFIG_FILE contract as Agentic and Control Plane.
The default configuration is developer-friendly and only uses local stores. See the configuration page when you want another setup.
- Core storage (
storage.postgres): used by tags, metadata, resources, pgvector, etc.- User/host/db come from
storage.postgresinconfiguration*.yaml. - Password comes from
FRED_POSTGRES_PASSWORD(or an explicitpassword:in the YAML).
- User/host/db come from
- Tabular artifacts (
storage.tabular_store+content_storage): CSV ingestion writes Parquet artifacts into the shared content store object area.- Runtime query limits come from
storage.tabular_storeinconfiguration*.yaml. - The CSV-to-Parquet path is DuckDB-native and avoids loading the full dataset into a pandas DataFrame.
- Tabular runtime URLs now use
storage.tabular_store.query.internal_presigned_ttl_secondsfor backend-internal reads. - Object-storage credentials come from
content_storagewhen using MinIO/S3-compatible backends. - This is the recommended mode for new deployments.
- If
storage.tabular_storeis omitted, this runtime is enabled with the built-in defaults.
- Runtime query limits come from
Tip: for S3-compatible deployments, keep content_storage.endpoint on the internal MinIO/S3 address used by backend
pods and workers, reserve public_endpoint for browser-facing links, and use storage.tabular_store only for
query/runtime bounds.
git clone https://github.com/ThalesGroup/knowledge-flow.git
cd knowledge-flow
make dev
cp config/.env.template config/.env
# Edit .env to add OPENAI_API_KEY
make runThen visit:
- Swagger UI: http://localhost:8111/knowledge-flow/v1/docs
- ReDoc: http://localhost:8111/knowledge-flow/v1/redoc
Prefer a zero-install workflow? Open the project in VS Code’s Dev Container to get the app ready with all local-only
dependencies (no MinIO or OpenSearch). Follow the “Dev-Container mode” section in the root README.md for step-by-step
instructions.
- Ingests files: PDF, DOCX, DOC, ODT, PPTX, PPT → Markdown (legacy DOC/PPT and OpenDocument ODT are upgraded to DOCX/PPTX via LibreOffice)
- Ingests data: CSV → Parquet datasets queried with DuckDB
- Vectorizes content using OpenAI, Azure, or Ollama
- Stores content and metadata in pluggable backends
- Runs standalone with only an OpenAI key and local file system
- Exposes REST and MCP endpoints for agents to query
| Provider | How to enable |
|---|---|
| OpenAI | Set OPENAI_API_KEY in .env |
| Azure OpenAI | Set Azure variables and update configuration.yaml |
| Ollama (local) | Set OLLAMA_BASE_URL and configure model block in configuration.yaml |
See the ai: section in config/configuration.yaml for complete setup examples.
| Command | Description |
|---|---|
make dev |
Set up virtualenv with uv |
make run |
Launch FastAPI server |
make build |
Package the app |
make docker-build |
Build Docker image |
make test |
Run all tests |
make clean |
Remove build artifacts |
Use the fred-deployment-factory to run a full stack including:
- Keycloak (authentication)
- Storage options:
- PostgreSQL +
pgvector(no OpenSearch dependency), or - OpenSearch (vector + metadata index) if you prefer that stack
- PostgreSQL +
- MinIO (content storage) when you need object storage
- Fred + Knowledge Flow containers
Pick the storage flavour that matches your platform constraints; both are supported end-to-end.
Apache 2.0 — © Thales 2025