Skip to main content

fabricatio-core

MIT Python Versions PyPI Version PyPI Downloads PyPI Downloads Build Tool: uv

Foundational Python library for building LLM-driven applications using an event-based agent architecture. Built on a hybrid Rust/Python foundation for performance-critical operations.

Requires Python 3.12+.

Installation

pip install fabricatio
# or
uv pip install fabricatio

For all optional extras:

pip install fabricatio[full]

Key Components

Event System (Event, EventEmitter)

Segmented event type with task-status lifecycle methods (push_running, push_finished, etc.) and glob-wildcard (*) matching. The global EventEmitter dispatches events asynchronously with on/off/emit.

from fabricatio_core.emitter import EMITTER
from fabricatio_core.rust import Event

EMITTER.on("task::*::finished", my_handler)

LLM Routing (Router, RouterUsage)

Multi-provider router for completion, embedding, and reranking. RouterUsage provides structured LLM interaction patterns — ask, list strings, code generation, judging, choosing — with configurable validation and fallback defaults.

from fabricatio_core.rust import ROUTER, router_usage

response = await ROUTER.completion(send_to="default", message="Hello")
result = await router_usage.choosing("Pick two items", valid_names=["a", "b", "c"], k=2)

Task Model (Task)

Pydantic-based task with lifecycle status management (Pending, Running, Finished, Failed, Cancelled), dependency tracking, structured proposal generation from prompts, and automatic event emission on state transitions.

task = Task(name="data_ingestion", description="Ingest raw data")
task.start()
# ... execute ...
task.finish(output={"rows": 1042})

Workflow Engine (Action, WorkFlow)

Abstract action pipeline with shared context propagation. WorkFlow orchestrates sequences of Action instances, managing input/output keys, error handling, and task lifecycle.

class ParseData(Action):
    async def _execute(self, **cxt):
        return parse(cxt["task_input"])

wf = WorkFlow(actions=[ParseData().to_task_output()], name="parse_pipeline")
await wf.execute(task)

Role Framework (Role)

Agent roles map event patterns to workflows. Global registry supports register_role / get_registered_role. Roles dispatch workflows automatically when matching events are emitted.

from fabricatio_core.models.role import Role, register_role

analyst = Role(name="analyst", description="Data analysis agent")
analyst.deploy_on("data::ingested", parse_wf)
register_role(analyst)

Template Rendering (TemplateManager)

Handlebars-based template engine. Load templates from directories, render with structured data.

from fabricatio_core.rust import TEMPLATE_MANAGER

TEMPLATE_MANAGER.add_store("./templates").discover_templates()
output = TEMPLATE_MANAGER.render_template("greeting", {"name": "World"})

Capability Mixins (UseLLM, UseEmbedding, UseReranker, Propose)

Inheritable classes that add LLM querying, embedding generation, reranking, and structured proposal capabilities to any model. All integrate with the Router for provider dispatch.

class MyAgent(UseLLM, UseEmbedding, Propose, WithBriefing):
    pass

agent = MyAgent(name="helper")
answer = await agent.aask(question="What is 2+2?")
obj = await agent.propose(MyModel, prompt="Create a config object")

Text Parsing & Language Utilities (Rust)

Fast Rust-backed functions for text processing:

  • split_sentence_bounds / split_word_bounds — Unicode-aware text splitting
  • split_into_chunks — chunk text with configurable overlap
  • tokens_of / word_count — token and word counting
  • blake3_hash — BLAKE3 content hashing
  • detect_language — language detection
  • is_english, is_chinese, is_japanese, etc. — language checks
  • is_likely_text — file content type detection
  • CodeSnippetParser, CodeBlockParser, GenericBlockParser, JsonParser — structured block extraction from LLM outputs

Base Model Hierarchy (models.generic)

Pydantic-based abstract base classes for consistent model design: Named, Described, WithBriefing, WithDependency, ScopedConfig (with hierarchical fallback), ProposedAble, InstantiateFromString, Display, and more.

