Skip to main content

Context infrastructure for AI applications

Project description

Fabra

Context Infrastructure for AI Applications

PyPI version License Python Version

Try in Browser · Quickstart · Docs


Fabra is the system of record for what your AI knows. We ingest, index, track freshness, and serve context data — not just query it.

This "write path ownership" enables:

  • Replay any AI decision — What exactly did the model know?
  • Full lineage tracking — Which features, documents, and retrievers were used?
  • Freshness guarantees — Was the data stale when the decision was made?
pip install "fabra-ai[ui]"

Choose Your Path

ML Engineers

"Feast needs Kubernetes. I just need features."

from fabra import FeatureStore, entity, feature

store = FeatureStore()

@entity(store)
class User:
    user_id: str

@feature(entity=User, refresh="hourly")
def purchase_count(user_id: str) -> int:
    return db.query("SELECT COUNT(*) FROM purchases WHERE user_id = ?", user_id)
fabra serve features.py
curl localhost:8000/features/purchase_count?user_id=123

No Kubernetes. No Spark. No YAML. Just Python.

Feature Store Without K8s → · Feast vs Fabra →

AI Engineers

"Someone asked what the AI knew. I couldn't tell them."

from fabra import FeatureStore, context, ContextItem
from fabra.retrieval import retriever

store = FeatureStore()

@retriever(index="docs", top_k=5)
async def search_docs(query: str):
    pass  # Auto-wired to pgvector

@context(store, max_tokens=4000)
async def build_prompt(user_id: str, query: str):
    docs = await search_docs(query)
    return [ContextItem(content=str(docs), priority=0)]

ctx = await build_prompt("user_123", "query")
print(ctx.id)       # Replay this exact context anytime
print(ctx.lineage)  # What data was used?

Context Traceability → · Compliance Guide →


Why Engineers Choose Fabra

1. We Own the Write Path

LangChain, Pinecone, and other tools are read-only wrappers — they query your data but don't manage it. When compliance asks "what did the AI know?", they have no answer.

Fabra ingests, indexes, and serves context data. Every decision traces back through the data that informed it.

# Replay any historical context
ctx = await store.get_context_at("01912345-6789-7abc-def0-123456789abc")
print(ctx.content)   # Exact prompt from that moment
print(ctx.lineage)   # Complete data provenance

2. Local-First, Production-Ready

Same code runs everywhere. DuckDB locally, Postgres + Redis in production.

# Development (zero setup)
fabra serve features.py

# Production (just add env vars)
FABRA_ENV=production \
FABRA_POSTGRES_URL=postgresql+asyncpg://... \
FABRA_REDIS_URL=redis://... \
fabra serve features.py

No Docker for local dev. No Kubernetes for production. Deploy to Fly.io, Railway, Cloud Run, or any container platform with one command.

3. Point-in-Time Correctness

Training ML models? We use ASOF JOIN (DuckDB) and LATERAL JOIN (Postgres) to ensure your training data reflects the world exactly as it was — no data leakage, ever.

4. Token Budget Management

No more "context too long" errors. Priority-based truncation keeps your prompts under budget.

@context(store, max_tokens=4000)
async def build_prompt(user_id: str, query: str):
    return [
        ContextItem(content=system_prompt, priority=0, required=True),
        ContextItem(content=docs, priority=1),
        ContextItem(content=history, priority=2),  # Dropped first if over budget
    ]

Key Capabilities

For ML Engineers

Capability Description
Python Decorators @feature instead of 500 lines of YAML
DuckDB + Postgres Local dev with embedded DB, production with Postgres
Point-in-Time Joins ASOF/LATERAL joins for training data correctness
Hybrid Features Mix Python logic and SQL in the same pipeline
One-Command Deploy fabra deploy fly|cloudrun|railway|render

For AI Engineers

Capability Description
Context Accountability UUIDv7 IDs, full lineage, replay any decision
Vector Search Built-in pgvector with automatic chunking
Token Budgets max_tokens with priority-based truncation
Freshness SLAs Fail-safe when data is stale
Export fabra context export for debugging and compliance

