Skip to main content

A LLM multi-agent framework.

Project description

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.

TODO

  • Add api support.
  • Run as mcp server.
  • Finalize the webui.
  • Add Plugin system.
  • Replace litellm with native rust impl
    • Port deprecated mock utils to thryd impl
    • Port tests to new mock utils
    • Sync documentations
  • Add worktree-based isolated development subpackage
  • Add level-based context compression subpackage
  • TreeSetter-based ACE
  • Self-Extensible Agent
  • Add more examples
  • Port build workflow to Justfile

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()
 .add_skill(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
  • 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:

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

Uploaded CPython 3.14Windows x86-64

fabricatio-0.27.1-cp314-cp314-manylinux_2_34_x86_64.whl (3.2 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.34+ x86-64

fabricatio-0.27.1-cp314-cp314-manylinux_2_34_aarch64.whl (3.0 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.34+ ARM64

fabricatio-0.27.1-cp314-cp314-macosx_11_0_arm64.whl (2.9 MB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

fabricatio-0.27.1-cp313-cp313-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.13Windows x86-64

fabricatio-0.27.1-cp313-cp313-manylinux_2_34_x86_64.whl (3.2 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.34+ x86-64

fabricatio-0.27.1-cp313-cp313-manylinux_2_34_aarch64.whl (3.0 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.34+ ARM64

fabricatio-0.27.1-cp313-cp313-macosx_11_0_arm64.whl (2.9 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

fabricatio-0.27.1-cp312-cp312-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.12Windows x86-64

fabricatio-0.27.1-cp312-cp312-manylinux_2_34_x86_64.whl (3.2 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.34+ x86-64

fabricatio-0.27.1-cp312-cp312-manylinux_2_34_aarch64.whl (3.0 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.34+ ARM64

fabricatio-0.27.1-cp312-cp312-macosx_11_0_arm64.whl (2.9 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

File details

Details for the file fabricatio-0.27.1-cp314-cp314-win_amd64.whl.

File metadata

  • Download URL: fabricatio-0.27.1-cp314-cp314-win_amd64.whl
  • Upload date:
  • Size: 2.7 MB
  • Tags: CPython 3.14, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","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-0.27.1-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 dd85766be4662921d6c47b8c7fa1d3271329db9680c5f4b989cbeb254e6b882f
MD5 7871625eac4868f3e976a3dfe8d6ec4e
BLAKE2b-256 5b22ca9636d1a72e583ccc7da748e768fc7a6748b5aa5faa7d5c29f8b1d418b6

See more details on using hashes here.

File details

Details for the file fabricatio-0.27.1-cp314-cp314-manylinux_2_34_x86_64.whl.

File metadata

  • Download URL: fabricatio-0.27.1-cp314-cp314-manylinux_2_34_x86_64.whl
  • Upload date:
  • Size: 3.2 MB
  • Tags: CPython 3.14, manylinux: glibc 2.34+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","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-0.27.1-cp314-cp314-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 3b33c44920b7aa12a969fd5ad7365f1551b5eb11edc582fe79df038fff041f38
MD5 f56db971522b91c9ff74f0c5c2d010cc
BLAKE2b-256 63ad006d2ba8b3ce0efe7f1efd2b77beebc3a4bf5558423ede9e7b1ee58c00f1

See more details on using hashes here.

File details

Details for the file fabricatio-0.27.1-cp314-cp314-manylinux_2_34_aarch64.whl.

File metadata

  • Download URL: fabricatio-0.27.1-cp314-cp314-manylinux_2_34_aarch64.whl
  • Upload date:
  • Size: 3.0 MB
  • Tags: CPython 3.14, manylinux: glibc 2.34+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","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-0.27.1-cp314-cp314-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 3985b962b2ee69655072bd1def83728fc9462a75d3d1b3689384d144e5530874
MD5 1f7ff81907e3d3ccfbbddd80957b9208
BLAKE2b-256 049cddb000b6608fd0ccd7a9097b7ec30c3234eb951ac73b624d90be8f8af7e4

See more details on using hashes here.

File details

Details for the file fabricatio-0.27.1-cp314-cp314-macosx_11_0_arm64.whl.

File metadata

  • Download URL: fabricatio-0.27.1-cp314-cp314-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 2.9 MB
  • Tags: CPython 3.14, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","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-0.27.1-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 01dc9cd00fe0f3e578a288b7226aeedc46d633bd63071d96e78439f7d496d211
MD5 f8aea217a33b934b3c832ef6a5b8e996
BLAKE2b-256 306c66a2f6b5ee56f78074d0f232f20d29d50cdb48c4654e1bd917a1dac8f115

See more details on using hashes here.

File details

Details for the file fabricatio-0.27.1-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: fabricatio-0.27.1-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 2.7 MB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","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-0.27.1-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 891bc7d5d21add2320cfd3ed579f7417b8de095894edb005618e09fcc23f758d
MD5 35d31ec770ebbce03b185562105e0585
BLAKE2b-256 70aa371dc723884623c623ec18030f43b362325e487c8b23e970e8a4572375e3

See more details on using hashes here.

File details

Details for the file fabricatio-0.27.1-cp313-cp313-manylinux_2_34_x86_64.whl.

File metadata

  • Download URL: fabricatio-0.27.1-cp313-cp313-manylinux_2_34_x86_64.whl
  • Upload date:
  • Size: 3.2 MB
  • Tags: CPython 3.13, manylinux: glibc 2.34+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","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-0.27.1-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 b23ffb32f7d81810e3fff1f608f4a52f9b8b9eb86e75424f3f2724be9b0fec03
MD5 45ab2d8dcc357c6ba529cc8964a17919
BLAKE2b-256 15fe0fcb7fa7cafd19218c1fbfd13ea20117db4009e08ebe158d1f2b4ac1899c

See more details on using hashes here.

File details

Details for the file fabricatio-0.27.1-cp313-cp313-manylinux_2_34_aarch64.whl.

File metadata

  • Download URL: fabricatio-0.27.1-cp313-cp313-manylinux_2_34_aarch64.whl
  • Upload date:
  • Size: 3.0 MB
  • Tags: CPython 3.13, manylinux: glibc 2.34+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","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-0.27.1-cp313-cp313-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 4b298bbb5ff1e6cc9d9c16257c5bc90cbd65f93d0010c96d91591ca5149e9669
MD5 6d156116c1066380b98defe126f3c9b4
BLAKE2b-256 66dc1bc2dfef13d8e3875197e73286acfd161e203c7c685995aacaa917294323

See more details on using hashes here.

File details

Details for the file fabricatio-0.27.1-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

  • Download URL: fabricatio-0.27.1-cp313-cp313-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 2.9 MB
  • Tags: CPython 3.13, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","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-0.27.1-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 dd65aee61759ca51ecc246b43f11f283069c43f5bb2ff52ead8b5d507103c154
MD5 e2e8d55ad09f7ad55ab6f906af067fee
BLAKE2b-256 f91747c4769a4465875f70a91fe8f8b1525eb4db1a72733633b9e8fedcb224c2

See more details on using hashes here.

File details

Details for the file fabricatio-0.27.1-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: fabricatio-0.27.1-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 2.7 MB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","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-0.27.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 674d56666ce4e5001c3416a218966fac3583d3a2ada1cdce36f8b37dae4d0708
MD5 e389916865a28db69910bfdf36222e02
BLAKE2b-256 350572bee6ce2623d5ece1b168e2042488812bc1ef3dfc4308b69d1a74eb9ca5

See more details on using hashes here.

File details

Details for the file fabricatio-0.27.1-cp312-cp312-manylinux_2_34_x86_64.whl.

File metadata

  • Download URL: fabricatio-0.27.1-cp312-cp312-manylinux_2_34_x86_64.whl
  • Upload date:
  • Size: 3.2 MB
  • Tags: CPython 3.12, manylinux: glibc 2.34+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","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-0.27.1-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 0fca8b6bc0ff6f2bcebd710bcdeade964e4a6e3e56028b8acbe27dabc9f36680
MD5 7510d0091bd4983075bb4d7ce14f306d
BLAKE2b-256 17596c92f6b6eb6a761448404f8076df2136b070ecc8613f845275d315b4f596

See more details on using hashes here.

File details

Details for the file fabricatio-0.27.1-cp312-cp312-manylinux_2_34_aarch64.whl.

File metadata

  • Download URL: fabricatio-0.27.1-cp312-cp312-manylinux_2_34_aarch64.whl
  • Upload date:
  • Size: 3.0 MB
  • Tags: CPython 3.12, manylinux: glibc 2.34+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","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-0.27.1-cp312-cp312-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 aa40fe1df61f656e3ab18ed302f87ab4f2f816a49dfe2f8f4cb82e4d8f9dbd8b
MD5 007f4e6d16b78f531a62ee1c3e872a10
BLAKE2b-256 84fd766ba5a9079412f479646e74a144d9b1db703c6905b2c12041f437a763f1

See more details on using hashes here.

File details

Details for the file fabricatio-0.27.1-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

  • Download URL: fabricatio-0.27.1-cp312-cp312-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 2.9 MB
  • Tags: CPython 3.12, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","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-0.27.1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 cdd5240db1d87ad83b11d9d2158d785778b376284b29a7762bdac635ad0f6652
MD5 15450f15fa0591bd9ffc55ce2a06266f
BLAKE2b-256 aed8e9c8483cdc52b51f46df68766078783b423395ca7012bae418ce63cf1728

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