Skip to main content

A foundational Python library providing core components for building LLM-driven applications using an event-based agent structure.

Project description

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

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

fabricatio_core-0.10.5-cp314-cp314-win_amd64.whl (12.5 MB view details)

Uploaded CPython 3.14Windows x86-64

fabricatio_core-0.10.5-cp314-cp314-manylinux_2_38_x86_64.whl (13.4 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.38+ x86-64

fabricatio_core-0.10.5-cp314-cp314-manylinux_2_38_aarch64.whl (12.1 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.38+ ARM64

fabricatio_core-0.10.5-cp314-cp314-macosx_11_0_arm64.whl (12.3 MB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

fabricatio_core-0.10.5-cp313-cp313-win_amd64.whl (12.5 MB view details)

Uploaded CPython 3.13Windows x86-64

fabricatio_core-0.10.5-cp313-cp313-manylinux_2_38_x86_64.whl (13.4 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.38+ x86-64

fabricatio_core-0.10.5-cp313-cp313-manylinux_2_38_aarch64.whl (12.1 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.38+ ARM64

fabricatio_core-0.10.5-cp313-cp313-macosx_11_0_arm64.whl (12.3 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

fabricatio_core-0.10.5-cp312-cp312-win_amd64.whl (12.5 MB view details)

Uploaded CPython 3.12Windows x86-64

fabricatio_core-0.10.5-cp312-cp312-manylinux_2_38_x86_64.whl (13.4 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.38+ x86-64

fabricatio_core-0.10.5-cp312-cp312-manylinux_2_38_aarch64.whl (12.1 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.38+ ARM64

fabricatio_core-0.10.5-cp312-cp312-macosx_11_0_arm64.whl (12.3 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

File details

Details for the file fabricatio_core-0.10.5-cp314-cp314-win_amd64.whl.

File metadata

  • Download URL: fabricatio_core-0.10.5-cp314-cp314-win_amd64.whl
  • Upload date:
  • Size: 12.5 MB
  • Tags: CPython 3.14, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","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}

File hashes

Hashes for fabricatio_core-0.10.5-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 af6ea59961d63ce14064df652a18724b8cda13359fd324cbb3c2df1993b2828d
MD5 0c6ee5af472794ca334946ff6d7e1410
BLAKE2b-256 fa1517b7a3e1be5dcd4a431b5cb3253729fca8ae8901e90da6c064a69d557c3f

See more details on using hashes here.

File details

Details for the file fabricatio_core-0.10.5-cp314-cp314-manylinux_2_38_x86_64.whl.

File metadata

  • Download URL: fabricatio_core-0.10.5-cp314-cp314-manylinux_2_38_x86_64.whl
  • Upload date:
  • Size: 13.4 MB
  • Tags: CPython 3.14, manylinux: glibc 2.38+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","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}

File hashes

Hashes for fabricatio_core-0.10.5-cp314-cp314-manylinux_2_38_x86_64.whl
Algorithm Hash digest
SHA256 90bccd2b8726798b5aaa036dfcdea83eae5b359927b7c1775d81bc3a05bb0e88
MD5 ef9e3ad1a1e72d945c44b11050eee2cd
BLAKE2b-256 ee94a6a6a9287285fb26fc3ccd0722a209e510d512bd4d5719f3679b6e3ef301

See more details on using hashes here.

File details

Details for the file fabricatio_core-0.10.5-cp314-cp314-manylinux_2_38_aarch64.whl.

File metadata

  • Download URL: fabricatio_core-0.10.5-cp314-cp314-manylinux_2_38_aarch64.whl
  • Upload date:
  • Size: 12.1 MB
  • Tags: CPython 3.14, manylinux: glibc 2.38+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","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}

File hashes

Hashes for fabricatio_core-0.10.5-cp314-cp314-manylinux_2_38_aarch64.whl
Algorithm Hash digest
SHA256 2a529ada987e73259e63aca091d7b0fa0037fafeb77a98714426762f4a0e4228
MD5 b9185a29e94ebbdfef62772219d3eac4
BLAKE2b-256 d50fa4c5244b0f32ff56238527273ed9d4b1b25f67f045633436ec8bbe8ab9d3

See more details on using hashes here.

File details

Details for the file fabricatio_core-0.10.5-cp314-cp314-macosx_11_0_arm64.whl.

File metadata

  • Download URL: fabricatio_core-0.10.5-cp314-cp314-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 12.3 MB
  • Tags: CPython 3.14, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","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}

File hashes

Hashes for fabricatio_core-0.10.5-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1d29a9470efa703e386b7f9ae0654cc6b2402fb782794945faefdcf505fdf78d
MD5 fc7d79aa031acee8ec3ec5dcc4b83182
BLAKE2b-256 71971e847c5171375b05c42e16377afe62d640628dba560410a6315a5db56135

See more details on using hashes here.

File details

Details for the file fabricatio_core-0.10.5-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: fabricatio_core-0.10.5-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 12.5 MB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","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}

File hashes

Hashes for fabricatio_core-0.10.5-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 9d0f2f859c2a6bf3f77961612920885b54540babda44cf6c300ac6b83cba3223
MD5 22ff15742fb36de237e0f81d1b8bbcb1
BLAKE2b-256 750958ac055b202477a867e1e787aab9e3ae7291a27d6896266bb29f0f18eae8

See more details on using hashes here.

File details

Details for the file fabricatio_core-0.10.5-cp313-cp313-manylinux_2_38_x86_64.whl.

File metadata

  • Download URL: fabricatio_core-0.10.5-cp313-cp313-manylinux_2_38_x86_64.whl
  • Upload date:
  • Size: 13.4 MB
  • Tags: CPython 3.13, manylinux: glibc 2.38+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","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}

File hashes

Hashes for fabricatio_core-0.10.5-cp313-cp313-manylinux_2_38_x86_64.whl
Algorithm Hash digest
SHA256 7d39222e02549b848d99fa6744aa76f97ffa76b985ef00a306bf2703562bd58a
MD5 56ea2c027f543ebbf17671728381bfcd
BLAKE2b-256 6490445372dd7d20bf35adbcff42f1127182ffc261792f289d064ad12fb51283

See more details on using hashes here.

File details

Details for the file fabricatio_core-0.10.5-cp313-cp313-manylinux_2_38_aarch64.whl.

File metadata

  • Download URL: fabricatio_core-0.10.5-cp313-cp313-manylinux_2_38_aarch64.whl
  • Upload date:
  • Size: 12.1 MB
  • Tags: CPython 3.13, manylinux: glibc 2.38+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","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}

File hashes

Hashes for fabricatio_core-0.10.5-cp313-cp313-manylinux_2_38_aarch64.whl
Algorithm Hash digest
SHA256 38848299bb6e8fb8a59d203d91225dba1f961b4aea5d1419e2d0c0c87d6ffb4e
MD5 d5d5a23d1fc3061c5336c812b276fade
BLAKE2b-256 e6d48217e49e49e9c05ec211f6ff1df91fefc8de19d200e3fd78eccb97a76a12

See more details on using hashes here.

File details

Details for the file fabricatio_core-0.10.5-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

  • Download URL: fabricatio_core-0.10.5-cp313-cp313-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 12.3 MB
  • Tags: CPython 3.13, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","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}

File hashes

Hashes for fabricatio_core-0.10.5-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0fb863becc41049f6f26798edceb420814b4d1781ccc8a4aafbed09ec3cef525
MD5 764375c8dc8e60d7721123fc0281b0d7
BLAKE2b-256 b0cb4a722f29e78af27b2f0961251df6f4d7740bc2a2c1aacbba506d913cd951

See more details on using hashes here.

File details

Details for the file fabricatio_core-0.10.5-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: fabricatio_core-0.10.5-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 12.5 MB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","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}

