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.13.1

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.13.1
File
fabricatio_core-0.13.1-cp314-cp314-win_amd64.whl CPython 3.14 CPython 3.14 Windows x86-64 Details
fabricatio_core-0.13.1-cp314-cp314-manylinux_2_38_x86_64.whl CPython 3.14 CPython 3.14 Linux glibc 2.38+ x86-64 Details
fabricatio_core-0.13.1-cp314-cp314-manylinux_2_38_aarch64.whl CPython 3.14 CPython 3.14 Linux glibc 2.38+ ARM64 Details
fabricatio_core-0.13.1-cp314-cp314-macosx_11_0_arm64.whl CPython 3.14 CPython 3.14 macOS 11.0+ ARM64 Details
fabricatio_core-0.13.1-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details
fabricatio_core-0.13.1-cp313-cp313-manylinux_2_38_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.38+ x86-64 Details
fabricatio_core-0.13.1-cp313-cp313-manylinux_2_38_aarch64.whl CPython 3.13 CPython 3.13 Linux glibc 2.38+ ARM64 Details
fabricatio_core-0.13.1-cp313-cp313-macosx_11_0_arm64.whl CPython 3.13 CPython 3.13 macOS 11.0+ ARM64 Details
fabricatio_core-0.13.1-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details
fabricatio_core-0.13.1-cp312-cp312-manylinux_2_38_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.38+ x86-64 Details
fabricatio_core-0.13.1-cp312-cp312-manylinux_2_38_aarch64.whl CPython 3.12 CPython 3.12 Linux glibc 2.38+ ARM64 Details
fabricatio_core-0.13.1-cp312-cp312-macosx_11_0_arm64.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64 Details

Total release size: 164.7 MB

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