Production Features

  • Observability: Prometheus metrics, OpenTelemetry tracing
  • Reliability: Circuit breakers, fallback chains, fabra doctor
  • Security: Self-hosted, your data never leaves your infrastructure

Architecture

Development                         Production
┌─────────────────────┐            ┌─────────────────────────┐
│  Your Python Code   │            │   Your Python Code      │
│  (@feature, @context)│            │   (@feature, @context)  │
└──────────┬──────────┘            └───────────┬─────────────┘
           │                                   │
           ▼                                   ▼
┌─────────────────────┐            ┌─────────────────────────┐
│  DuckDB (embedded)  │            │  Postgres + pgvector    │
│  In-Memory Cache    │            │  Redis                  │
└─────────────────────┘            └─────────────────────────┘

Same code. Same decorators. Different backends.
FABRA_ENV=development → FABRA_ENV=production

Comparison

vs Feast (Feature Store)

Feast Fabra
Setup Kubernetes + Spark pip install
Configuration YAML Python decorators
Time to production Weeks 30 seconds
RAG support None Built-in Context Store
Traceability None Full lineage

Use Feast when: You have a platform team and existing K8s/Spark infrastructure.

vs LangChain (RAG)

LangChain Fabra
Type Framework (orchestration) Infrastructure (storage + serving)
Traceability None Full lineage + replay
Token budgets DIY Built-in
Data ownership Read-only wrapper Write path owner

Use LangChain when: You need agent orchestration and don't need compliance.


Get Started

pip install "fabra-ai[ui]"

# ML Engineers: Serve features
fabra serve features.py

# AI Engineers: Index documents and serve context
fabra serve chatbot.py

Try in Browser · Quickstart Guide · Full Documentation


Roadmap

  • v1.0: Core Feature Store (DuckDB, Postgres, Redis)
  • v1.2: Context Store (pgvector, retrievers, token budgets)
  • v1.3: UI, Magic Retrievers, One-Command Deploy
  • v1.4: Context Accountability (lineage, replay, traceability)
  • v1.5: Freshness SLAs (data freshness guarantees)
  • v1.6: Drift detection, RBAC, multi-region

Contributing

We welcome contributions! See CONTRIBUTING.md to get started.

Fabra · Apache 2.0 · 2025

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fabra_ai-2.0.4.tar.gz (699.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fabra_ai-2.0.4-py3-none-any.whl (160.2 kB view details)

Uploaded Python 3

File details

Details for the file fabra_ai-2.0.4.tar.gz.

File metadata

  • Download URL: fabra_ai-2.0.4.tar.gz
  • Upload date:
  • Size: 699.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for fabra_ai-2.0.4.tar.gz
Algorithm Hash digest
SHA256 f688f209e0f4037c26f72f5febeb5bdf503420c5595b9111ae8d436a79de64ad
MD5 0229bd27111bf6354eea49519cf6ef1e
BLAKE2b-256 72796f24ecf8e5fb8083dfd1fffc0e01e3d49d324969be7ccb8bd40e9e90ebf2

See more details on using hashes here.

Provenance

The following attestation bundles were made for fabra_ai-2.0.4.tar.gz:

Publisher: release.yml on davidahmann/fabra

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file fabra_ai-2.0.4-py3-none-any.whl.

File metadata

  • Download URL: fabra_ai-2.0.4-py3-none-any.whl
  • Upload date:
  • Size: 160.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for fabra_ai-2.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 2fe1b03bf27a43a1b534ba5ac75c67d219ecf6dab82ffefeed2399bc7536d057
MD5 3f9e0e11430d3a1a9c8b01df7ee21f97
BLAKE2b-256 a76d81d205761684896ef922ee5de31b59f3fe5a7554324854fc405190d4e0e8

See more details on using hashes here.

Provenance

The following attestation bundles were made for fabra_ai-2.0.4-py3-none-any.whl:

Publisher: release.yml on davidahmann/fabra

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page