Skip to main content

Fabricatio Logo

MIT License Python Versions PyPI Version Ask DeepWiki PyPI Downloads (Week) PyPI Downloads Bindings: PyO3 Build Tool: uv + maturin

Build Package Ruff Lint Tests Coverage Status Documentation Status GitHub Issues GitHub Pull Requests GitHub Stars


Overview

Fabricatio is a streamlined Python library for building LLM applications using an event-based agent structure. It leverages Rust for performance-critical tasks, Handlebars for templating, and PyO3 for Python bindings.

Features

  • Event-Driven Architecture: Robust task management through an EventEmitter pattern.
  • LLM Integration & Templating: Seamlessly interact with large language models and dynamic content generation.
  • Async & Extensible: Fully asynchronous execution with easy extension via custom actions and workflows.

Installation

# install fabricatio with full capabilities.
pip install fabricatio[full]

# or with uv

uv add fabricatio[full]


# install fabricatio with only rag and rule capabilities.
pip install fabricatio[rag,rule]

# or with uv

uv add fabricatio[rag,rule]

You can download the templates from the github release manually and extract them to the work directory.

curl -L https://github.com/Whth/fabricatio/releases/download/v0.19.1/templates.tar.gz | tar -xz

Or you can use the cli tdown bundled with fabricatio to achieve the same result.

tdown download --verbose -o ./

Note: fabricatio performs template discovery across multiple sources with filename-based identification. Template resolution follows a priority hierarchy where working directory templates override templates located in <ROAMING>/fabricatio/templates.

Usage

Basic Example

"""Example of a simple hello world program using fabricatio."""

from typing import Any

# Import necessary classes from the namespace package.
from fabricatio import Action, Event, Role, Task, WorkFlow, logger


# Create an action.
class Hello(Action):
    """Action that says hello."""

    output_key: str = "task_output"

    async def _execute(self, **_) -> Any:
        ret = "Hello fabricatio!"
        logger.info("executing talk action")
        return ret


# Create the role and register the workflow.
(Role(name="talker")
 .subscribe(Event.quick_instantiate("talk"), WorkFlow(name="talk", steps=(Hello,)))
 .dispatch())

# Make a task and delegate it to the workflow registered above.
assert Task(name="say hello").delegate_blocking("talk") == "Hello fabricatio!"

Examples

For various usage scenarios, refer to the following examples:

  • Simple Chat
  • Structured Output
  • Extraction
  • Content Improvement
  • Retrieval-Augmented Generation (RAG)
  • Article Extraction
  • Propose Task
  • Code Review
  • Write Outline

(For full example details, see Examples)

Configuration

Fabricatio supports flexible configuration through multiple sources, with the following priority order: Call Arguments > ./.env > Environment Variables > ./fabricatio.toml > ./pyproject.toml > <ROMANING>/fabricatio/fabricatio.toml > Builtin Defaults.

Below is a unified view of the same configuration expressed in different formats:

Environment variables or dotenv file

FABRICATIO_LLM__SEND_TO=openai/gpt-3.5-turbo
FABRICATIO_LLM__TEMPERATURE=1.0
FABRICATIO_LLM__TOP_P=0.35
FABRICATIO_LLM__STREAM=false
FABRICATIO_LLM__MAX_COMPLETION_TOKENS=8192
FABRICATIO_DEBUG__LOG_LEVEL=INFO

fabricatio.toml file

[debug]
log_level = "DEBUG"


[llm]
send_to = "base" # send req to `base` group by default
max_completion_tokens = 32000
stream = false
temperature = 1.0
top_p = 0.35


[routing]
providers = [
    { ptype = "OpenAICompatible", key = "sk-...", name = "mm", base_url = "https://api.example.com/v1/" }
]

completion_deployments = [
    { id = "mm/a-completion-model", group = 'base', tpm = 100_000, rpm = 1000 }
]
cache_database_path = "path/to/.cache.db"

pyproject.toml file

[tool.fabricatio.debug]
log_level = "DEBUG"


[tool.fabricatio.llm]
send_to = "base" # send req to `base` group by default
max_completion_tokens = 32000
stream = false
temperature = 1.0
top_p = 0.35


[tool.fabricatio.routing]
providers = [
    { ptype = "OpenAICompatible", key = "sk-...", name = "mm", base_url = "https://api.example.com/v1/" }
]

completion_deployments = [
    { id = "mm/a-completion-model", group = 'base', tpm = 100_000, rpm = 1000 }
]
cache_database_path = "path/to/.cache.db"

Contributing

We welcome contributions from everyone! Before contributing, please read our Contributing Guide and Code of Conduct.

License

Fabricatio is licensed under the MIT License. See LICENSE for details.