Download URL fabricatio_core-0.13.1-cp314-cp314-win_amd64.whl
Size 13.7 MB
Tags CPython 3.14 Windows x86-64
SHA-256 checksum
How to use checksums
7ae2f1d214aed6932aab4352befa31c40b1a410723c54a8487b09635ae715049
BLAKE2b-256 checksum
How to use checksums
8a2ec9c3a97eab00960c18532bb29fc0a220f1f27e240a57dc842ee40802e42f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.15 {"installer":{"name":"uv","version":"0.12.15","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.13.1-cp314-cp314-manylinux_2_38_x86_64.whl

Download URL fabricatio_core-0.13.1-cp314-cp314-manylinux_2_38_x86_64.whl
Size 14.8 MB
Tags CPython 3.14 Linux glibc 2.38+ x86-64
SHA-256 checksum
How to use checksums
5f0afe5c853cec08696c09d0353a119a2d3a0eaae48ad094f0168c41685aee38
BLAKE2b-256 checksum
How to use checksums
8dcb074bcf3468ac9a85de1a35699a99bfd91bae8012435fa86b9e67d9cd75d5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.15 {"installer":{"name":"uv","version":"0.12.15","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.13.1-cp314-cp314-manylinux_2_38_aarch64.whl

Download URL fabricatio_core-0.13.1-cp314-cp314-manylinux_2_38_aarch64.whl
Size 13.2 MB
Tags CPython 3.14 Linux glibc 2.38+ ARM64
SHA-256 checksum
How to use checksums
8e5e4eed955395f05cf2d571f17ef4ea3521365d2284a4771eb9a933b8af5781
BLAKE2b-256 checksum
How to use checksums
d915629826f87d30cbfdf4e4d5e87285931bab583775308c3519c4bce61ace6d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.15 {"installer":{"name":"uv","version":"0.12.15","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.13.1-cp314-cp314-macosx_11_0_arm64.whl

Download URL fabricatio_core-0.13.1-cp314-cp314-macosx_11_0_arm64.whl
Size 13.3 MB
Tags CPython 3.14 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
d4bc5f1dbfe81435da31bf6d5f3e52fe5eed448ed309c333c699884ed5e35b63
BLAKE2b-256 checksum
How to use checksums
cbee2f0b04e2ac588dc2e7fba9437563eab26dff55e2dd60a46e8d09f769013e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.15 {"installer":{"name":"uv","version":"0.12.15","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.13.1-cp313-cp313-win_amd64.whl

Download URL fabricatio_core-0.13.1-cp313-cp313-win_amd64.whl
Size 13.7 MB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
6a574604a0c2717de13d17555ebf53eb6fba2818b617c7aa10ba5c4dec4613f2
BLAKE2b-256 checksum
How to use checksums
f98be470212963669a2c5283cbde16a4a8472bbc29425701325cfd3140cc1f72
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.15 {"installer":{"name":"uv","version":"0.12.15","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.13.1-cp313-cp313-manylinux_2_38_x86_64.whl

Download URL fabricatio_core-0.13.1-cp313-cp313-manylinux_2_38_x86_64.whl
Size 14.8 MB
Tags CPython 3.13 Linux glibc 2.38+ x86-64
SHA-256 checksum
How to use checksums
e48d2bf190ece71cc881e701c230fa4040afaf4948191aff193c650599f81848
BLAKE2b-256 checksum
How to use checksums
ae55e8051a502ac6f0d6fdfa2822ef469df4aff337050169f4d3b6325a93a74b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.15 {"installer":{"name":"uv","version":"0.12.15","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.13.1-cp313-cp313-manylinux_2_38_aarch64.whl

Download URL fabricatio_core-0.13.1-cp313-cp313-manylinux_2_38_aarch64.whl
Size 13.2 MB
Tags CPython 3.13 Linux glibc 2.38+ ARM64
SHA-256 checksum
How to use checksums
0af54723676119b62a976f086973c3750bca0d29409c1e5434748fe3b8d1e2b9
BLAKE2b-256 checksum
How to use checksums
a5bf33ae5b7e0da9c9f2037b5027faa16996b07b7b7316862a60088f02af8e64
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.15 {"installer":{"name":"uv","version":"0.12.15","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.13.1-cp313-cp313-macosx_11_0_arm64.whl

Download URL fabricatio_core-0.13.1-cp313-cp313-macosx_11_0_arm64.whl
Size 13.3 MB
Tags CPython 3.13 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
4a9b9fa30acd1cf0c15a1e0e28cb62e89fa4e45e3af2ce0788a6412cd1dd0eba
BLAKE2b-256 checksum
How to use checksums
d26ef1c8735cc1a9af67829c07194cc1ddb7256d9f3d72d8cd4781343fc4f4f4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.15 {"installer":{"name":"uv","version":"0.12.15","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.13.1-cp312-cp312-win_amd64.whl

Download URL fabricatio_core-0.13.1-cp312-cp312-win_amd64.whl
Size 13.7 MB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
d025a2e4919293b83ca18edb0d9acdc28384b8ee8828b7ccb32c6fe50b972c09
BLAKE2b-256 checksum
How to use checksums
08ae7786bc7dc9f1d6471b8bc042699202199559625343306ec5042a2a7d409a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.15 {"installer":{"name":"uv","version":"0.12.15","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.13.1-cp312-cp312-manylinux_2_38_x86_64.whl

Download URL fabricatio_core-0.13.1-cp312-cp312-manylinux_2_38_x86_64.whl
Size 14.8 MB
Tags CPython 3.12 Linux glibc 2.38+ x86-64
SHA-256 checksum
How to use checksums
b0d59297b2ecc895be47833036bf958729b0bedf24af63ec60c7527945262368
BLAKE2b-256 checksum
How to use checksums
58f2cf0ad0b4fecea5b410ef0183746859696bd7e32b642697517cd6c6a1a7a6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.15 {"installer":{"name":"uv","version":"0.12.15","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.13.1-cp312-cp312-manylinux_2_38_aarch64.whl

Download URL fabricatio_core-0.13.1-cp312-cp312-manylinux_2_38_aarch64.whl
Size 13.2 MB
Tags CPython 3.12 Linux glibc 2.38+ ARM64
SHA-256 checksum
How to use checksums
93b124c91d177024e72ab919a2e74ef9aae4580e11d31a226c42a6b56fb8fdb6
BLAKE2b-256 checksum
How to use checksums
5cd9fe7ec0668f1426fd90aaedcb266ae88a6a64bbe80ea1478a5c05f285f652
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.15 {"installer":{"name":"uv","version":"0.12.15","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.13.1-cp312-cp312-macosx_11_0_arm64.whl

Download URL fabricatio_core-0.13.1-cp312-cp312-macosx_11_0_arm64.whl
Size 13.3 MB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
0f1b765f3c1ead3884082c103d2be2805182dbb51048a1eae0d19e7ed9637dfd
BLAKE2b-256 checksum
How to use checksums
0d04cffbceb0de6830e6eb21839fea42f5abc4980ba3d84830ac680d1cc9fe66
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.15 {"installer":{"name":"uv","version":"0.12.15","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.13.1 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