Skip to main content

Fabrica

The context layer for Python agents. Part of the Civitas platform.

pip install fabrica-context   # import fabrica

fabrica itself is already taken on PyPI by an unrelated project — the project and repo keep the name "Fabrica", only the distribution name differs (same pattern as pip install pyyamlimport yaml).


What this is

Agents don't fail because the model is weak — they fail because the context window is mismanaged. Every tool schema, every skill, every memory, every intermediate result gets stuffed into the prompt whether the model needs it or not, and both cost and accuracy degrade as a result.

Fabrica is the answer: it decides what an agent sees and where its code actually runs. Its headline mechanism is code-mode — a model writes code against a tool namespace instead of making individual tool calls, that code runs in an isolated sandbox, and only the final result crosses back into the model's context. Measured on real hardware, not claimed: ~79% cheaper and more correct than traditional tool-calling.

Where Fabrica sits — three pillars: Context (Fabrica), Control (Presidium), Runtime (Civitas)

Civitas keeps agents alive. Presidium keeps them accountable. Fabrica decides what they see and how they act on it.

What it does

Capability Shape
Tools as code A code-API namespace + isolated execution — the headline mechanism above. A find() retrieval fallback exists for models that don't do code-mode.
Skills gateway Loads the open SKILL.md standard with progressive disclosure — validated against the real 81-skill bigpowers catalog.
Memory A MemoryStore protocol wrapping mature backends (Mem0 today; Zep/Letta/Cognee planned) — working memory, compaction, and long-term recall as three separate facets, not one blended score.
Prompts A versioned, addressable PromptStore — storage and retrieval only, deliberately not rendering or compression.
MCP, both directions A real MCP client (MCPToolNamespace) and a real MCP server (FabricaMCPServer, stdio + HTTP) — external tools come in, Fabrica's own tools/skills/memory/prompts go out, without reintroducing the schema-dump cost code-mode exists to avoid.
Tunnels TunnelProvider for exposing a local dev deployment publicly — Tailscale Funnel and Cloudflare quick tunnels, both credential-free.

Isolation — the differentiator

Running model-generated code needs real isolation. Fabrica treats it as one pluggable, tiered Sandbox protocol, auto-detected per host — callers never choose a backend themselves.

One Sandbox protocol, platform-detected at runtime: Tier 0 subprocess everywhere, Tier 1 SrtSandbox (validated on macOS, srt-documented-but-untested on Linux/Windows), Tier 2 FirecrackerSandbox on Linux+KVM with real opt-in snapshot/restore and jailer hardening

Tier 2 (Firecracker) is the real production target on Linux: microVM-per-agent isolation, cold-boot by default, with opt-in snapshot/restore (~8–11ms warm restores, measured) and opt-in jailer hardening (chroot + cgroups + uid/gid drop on top of the KVM boundary) — both validated end to end on real hardware, not simulated. Full detail: docs/isolation.md.

Status

Alpha, real and tested, not just designed. Nine contracts, fifteen spikes (all real hardware/API evidence — specs/archive/spikes/), every object-model component built and tested, not just designed: Retriever, Sandbox/SandboxPool (all three tiers implemented), ToolManager, SkillManager, MemoryManager, PromptManager, CivitasBridge, both MCP directions, and TunnelProvider. A real GitHub Actions pipeline lints, tests, and builds on every push.

Genuinely open, not hidden: managed-provider adapters (E2B/Modal/AWS/Azure/GCP) are blocked on real cloud credentials this project doesn't have yet; a fabrica/fabrica-contrib package split is designed but deliberately deferred until a real adapter needs it. Full, current, ordered state: HANDOFF.mddocs/PLAN.md.

Documentation

Start here For
HANDOFF.md Current state, what's done, what's next — read this first
docs/architecture.md Visual tour of the whole system
docs/system-design.md Internals: object model, deployment topology, state ownership
docs/contracts/ Implementation-ready signatures for every component
docs/PLAN.md The active, ordered work queue

Discovery, design, and validation docs (personas, landscape research, per- component design docs, spike write-ups) live under docs/ and specs/archive/spikes/ — grouped and indexed in HANDOFF.md's own reading-order section.

License

Apache 2.0.

Download files

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

Source Distribution

fabrica_context-0.2.0.tar.gz (533.0 kB view details)

Uploaded Source

Built Distribution

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

fabrica_context-0.2.0-py3-none-any.whl (127.1 kB view details)

Uploaded Python 3

File details

Details for the file fabrica_context-0.2.0.tar.gz.

File metadata

  • Download URL: fabrica_context-0.2.0.tar.gz
  • Upload date:
  • Size: 533.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for fabrica_context-0.2.0.tar.gz
Algorithm Hash digest
SHA256 aceca76bcab5239caf6d8f45a2bd2e3bad3a591ec91a1c242a8c38023ca13a4d
MD5 d2f0611717cb80dcf8ab20184ee37c33
BLAKE2b-256 d61b33f1be161767f07f32c92c3967e73ee145db658f44424b53ffa4cf68fce8

See more details on using hashes here.

Provenance

The following attestation bundles were made for fabrica_context-0.2.0.tar.gz:

Publisher: publish.yml on civitas-io/fabrica

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

File details

Details for the file fabrica_context-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: fabrica_context-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 127.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for fabrica_context-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 be7c5bea35c44ed93ea16b3c2cf01f717572d1b8c31727fb2ed44ed9103ff1e7
MD5 1ff9fe6fd6e49933a909f37f50ec9b30
BLAKE2b-256 5f96923cd7b69cd8c0f1f15488a3a250555059d3c092b914345afcae062c109d

See more details on using hashes here.

Provenance

The following attestation bundles were made for fabrica_context-0.2.0-py3-none-any.whl:

Publisher: publish.yml on civitas-io/fabrica

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

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 files

0.1.0

2 files

Supported by

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