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

Total release size: 152.6 MB

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

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

Download URL fabricatio_core-0.12.0-cp314-cp314-manylinux_2_38_x86_64.whl
Size 13.6 MB
Tags CPython 3.14 Linux glibc 2.38+ x86-64
SHA-256 checksum
How to use checksums
40aeb36b9fbfd83b0d6c86df94fd467db9687e5aafb53aabde164af5ee879207
BLAKE2b-256 checksum
How to use checksums
b7ffd3600cc7e045406bbe75db00f8e17483351f3d77f61e722d72bd09818b12
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","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.12.0-cp314-cp314-manylinux_2_38_aarch64.whl

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

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

Download URL fabricatio_core-0.12.0-cp313-cp313-win_amd64.whl
Size 12.6 MB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
c2378bb9c807a9e82b16566024bbee8b5ecee38970ede607eb7da1322a0812b7
BLAKE2b-256 checksum
How to use checksums
9efbc00d21c78d225efd7559fc2b7e7956654492b3a9cb744ed7f8772f07701c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","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.12.0-cp313-cp313-manylinux_2_38_x86_64.whl

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

Download URL fabricatio_core-0.12.0-cp313-cp313-manylinux_2_38_aarch64.whl
Size 12.3 MB
Tags CPython 3.13 Linux glibc 2.38+ ARM64
SHA-256 checksum
How to use checksums
8d685d51394b6a8c5d88183e6a2785caa997bfcde042da46a3096b5ad4f84e0c
BLAKE2b-256 checksum
How to use checksums
1f4099cdf82ad01885015517b222cf950ea3e099a9efb75318c84d4bd0d9b78b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","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.12.0-cp313-cp313-macosx_11_0_arm64.whl

Download URL fabricatio_core-0.12.0-cp313-cp313-macosx_11_0_arm64.whl
Size 12.3 MB
Tags CPython 3.13 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
64d9fa5616898656bb36f0e4d49b853ef7ef3314a0a0df0a3ed4522b2ff97dd7
BLAKE2b-256 checksum
How to use checksums
6fea850715ff1e010ec04c91e138da406ec16e8fd2c0670c1bf628f92f344cbb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","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.12.0-cp312-cp312-win_amd64.whl

Download URL fabricatio_core-0.12.0-cp312-cp312-win_amd64.whl
Size 12.6 MB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
360d1b82eae5b28200e06535ec956a1b9844a56277a8945bd31359cc390c52a5
BLAKE2b-256 checksum
How to use checksums
a4437020cf7d524e9eeca32da84b4926aa374bedb0a61961c0b4dec8c452a8d8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","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.12.0-cp312-cp312-manylinux_2_38_x86_64.whl

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

Download URL fabricatio_core-0.12.0-cp312-cp312-manylinux_2_38_aarch64.whl
Size 12.3 MB
Tags CPython 3.12 Linux glibc 2.38+ ARM64
SHA-256 checksum
How to use checksums
62498dbc4aa15525676a8e94d4d903ad233f9ae9608aed2571b960c6f5146b54
BLAKE2b-256 checksum
How to use checksums
3d2409c986860012abe1565e152c1b5430745b9f0add902d3be46acf0fa4e2c2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","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.12.0-cp312-cp312-macosx_11_0_arm64.whl

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