Fabrica
The context layer for Python agents. Part of the Civitas platform.
pip install fabrica-context # import fabrica
fabricaitself is already taken on PyPI by an unrelated project — the project and repo keep the name "Fabrica", only the distribution name differs (same pattern aspip install pyyaml→import 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.
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.
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.md → docs/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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aceca76bcab5239caf6d8f45a2bd2e3bad3a591ec91a1c242a8c38023ca13a4d
|
|
| MD5 |
d2f0611717cb80dcf8ab20184ee37c33
|
|
| BLAKE2b-256 |
d61b33f1be161767f07f32c92c3967e73ee145db658f44424b53ffa4cf68fce8
|
Provenance
The following attestation bundles were made for fabrica_context-0.2.0.tar.gz:
Publisher:
publish.yml on civitas-io/fabrica
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fabrica_context-0.2.0.tar.gz -
Subject digest:
aceca76bcab5239caf6d8f45a2bd2e3bad3a591ec91a1c242a8c38023ca13a4d - Sigstore transparency entry: 2579602171
- Sigstore integration time:
-
Permalink:
civitas-io/fabrica@1783e640e0bb016a5527bf4d380afa74ec2f96f5 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/civitas-io
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@1783e640e0bb016a5527bf4d380afa74ec2f96f5 -
Trigger Event:
push
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
be7c5bea35c44ed93ea16b3c2cf01f717572d1b8c31727fb2ed44ed9103ff1e7
|
|
| MD5 |
1ff9fe6fd6e49933a909f37f50ec9b30
|
|
| BLAKE2b-256 |
5f96923cd7b69cd8c0f1f15488a3a250555059d3c092b914345afcae062c109d
|
Provenance
The following attestation bundles were made for fabrica_context-0.2.0-py3-none-any.whl:
Publisher:
publish.yml on civitas-io/fabrica
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fabrica_context-0.2.0-py3-none-any.whl -
Subject digest:
be7c5bea35c44ed93ea16b3c2cf01f717572d1b8c31727fb2ed44ed9103ff1e7 - Sigstore transparency entry: 2579602179
- Sigstore integration time:
-
Permalink:
civitas-io/fabrica@1783e640e0bb016a5527bf4d380afa74ec2f96f5 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/civitas-io
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@1783e640e0bb016a5527bf4d380afa74ec2f96f5 -
Trigger Event:
push
-
Statement type: