Skip to main content

Context infrastructure for AI applications

Project description

Fabra

Stop spending hours debugging AI decisions you can't reproduce.

When your AI gives a bad answer, you need to know: What did it see? What got dropped?
Can I replay this exact decision? Fabra gives you the answer.

PyPI version License Python Version


The Problem

Incident risk: Your AI shipped a bad answer and you can't explain why.

Credibility risk: Support escalations are vibes and screenshots — not fixable tickets.

Velocity risk: You're scared to ship because you can't debug regressions.

Every AI team hits this wall: you can't fix what you can't reproduce.


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

The Solution: Context Records

Fabra creates a Context Record for every AI decision — an immutable snapshot that turns "the AI was wrong" into a fixable ticket.

ctx = await build_prompt("user_123", "how do I get a refund?")

print(ctx.id)       # ctx_018f3a2b-... (your receipt)
print(ctx.lineage)  # Exactly what data was used

That ctx.id is permanent. Days later, you can:

# See exactly what the AI knew
fabra context show ctx_018f3a2b-...

# Compare two decisions side-by-side
fabra context diff ctx_a ctx_b

This is the difference between "we think it worked" and "here's the proof."


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-... (stable Context Record ID)
print(ctx.lineage)  # exact data used, full provenance

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 Node.js)

Note: fabra ui requires Node.js. Run npm install in src/fabra/ui-next/ if dependencies aren't installed.


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
Can you prove what happened? Partial (features only) Full Context Record
Can you replay a decision? No Yes, built-in
Setup time Days/Weeks 30 seconds
Infrastructure Kubernetes None required

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

vs LangChain

LangChain Fabra
Can you prove what happened? No Full Context Record
Can you explain why it missed something? No Yes, dropped items logged
Can you replay a decision? Manual Built-in
Data ownership Queries external stores Owns the write path

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 Fabra Does Not Do

  • Agent orchestration - Use LangChain
  • Workflow scheduling - Use Airflow/Dagster
  • High-QPS streaming inference - Use Tecton
  • No-code builders - This is Python infrastructure

Fabra focuses on one thing: turning "the AI was wrong" into a fixable ticket.


Try in Browser · Quickstart · Docs


Fabra · Apache 2.0 · 2025

Stop bleeding time and credibility when AI misbehaves.

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.1.1.tar.gz (814.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.1.1-py3-none-any.whl (202.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: fabra_ai-2.1.1.tar.gz
  • Upload date:
  • Size: 814.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.1.1.tar.gz
Algorithm Hash digest
SHA256 3fbd974f3b9b91387de767d3816b178d2c17458418f0810c56adcfc2dcf91597
MD5 2896257e9ecbd21be479bed18f181617
BLAKE2b-256 c083622ef502b62efd2ad3ee983d3d954be3045e4b2f65a790935b0a63e31f44

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: fabra_ai-2.1.1-py3-none-any.whl
  • Upload date:
  • Size: 202.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.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2152d391948dea31494167c1c095f985bdb3e391dbf08f6c439d7cf26642a6ae
MD5 c52900b509612f9a52d6fb349233554a
BLAKE2b-256 da666ece0516f9562f04f720fb764d40c0e618c8f611a9306dff052b6b605b32

See more details on using hashes here.

Provenance

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