File hashes

Hashes for fabricatio_core-0.10.5-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 6699a98e6e7db61abe7f3858d00325c1fc4f9fbde00654b9f472213999de5130
MD5 5308e6f8fdd2cab58c788515e3f38b2b
BLAKE2b-256 e215e319a36b8c4f90efd46168dcdf1e927b0251730b1cff911a570849db7dc0

See more details on using hashes here.

File details

Details for the file fabricatio_core-0.10.5-cp312-cp312-manylinux_2_38_x86_64.whl.

File metadata

  • Download URL: fabricatio_core-0.10.5-cp312-cp312-manylinux_2_38_x86_64.whl
  • Upload date:
  • Size: 13.4 MB
  • Tags: CPython 3.12, manylinux: glibc 2.38+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","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}

File hashes

Hashes for fabricatio_core-0.10.5-cp312-cp312-manylinux_2_38_x86_64.whl
Algorithm Hash digest
SHA256 cad3337fe859daa117b20eadf54da594332801a32cdde84269515b8ae633f819
MD5 182a1af1994db5120b9b3664fdff0401
BLAKE2b-256 9d3fa5a53e041d5ceddc07d63fb65a603e1c54081849d8328190c2876fa477b7

See more details on using hashes here.

File details

Details for the file fabricatio_core-0.10.5-cp312-cp312-manylinux_2_38_aarch64.whl.

File metadata

  • Download URL: fabricatio_core-0.10.5-cp312-cp312-manylinux_2_38_aarch64.whl
  • Upload date:
  • Size: 12.1 MB
  • Tags: CPython 3.12, manylinux: glibc 2.38+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","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}

File hashes

Hashes for fabricatio_core-0.10.5-cp312-cp312-manylinux_2_38_aarch64.whl
Algorithm Hash digest
SHA256 647867f401329bdca53f9c7905647fc193c2f4a055fa0189ebea7b1c81bf3d42
MD5 2280aa63070f74ca1562fca2f339b04e
BLAKE2b-256 5f9458be6041a9765633733f95c36de90137d491523c771150fe2705b16e7651

See more details on using hashes here.

File details

Details for the file fabricatio_core-0.10.5-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

  • Download URL: fabricatio_core-0.10.5-cp312-cp312-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 12.3 MB
  • Tags: CPython 3.12, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","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}

File hashes

Hashes for fabricatio_core-0.10.5-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1b812bf548ab005f5f603e169292c9953132793544efd994775b079b563d767a
MD5 3da83bb8f38cfcf3a0a6ea0170a8bd45
BLAKE2b-256 ee30c479c7b9467055b90871ac22233ded29c50fd097d09d954fd6946c039315

See more details on using hashes here.

Supported by

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