Skip to main content

Context infrastructure for AI applications

Project description

Fabra

The feature store that runs on your laptop.
The context store that knows what your AI knew.

PyPI version License Python Version


The Problem

ML Engineers: Feast needs Kubernetes and Spark. You have a 4-person team and a deadline.

AI Engineers: Legal asked what data your AI used for a decision last Tuesday. You had no answer.

Both problems have the same root cause: you don't own your data pipeline.


30 Seconds to Proof

pip install fabra-ai && fabra demo

That's it. Server starts, makes a test request, shows you the result. No Docker. No config files. No API keys.

What you'll see
  Fabra Demo Server

  Testing feature retrieval...
  curl localhost:8000/features/user_engagement?entity_id=user_123

  Response:
  {
    "value": 87.5,
    "freshness_ms": 0,
    "served_from": "online"
  }

  Press Ctrl+C to stop, or visit http://localhost:8000/docs

Two Entry Points, One Infrastructure

For ML Engineers

"I need features in production, not a platform team."

from fabra import FeatureStore, entity, feature
from datetime import timedelta

store = FeatureStore()

@entity(store)
class User:
    user_id: str

@feature(entity=User, refresh=timedelta(hours=1))
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?entity_id=u123
# {"value": 47, "freshness_ms": 0, "served_from": "online"}

Python decorators. Not YAML.

For AI Engineers

"Compliance asked what the AI knew. I need an answer."

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

store = FeatureStore()

@context(store, max_tokens=4000, freshness_sla="5m")
async def build_prompt(user_id: str, query: str):
    tier = await store.get_feature("user_tier", user_id)
    docs = await search_docs(query)
    return [
        ContextItem(content=f"User tier: {tier}", priority=1),
        ContextItem(content=docs, priority=2),
    ]

ctx = await build_prompt("user_123", "question")
print(ctx.id)       # ctx_018f3a2b-... (replay this anytime)
print(ctx.lineage)  # exactly what data was used

Full audit trail. Not a black box.


Why It Works

1. You Own Your Data

LangChain queries your vector DB. Fabra is your vector DB. We ingest, index, track freshness, and serve. When someone asks "what did the AI know?", we have the answer because we never lost sight of the data.

# Replay any historical context
fabra context show ctx_018f3a2b-7def-7abc-8901-234567890abc

# Compare what changed between two decisions
fabra context diff ctx_abc123 ctx_def456

2. Same Code Everywhere

Development uses DuckDB (zero setup). Production uses Postgres + Redis (just add env vars). Your feature definitions don't change.

# Development (right now, on your laptop)
fabra serve features.py

# Production (same code, different backends)
FABRA_ENV=production \
FABRA_POSTGRES_URL=postgresql://... \
FABRA_REDIS_URL=redis://... \
fabra serve features.py

3. Point-in-Time Correctness

Training ML models? We use ASOF JOIN to ensure your training data reflects exactly what the model would have seen at prediction time. No data leakage. No training-serving skew.

4. Token Budgets That Work

No more prompt length errors in production. Set a budget, assign priorities, and low-priority items get dropped automatically.

@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=user_history, priority=1),  # dropped first if over budget
        ContextItem(content=docs, priority=2),
    ]

What's Real

This isn't a framework that wraps other tools. This is infrastructure:

Capability What It Does
Feature Store @feature decorators, online/offline stores, point-in-time joins
Context Store @context decorators, token budgeting, lineage tracking
Vector Search Built-in pgvector, automatic chunking, freshness tracking
Context Replay fabra context show <id> returns exact historical state
Context Diff fabra context diff <id1> <id2> shows what changed
Freshness SLAs freshness_sla="5m" fails if data is stale
Diagnostics fabra doctor validates your setup

CLI

fabra serve features.py      # Start the server
fabra demo                   # Interactive demo (no setup)
fabra doctor                 # Diagnose configuration issues
fabra context show <id>      # Replay historical context
fabra context diff <a> <b>   # Compare two contexts
fabra context list           # List recent contexts
fabra context export <id>    # Export for audit
fabra deploy fly|railway     # Generate deployment config
fabra ui features.py         # Launch the dashboard (requires [ui] extra)

Note: fabra ui requires pip install "fabra-ai[ui]" for Streamlit dependencies.