Decorators

  • cfg_on / cfg_on_async — feature-gated function execution
  • depend_on_external_cmd — check external binary availability
  • logging_execution_info / logging_exec_time — execution logging
  • once — ensure single invocation

Configuration (Config)

Structured configuration with sub-sections for LLM, embedding, reranking, emitter, routing, templates, debug, and deployment settings. Accessible via fabricatio_core.rust.CONFIG.

Package Structure

fabricatio-core/
├── python/fabricatio_core/
│   ├── capabilities/      - LLM, embedding, reranker, and proposal mixins
│   ├── models/            - Action, Role, Task, generic base models, kwargs types
│   ├── rust/              - PyO3 Rust extension (autogenerated stubs)
│   ├── decorators.py      - cfg_on, once, logging_exec_time, etc.
│   ├── emitter.py         - EventEmitter with wildcard pattern matching
│   ├── journal.py         - Logger bridge to Rust logger
│   ├── utils.py           - ok, cfg, override_kwargs, first_available, etc.
│   └── __init__.py        - Public API surface
├── src/                   - Rust sources (parser, templates, event, language, etc.)
└── pyproject.toml

License

MIT — see LICENSE

Metadata

Release files for fabricatio-core 0.14.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for fabricatio-core 0.14.0
File
fabricatio_core-0.14.0-cp314-cp314-win_amd64.whl CPython 3.14 CPython 3.14 Windows x86-64 Details
fabricatio_core-0.14.0-cp314-cp314-manylinux_2_38_x86_64.whl CPython 3.14 CPython 3.14 Linux glibc 2.38+ x86-64 Details
fabricatio_core-0.14.0-cp314-cp314-manylinux_2_38_aarch64.whl CPython 3.14 CPython 3.14 Linux glibc 2.38+ ARM64 Details
fabricatio_core-0.14.0-cp314-cp314-macosx_11_0_arm64.whl CPython 3.14 CPython 3.14 macOS 11.0+ ARM64 Details
fabricatio_core-0.14.0-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details
fabricatio_core-0.14.0-cp313-cp313-manylinux_2_38_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.38+ x86-64 Details
fabricatio_core-0.14.0-cp313-cp313-manylinux_2_38_aarch64.whl CPython 3.13 CPython 3.13 Linux glibc 2.38+ ARM64 Details
fabricatio_core-0.14.0-cp313-cp313-macosx_11_0_arm64.whl CPython 3.13 CPython 3.13 macOS 11.0+ ARM64 Details
fabricatio_core-0.14.0-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details
fabricatio_core-0.14.0-cp312-cp312-manylinux_2_38_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.38+ x86-64 Details
fabricatio_core-0.14.0-cp312-cp312-manylinux_2_38_aarch64.whl CPython 3.12 CPython 3.12 Linux glibc 2.38+ ARM64 Details
fabricatio_core-0.14.0-cp312-cp312-macosx_11_0_arm64.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64 Details

Total release size: 169.5 MB

Release files / fabricatio_core-0.14.0-cp314-cp314-win_amd64.whl