Acknowledgments

Special thanks to the contributors and maintainers of:

Metadata

Release files for fabricatio 0.36.7

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 0.36.7
File Actions
fabricatio-0.36.7-cp314-cp314-win_amd64.whl CPython 3.14 CPython 3.14 Windows x86-64 Details for fabricatio-0.36.7-cp314-cp314-win_amd64.whl
fabricatio-0.36.7-cp314-cp314-manylinux_2_34_x86_64.whl CPython 3.14 CPython 3.14 Linux glibc 2.34+ x86-64 Details for fabricatio-0.36.7-cp314-cp314-manylinux_2_34_x86_64.whl
fabricatio-0.36.7-cp314-cp314-manylinux_2_34_aarch64.whl CPython 3.14 CPython 3.14 Linux glibc 2.34+ ARM64 Details for fabricatio-0.36.7-cp314-cp314-manylinux_2_34_aarch64.whl
fabricatio-0.36.7-cp314-cp314-macosx_11_0_arm64.whl CPython 3.14 CPython 3.14 macOS 11.0+ ARM64 Details for fabricatio-0.36.7-cp314-cp314-macosx_11_0_arm64.whl
fabricatio-0.36.7-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details for fabricatio-0.36.7-cp313-cp313-win_amd64.whl
fabricatio-0.36.7-cp313-cp313-manylinux_2_34_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.34+ x86-64 Details for fabricatio-0.36.7-cp313-cp313-manylinux_2_34_x86_64.whl
fabricatio-0.36.7-cp313-cp313-manylinux_2_34_aarch64.whl CPython 3.13 CPython 3.13 Linux glibc 2.34+ ARM64 Details for fabricatio-0.36.7-cp313-cp313-manylinux_2_34_aarch64.whl
fabricatio-0.36.7-cp313-cp313-macosx_11_0_arm64.whl CPython 3.13 CPython 3.13 macOS 11.0+ ARM64 Details for fabricatio-0.36.7-cp313-cp313-macosx_11_0_arm64.whl
fabricatio-0.36.7-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details for fabricatio-0.36.7-cp312-cp312-win_amd64.whl
fabricatio-0.36.7-cp312-cp312-manylinux_2_34_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.34+ x86-64 Details for fabricatio-0.36.7-cp312-cp312-manylinux_2_34_x86_64.whl
fabricatio-0.36.7-cp312-cp312-manylinux_2_34_aarch64.whl CPython 3.12 CPython 3.12 Linux glibc 2.34+ ARM64 Details for fabricatio-0.36.7-cp312-cp312-manylinux_2_34_aarch64.whl
fabricatio-0.36.7-cp312-cp312-macosx_11_0_arm64.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64 Details for fabricatio-0.36.7-cp312-cp312-macosx_11_0_arm64.whl

Total release size: 30.2 MB

Release files / fabricatio-0.36.7-cp314-cp314-win_amd64.whl

Download URL fabricatio-0.36.7-cp314-cp314-win_amd64.whl
Size 2.2 MB
Tags CPython 3.14 Windows x86-64
SHA-256 checksum
How to use checksums
4e00d834c808afe98a0ae09bdcb69f5966829749ee42be7443115d6af611b13a
BLAKE2b-256 checksum
How to use checksums
fa0c03a32ced3cf89086347f4fedb8f3729896a8ed521eeb0a841046fa356759
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","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-0.36.7-cp314-cp314-manylinux_2_34_x86_64.whl

Download URL fabricatio-0.36.7-cp314-cp314-manylinux_2_34_x86_64.whl
Size 2.8 MB
Tags CPython 3.14 Linux glibc 2.34+ x86-64
SHA-256 checksum
How to use checksums
1aed459d332acd1e0cac8e0cbec496d39693d23c9e477083af8ad4b5d6e2251b
BLAKE2b-256 checksum
How to use checksums
99661d644abf839b48bde3ff3f854d66ea54f8538634cc95c500bdb6939d49fb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / fabricatio-0.36.7-cp314-cp314-manylinux_2_34_aarch64.whl

Download URL fabricatio-0.36.7-cp314-cp314-manylinux_2_34_aarch64.whl
Size 2.6 MB
Tags CPython 3.14 Linux glibc 2.34+ ARM64
SHA-256 checksum
How to use checksums
8649cf2d4ee6bb632ab45c96af5689b735ca820484ca2e8e97ab9d79b6f5774f
BLAKE2b-256 checksum
How to use checksums
8d0d12328799f54246bd5d8ba4d585af5902c794a54f0f73b48c0a5219ba45a6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","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-0.36.7-cp314-cp314-macosx_11_0_arm64.whl

