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

Uploaded CPython 3.14Windows x86-64

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

Uploaded CPython 3.14manylinux: glibc 2.38+ ARM64

fabricatio_core-0.10.3-cp314-cp314-macosx_11_0_arm64.whl (12.4 MB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13manylinux: glibc 2.38+ ARM64

fabricatio_core-0.10.3-cp313-cp313-macosx_11_0_arm64.whl (12.4 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12manylinux: glibc 2.38+ ARM64

fabricatio_core-0.10.3-cp312-cp312-macosx_11_0_arm64.whl (12.4 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: fabricatio_core-0.10.3-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.3-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 dafca28551b48b1a9218c9c024986090ceb07347572c89d75e5b35daabfd650d
MD5 392c9033b732acfc3ab8e2c9280f1ceb
BLAKE2b-256 ec21a21c62f37c0c9b4ed1a51469314ab66f1d5b0ef3e473d65595587175cf02

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio_core-0.10.3-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.3-cp314-cp314-manylinux_2_38_x86_64.whl
Algorithm Hash digest
SHA256 3e0d2224a668f1502c5d51351609efd4abaa33d3da30ce305c7686e65355e17e
MD5 ebb9116b37c7ce11c8f4dfbc1005aeb5
BLAKE2b-256 2bac0f96db93ae959c8147a5ba72d4a77491d531a4b5e73dbe0d140e01101fcd

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio_core-0.10.3-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.3-cp314-cp314-manylinux_2_38_aarch64.whl
Algorithm Hash digest
SHA256 584baa17cb02dc064914bff7c31b04d8f4d417402480d5abd77b7aa048cb0e68
MD5 430cd719b15a6da0e821b25c7788dd54
BLAKE2b-256 ad3f14e3be4f0aed8fb2e55f6360e85c88697f323ec77fc84a5e0885a7eea380

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio_core-0.10.3-cp314-cp314-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 12.4 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.3-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e7fa8fa51098bf6cd7704e4494240e470f7431158a8b52c88cbb7811340b8eb7
MD5 baf68080ef466ef9f4f9fb6f8b950910
BLAKE2b-256 91de2ca5d2000b76e4bf1a9b5902fbd0f7611d9d470ffb14350343228f106076

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio_core-0.10.3-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.3-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 a611ef5050e3c8798b0f75a18c2032fcbb1252a5211bdc181fd025632fda2c8d
MD5 5b15a03fbed20baef35e70e3518a979b
BLAKE2b-256 05444560117f64968f59ec3ac6b1277fe77ff47848a06bb504bdeaeedd77c4df

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio_core-0.10.3-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.3-cp313-cp313-manylinux_2_38_x86_64.whl
Algorithm Hash digest
SHA256 32b1881f50ec25db596e04031f41a9726c58e06928666ec13811dc12081c1637
MD5 0d8b6cc4b5d4435dc48d70fcfe8068b9
BLAKE2b-256 525c8cc6c90a511547e4bf14bd3ccc32c046719b41f2a1909b3e437672a75f5c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio_core-0.10.3-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.3-cp313-cp313-manylinux_2_38_aarch64.whl
Algorithm Hash digest
SHA256 c8f5e0198aca079b6b57d539e58534eca6a07a26ff99f62754a7d72d526539bd
MD5 37fa39eb4a740c23db9969387bbe34ff
BLAKE2b-256 80f52131c5c713600ec58b6cf1ff271b5d8e1da70d0459e573a23a03e65b906f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio_core-0.10.3-cp313-cp313-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 12.4 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.3-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a4e2f41d7a664efa566a10f1e6b1aa4fbf5b83ddc9e1cfb555b1cf8a6fc54376
MD5 2ce213caefa03db3fa8392619eb5c168
BLAKE2b-256 ed130f5f422fcf686e150c8f83173844c6366f2c44771640d0affa3b50cf72d1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio_core-0.10.3-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.3-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 4afc738f39b6feb0ba20b006e3cd813b105d07cce846c2843a6816905b5f2ae0
MD5 e3135def4f2c86b001c14e304c72d195
BLAKE2b-256 fde2109851607e0abbdf373a36d0eefe29fa4f84bfbe5204ea819af9439b5afb

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio_core-0.10.3-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.3-cp312-cp312-manylinux_2_38_x86_64.whl
Algorithm Hash digest
SHA256 7d43e91792abefe540d1e476c4eab7d6dbd0004954c89817b3228501daa722ee
MD5 dc496ecf524b2671238915fd1a250ba3
BLAKE2b-256 09e946259bd9e467f2071f9ca7e180e63ab95081b2f00f90dd3f0d7b93e887e6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio_core-0.10.3-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.3-cp312-cp312-manylinux_2_38_aarch64.whl
Algorithm Hash digest
SHA256 b1fe0763a1a4d7c0ce6c815ad30be9f4a56fb77ff4612dfbe5447159a93487a9
MD5 0eaba4a530fb6aaeeb9b8805b18514cd
BLAKE2b-256 4d102717428fb677ea7d313fef3174393110474adc899f78cb62cc8262677f35

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio_core-0.10.3-cp312-cp312-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 12.4 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.3-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 bd3e230193acbfdf0679a3d3f7299c292931578cf6284782de9993f7fa7fa717
MD5 02592a2f6287022ee03c977ad6bc83ab
BLAKE2b-256 3b8909b2973c80b06f802ab42d68ffc14ea9dec19735950f4b7d6665f0eb45ae

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