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.1-cp314-cp314-win_amd64.whl (12.5 MB view details)

Uploaded CPython 3.14Windows x86-64

fabricatio_core-0.10.1-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.1-cp314-cp314-manylinux_2_38_aarch64.whl (12.1 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.38+ ARM64

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

Uploaded CPython 3.14macOS 11.0+ ARM64

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

Uploaded CPython 3.13Windows x86-64

fabricatio_core-0.10.1-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.1-cp313-cp313-manylinux_2_38_aarch64.whl (12.1 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.38+ ARM64

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

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

fabricatio_core-0.10.1-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.1-cp312-cp312-manylinux_2_38_aarch64.whl (12.1 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.38+ ARM64

fabricatio_core-0.10.1-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.1-cp314-cp314-win_amd64.whl.

File metadata

  • Download URL: fabricatio_core-0.10.1-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.29 {"installer":{"name":"uv","version":"0.11.29","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.1-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 ad01a18e85eea1c18a69a08653b7ad8af644b1d34120ac7a5dab2f1383b04285
MD5 8e25d1d7e94a7c7b4138e210e0597c9f
BLAKE2b-256 7bf46fc5d02949c5a6af02ca22328be0723a5d204e5c8522212431bd3f17fd4b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio_core-0.10.1-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.29 {"installer":{"name":"uv","version":"0.11.29","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.1-cp314-cp314-manylinux_2_38_x86_64.whl
Algorithm Hash digest
SHA256 663a04ad12a732380e749d97cc7b76f5bec069c6b51ecbf7fa2a751fbd3a2ca1
MD5 08c2f32ebd24ccb49f266188b463518e
BLAKE2b-256 63e78ad44a997ae73fcf44af93bc4b281b750b8bcbfda236abb95bafb469e464

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio_core-0.10.1-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.29 {"installer":{"name":"uv","version":"0.11.29","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.1-cp314-cp314-manylinux_2_38_aarch64.whl
Algorithm Hash digest
SHA256 e8da1cb243a4c11b97b952b89f9e4ca636715bb8956f3d0d5f83628cd1ae8414
MD5 110d34511811bd619c6cf6fba60b653a
BLAKE2b-256 45ff3e82dfe003da35e9c3a793a6845827aaed7550458e5ee238d841ad63164b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio_core-0.10.1-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.29 {"installer":{"name":"uv","version":"0.11.29","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.1-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 25b22a71212aac17cf44d5ed162eff3e26de91fd76dd8528045c5f93e5c3f051
MD5 1a14f03083721ba8e70b30c894159273
BLAKE2b-256 5b8aeebd695ce9f2f48609b0f51b4bf46c21bf3f1a4c7b1f5b0a8bf9bc3a698f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio_core-0.10.1-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.29 {"installer":{"name":"uv","version":"0.11.29","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.1-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 d1759a90d35d482037af79dd727ffe84afeb234b9881caed04cc9a44a060d248
MD5 a4f17d7bdf53834a78c7f4a8d0ade1b8
BLAKE2b-256 969752292c249b275952528a482abb9e3bcb4e41bd9297cb850178f37bd5c3ac

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio_core-0.10.1-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.29 {"installer":{"name":"uv","version":"0.11.29","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.1-cp313-cp313-manylinux_2_38_x86_64.whl
Algorithm Hash digest
SHA256 b3aa377e00615d79fb40d660a7675654bd70045a242336117bbad2ca14cd6eae
MD5 19413795eb2f8218fa8856b0cb1ebff1
BLAKE2b-256 b805c6e141cb3570b25e4e93a05df7df7802bdff50fb12ea7d943faa9c9464d1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio_core-0.10.1-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.29 {"installer":{"name":"uv","version":"0.11.29","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.1-cp313-cp313-manylinux_2_38_aarch64.whl
Algorithm Hash digest
SHA256 88c9a600e8a82c2124555ada8b0cfa565d0998a80131e7bc0a0572e7a1f8aee5
MD5 25e0d08cd659f37076f9a77e69bee27d
BLAKE2b-256 f00931e4914fece67980df16152b4502255cf40a71b3105c301a8c339de3663b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio_core-0.10.1-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.29 {"installer":{"name":"uv","version":"0.11.29","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.1-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ce5cd76ddbf46ae34a325167ea3c81ff2f68fe93e0a363c8fedcf7715477253e
MD5 fa7e3684fc79c58a6ea0931f35149314
BLAKE2b-256 f7c86710403348dcea6f4bc37bc58f468af229c177b429baee759b30ac9bc3f5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio_core-0.10.1-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.29 {"installer":{"name":"uv","version":"0.11.29","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.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 eea8d1d4058f8d78ca95d3c597b6f34fdcb5346b1506fa215590b0813f966e58
MD5 9de349cae7a3c6811c0e1884a552532a
BLAKE2b-256 725375b5051f76f2cdbfa3f83883c5f0fd24de458e613ff52feaaed6575ad713

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio_core-0.10.1-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.29 {"installer":{"name":"uv","version":"0.11.29","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.1-cp312-cp312-manylinux_2_38_x86_64.whl
Algorithm Hash digest
SHA256 9d7f265eff84c979b96fa8a07b333cfdddc173a455ab4cb0338cdb6642206320
MD5 3ec5d444ffd4c89ffe4a319ae7ce7c1e
BLAKE2b-256 e6049c85e1c99c2c62bf469e3f3b8edb51e3a485615d9f7f260b9be3cce58713

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio_core-0.10.1-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.29 {"installer":{"name":"uv","version":"0.11.29","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.1-cp312-cp312-manylinux_2_38_aarch64.whl
Algorithm Hash digest
SHA256 1fd936b07f95222612f25fa437a2b9e33e72ecdce95db5a94c6ed81f468a2dad
MD5 f0c2b03ffe6c16651a7ce3a5649d8efc
BLAKE2b-256 5d43b2303d468f05331dffd2e25e337d98a39ba14533d4783db5ee2bd9f7da8f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio_core-0.10.1-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.29 {"installer":{"name":"uv","version":"0.11.29","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.1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b60f4b3eefa27993a059f92dd30b463af2a53fc11ed65f3d7ce541726138bf40
MD5 719ee0a0b40663c33a3e3c0e0e1718c8
BLAKE2b-256 612f36660b1da575b31c953377a3cf044c26740727626c8d563827e0a5f42e68

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