How Fabra Fits in Your Stack

Fabra is not a replacement for:

Tool Purpose Relationship to Fabra
Airflow / Dagster Batch workflow orchestration Use for pipelines that feed Fabra
MLflow / W&B Model training & experiment tracking Use for training; Fabra handles inference-time context
LangChain / LlamaIndex LLM orchestration & chains Use for orchestration; Fabra provides the data layer

Fabra replaces or complements:

Tool Fabra Advantage
Feast Simpler setup, built-in context assembly
Custom feature serving Production-ready out of the box
Ad-hoc RAG pipelines Lineage, freshness SLAs, token budgets

See full comparison guide for detailed breakdowns vs Feast, Tecton, LangChain, and Pinecone.


Honest Comparison

vs Feast

Feast Fabra
Setup Kubernetes + Spark pip install
Config YAML files Python decorators
Local dev Docker required Works immediately
Context/RAG Not supported Built-in

Choose Feast if: You have a platform team and existing K8s infrastructure.

vs LangChain

LangChain Fabra
Architecture Orchestration framework Storage + serving infrastructure
Data ownership Queries external stores Owns the write path
Audit trail None Full lineage + replay
Token management DIY Built-in budgets

Choose LangChain if: You need agent chains and don't need compliance.

Note: You can use Fabra + LangChain together — Fabra for storage/serving, LangChain for orchestration.


Production Checklist

  • Observability: Prometheus metrics at /metrics, structured logging
  • Reliability: Circuit breakers, fallback chains, health checks
  • Security: Self-hosted, your data stays in your infrastructure
  • Deployment: One-command deploy to Fly.io, Railway, Cloud Run, Render

Quick Start (Detailed)

Feature Store

pip install fabra-ai
fabra serve examples/demo_features.py

Test it:

curl localhost:8000/features/user_engagement?entity_id=user_123

Response:

{"value": 87.5, "freshness_ms": 0, "served_from": "online"}

Context Store

pip install fabra-ai
fabra serve examples/demo_context.py

Test it:

curl -X POST localhost:8000/v1/context/chat_context \
  -H "Content-Type: application/json" \
  -d '{"user_id":"user_123","query":"how do features work?"}'

Response:

{
  "id": "ctx_018f3a2b-...",
  "content": "You are a helpful AI assistant...",
  "meta": {
    "freshness_status": "guaranteed",
    "token_usage": 150
  },
  "lineage": {
    "features_used": ["user_tier", "user_engagement_score"],
    "retrievers_used": ["demo_docs"]
  }
}

Replay it later:

fabra context show ctx_018f3a2b-...

What We Don't Do

  • 100k+ QPS streaming - Use Tecton
  • Agent orchestration - Use LangChain
  • 50+ SaaS connectors - Not our focus
  • No-code builders - This is Python infrastructure

Try in Browser · Quickstart · Docs


Fabra · Apache 2.0 · 2025

Context infrastructure that owns the write path.

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.6.tar.gz (844.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.6-py3-none-any.whl (191.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: fabra_ai-2.0.6.tar.gz
  • Upload date:
  • Size: 844.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.6.tar.gz
Algorithm Hash digest
SHA256 77b23ac82a16e74b823ad2d218434dda12df3af1ed7562e67f7d335d9171976f
MD5 5b1ec68ccf8c00d0fb3a69e82d362c16
BLAKE2b-256 35aead01417a40b4223f1a380730b1b7f657e231c418997b9d39284a9db02ef8

See more details on using hashes here.

Provenance

The following attestation bundles were made for fabra_ai-2.0.6.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.6-py3-none-any.whl.

File metadata

  • Download URL: fabra_ai-2.0.6-py3-none-any.whl
  • Upload date:
  • Size: 191.1 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.6-py3-none-any.whl
Algorithm Hash digest
SHA256 5f9a27e05779ff60aac20918b5201c898640a9b89fe22cf89eae367c439e7029
MD5 734107d02f3d39337c05de6f94fefc6b
BLAKE2b-256 0a6fbcafae1d8f0adaae6cd156788cb3bee71ab334490b629b9c85cb24a62df6

See more details on using hashes here.

Provenance

The following attestation bundles were made for fabra_ai-2.0.6-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