Download URL fabricatio_core-0.14.0-cp314-cp314-win_amd64.whl
Size 14.1 MB
Tags CPython 3.14 Windows x86-64
SHA-256 checksum
How to use checksums
bf8eaa1e501a6cf7527cd8795a7c7007292288fd73090d227e1cd3b7569cc4df
BLAKE2b-256 checksum
How to use checksums
baa62cfbc8166e45303b0300c9c05fb5b7498fff81c3d77c5d668ab4d591f5ac
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.19 {"installer":{"name":"uv","version":"0.12.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / fabricatio_core-0.14.0-cp314-cp314-manylinux_2_38_x86_64.whl

Download URL fabricatio_core-0.14.0-cp314-cp314-manylinux_2_38_x86_64.whl
Size 15.2 MB
Tags CPython 3.14 Linux glibc 2.38+ x86-64
SHA-256 checksum
How to use checksums
77f124f53a4b192015192ae6a99b04efb150b1b9be94f3fd73fff6d2ed57e07e
BLAKE2b-256 checksum
How to use checksums
dcdcac60977afc8ce7dba1925a52527d548e940bf9509e4633e2eb3fbe6d470a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.19 {"installer":{"name":"uv","version":"0.12.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / fabricatio_core-0.14.0-cp314-cp314-manylinux_2_38_aarch64.whl

Download URL fabricatio_core-0.14.0-cp314-cp314-manylinux_2_38_aarch64.whl
Size 13.6 MB
Tags CPython 3.14 Linux glibc 2.38+ ARM64
SHA-256 checksum
How to use checksums
5b54829c664988dba1a629d954470c4c120f6751b3d35e3531864e1540266e72
BLAKE2b-256 checksum
How to use checksums
7f204822e8445bd0bae8e1e697ae593978b9f77534a006923873b445fddce5d8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.19 {"installer":{"name":"uv","version":"0.12.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / fabricatio_core-0.14.0-cp314-cp314-macosx_11_0_arm64.whl

Download URL fabricatio_core-0.14.0-cp314-cp314-macosx_11_0_arm64.whl
Size 13.7 MB
Tags CPython 3.14 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
d67844861daa5a1111307b884b28da926a5d2b9ceba4c517eedcd3d143622bf8
BLAKE2b-256 checksum
How to use checksums
86abba824579ff342f309f497476f503a675769dc4525b9ffef828cd4ce5ed44
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.19 {"installer":{"name":"uv","version":"0.12.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / fabricatio_core-0.14.0-cp313-cp313-win_amd64.whl

Download URL fabricatio_core-0.14.0-cp313-cp313-win_amd64.whl
Size 14.1 MB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
b4421a30134e2f916d2d945c2d8c6452b4cb7253508c23cc3601a183c9716a27
BLAKE2b-256 checksum
How to use checksums
cc06ebbad0b375edcc49c8a24937279d8abc009d37a26b444b1c74aad0d15209
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.19 {"installer":{"name":"uv","version":"0.12.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / fabricatio_core-0.14.0-cp313-cp313-manylinux_2_38_x86_64.whl

Download URL fabricatio_core-0.14.0-cp313-cp313-manylinux_2_38_x86_64.whl
Size 15.2 MB
Tags CPython 3.13 Linux glibc 2.38+ x86-64
SHA-256 checksum
How to use checksums
0479614c28c61ba363dbd673ad0a87e9a67879e02f18a4d95edddce8210b3cd1
BLAKE2b-256 checksum
How to use checksums
4beb1d6bad5356659de411acb6c58240100145d5aaa53744f0e322bd8c0c052e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.19 {"installer":{"name":"uv","version":"0.12.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / fabricatio_core-0.14.0-cp313-cp313-manylinux_2_38_aarch64.whl

Download URL fabricatio_core-0.14.0-cp313-cp313-manylinux_2_38_aarch64.whl
Size 13.6 MB
Tags CPython 3.13 Linux glibc 2.38+ ARM64
SHA-256 checksum
How to use checksums
77e979d47eba233a7053d7abce4dcf4c5f61b7e3944af56c991d0e18bcce2559
BLAKE2b-256 checksum
How to use checksums
b646fd06c0c3ac97b5dcecc410f4abb5f65bd9ee4ea207b683c86ef7b21ba91f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.19 {"installer":{"name":"uv","version":"0.12.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / fabricatio_core-0.14.0-cp313-cp313-macosx_11_0_arm64.whl

Download URL fabricatio_core-0.14.0-cp313-cp313-macosx_11_0_arm64.whl
Size 13.7 MB
Tags CPython 3.13 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
be26020f66f22372303c20a409c9169755aa4c08122336cd20e2160a48590c8a
BLAKE2b-256 checksum
How to use checksums
329ba802223ee42ee8cb0ed55b34b9f89f46973fc83c476492234afba2c0872a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.19 {"installer":{"name":"uv","version":"0.12.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / fabricatio_core-0.14.0-cp312-cp312-win_amd64.whl

Download URL fabricatio_core-0.14.0-cp312-cp312-win_amd64.whl
Size 14.1 MB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
cb9a8c1fba4eb304401486b729f99e604c21195753384a62205d0f7201a4fb8e
BLAKE2b-256 checksum
How to use checksums
2d2d2ceca59f154f0bb1539ef8f7aaa5aeda5ed288930a01fd4ee449cc79c1ea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.19 {"installer":{"name":"uv","version":"0.12.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / fabricatio_core-0.14.0-cp312-cp312-manylinux_2_38_x86_64.whl

Download URL fabricatio_core-0.14.0-cp312-cp312-manylinux_2_38_x86_64.whl
Size 15.2 MB
Tags CPython 3.12 Linux glibc 2.38+ x86-64
SHA-256 checksum
How to use checksums
69bc19279f09047496081877777b576d7228ea509d0a43bfa79716419670383d
BLAKE2b-256 checksum
How to use checksums
0e2ab8255e6ec6e191999b94134468fcf7bdaa180d683a8d5a5d4d1a0d57c01c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.19 {"installer":{"name":"uv","version":"0.12.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / fabricatio_core-0.14.0-cp312-cp312-manylinux_2_38_aarch64.whl

Download URL fabricatio_core-0.14.0-cp312-cp312-manylinux_2_38_aarch64.whl
Size 13.6 MB
Tags CPython 3.12 Linux glibc 2.38+ ARM64
SHA-256 checksum
How to use checksums
ec2424e111605ec1ddb2b21ae97e16a93abf398319189821fe29cd0bc4473957
BLAKE2b-256 checksum
How to use checksums
ef83dba096627c145fe4399ab69d449791a6fd23c9d7d0528e2a11786ba1fca4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.19 {"installer":{"name":"uv","version":"0.12.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / fabricatio_core-0.14.0-cp312-cp312-macosx_11_0_arm64.whl

Download URL fabricatio_core-0.14.0-cp312-cp312-macosx_11_0_arm64.whl
Size 13.7 MB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
c94756c42ccf32e88f18a510303795f065a0be1f718279d203485dfd2779aaf0
BLAKE2b-256 checksum
How to use checksums
4a5f8231074459201026e5cd1bd4a0ef17858e0dfb1a4ff8e76a8d0535bae3a4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.19 {"installer":{"name":"uv","version":"0.12.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

This release

0.14.0 This release

12 release files

0.9.0

12 release files

0.8.6

12 release files

0.8.5

12 release files

0.8.4

12 release files

0.8.3

12 release files

0.8.2

12 release files

0.7.0

12 release files

0.6.7

12 release files

0.6.6

12 release files

0.6.3

12 release files

0.6.2

12 release files

0.6.1

12 release files

0.6.0

12 release files

0.4.5

12 release files

0.4.4

12 release files

0.4.3

12 release files

0.4.0

12 release files

0.3.32

8 release files

0.3.31

8 release files

0.3.30

8 release files

0.3.28

8 release files

0.3.27

8 release files

0.3.19

8 release files

0.3.18

8 release files

0.3.17

8 release files

0.3.13

8 release files

0.3.12

8 release files

0.3.11

8 release files

0.3.10

8 release files

0.3.9

8 release files

0.3.7

8 release files

0.3.6

8 release files

0.3.5

8 release files

0.3.4

4 release files

0.3.3

4 release files

0.3.2

4 release files

0.3.1

4 release files

0.3.0

3 release files

0.1.11

3 release files

0.1.10

3 release files

0.1.9

3 release files

0.1.8

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.2

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page