Download URL fabricatio-0.36.7-cp314-cp314-macosx_11_0_arm64.whl
Size 2.5 MB
Tags CPython 3.14 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
5e260969baf743d0cbcc8fe9a564b03c80bf881b8fcf50826eca9be9d9527425
BLAKE2b-256 checksum
How to use checksums
e38d051b6cb36bed6f6688d018713a7001cc60d28249a8914d70e33075cf8725
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","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-0.36.7-cp313-cp313-win_amd64.whl

Download URL fabricatio-0.36.7-cp313-cp313-win_amd64.whl
Size 2.2 MB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
7199ccf21e0a3b5c648caf89aad8ce2a4b83fdf57c34473ab1ccc2bed3de62c2
BLAKE2b-256 checksum
How to use checksums
ac550b3936a341537817ca12bcc4186fce32a89ecc852e73b57deb80e49393e9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","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-0.36.7-cp313-cp313-manylinux_2_34_x86_64.whl

Download URL fabricatio-0.36.7-cp313-cp313-manylinux_2_34_x86_64.whl
Size 2.8 MB
Tags CPython 3.13 Linux glibc 2.34+ x86-64
SHA-256 checksum
How to use checksums
452c6d0d2115df77c49f44bc139cbf48bfd476909be4d342a6cde0638bd57980
BLAKE2b-256 checksum
How to use checksums
c75debc7b73b65126341fa98727cc8d5e7ef1ad420af14a7907d821c776cb434
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / fabricatio-0.36.7-cp313-cp313-manylinux_2_34_aarch64.whl

Download URL fabricatio-0.36.7-cp313-cp313-manylinux_2_34_aarch64.whl
Size 2.6 MB
Tags CPython 3.13 Linux glibc 2.34+ ARM64
SHA-256 checksum
How to use checksums
6c9bc9e7aca8ef786c446dc39f5cf107f9fbb121279aa51fa2cc537d8668219e
BLAKE2b-256 checksum
How to use checksums
c129ead31c7086e65b433faa25a1f62e28780a9f669bc28486ccde8351c8c355
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","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-0.36.7-cp313-cp313-macosx_11_0_arm64.whl

Download URL fabricatio-0.36.7-cp313-cp313-macosx_11_0_arm64.whl
Size 2.5 MB
Tags CPython 3.13 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
c24c96ca736332c2a71edfe0241a669ca91241c139e6c19e368ed55326c24e47
BLAKE2b-256 checksum
How to use checksums
12bc83c00309623028e379ff8cdf3dd6e31a4427ca30e228cd0d483dffdbc390
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","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-0.36.7-cp312-cp312-win_amd64.whl

Download URL fabricatio-0.36.7-cp312-cp312-win_amd64.whl
Size 2.2 MB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
d89c05b02fe53d54c32b03a87413162ef07ca77474cc0271e2c1d9a5afecf54d
BLAKE2b-256 checksum
How to use checksums
23c6b51b87ddab6dd0fc9cc41d64317ac3ce86edd41030d126175c52a2e14330
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","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-0.36.7-cp312-cp312-manylinux_2_34_x86_64.whl

Download URL fabricatio-0.36.7-cp312-cp312-manylinux_2_34_x86_64.whl
Size 2.8 MB
Tags CPython 3.12 Linux glibc 2.34+ x86-64
SHA-256 checksum
How to use checksums
0ab73ed12160e54403a9b48c4bff142777ab845f3f0b4e3244efc663b14ac250
BLAKE2b-256 checksum
How to use checksums
e7a31de787ed4fb542d24321f6bd85ac639455c31b885c2796150049e60c1024
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / fabricatio-0.36.7-cp312-cp312-manylinux_2_34_aarch64.whl

Download URL fabricatio-0.36.7-cp312-cp312-manylinux_2_34_aarch64.whl
Size 2.6 MB
Tags CPython 3.12 Linux glibc 2.34+ ARM64
SHA-256 checksum
How to use checksums
273117cc9c3d7e5bb0238ba61d0b1939e4a2c83e77b090d12391b042b1137844
BLAKE2b-256 checksum
How to use checksums
f45b7de98128dc01d8f3de5853755545a87a4d1d8d430cd122b36b3f289d82b6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","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-0.36.7-cp312-cp312-macosx_11_0_arm64.whl

Download URL fabricatio-0.36.7-cp312-cp312-macosx_11_0_arm64.whl
Size 2.5 MB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
921b7170bed79cfa622aa192bcf594763ee544168f693074b76058401a6b4fd7
BLAKE2b-256 checksum
How to use checksums
0c3d18684a30bc298521253641408122f997e1dcc8bc5f85886c8511859a3cc3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","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}

Security for fabricatio 0.36.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.36.7 This release

12 release files No provenance

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