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
    • Router cache support ttl and eviction
  • Add worktree-based isolated development subpackage
  • Add level-based context compression subpackage
    • Non-blocking compact support
  • TreeSetter-based ACE
  • Self-Extensible Agent
  • Add more examples
  • ToolExecuter exec results feedback to llm
  • Use stubgen feat and cfg_attr to make the stub generation as an opt-in for all mixed packages.
  • Use Thryd impl to move some requests to rust side
  • Add Texts-based skill system, as a subpackage
  • Port build workflow to Justfile
  • thryd::Router use concurrent safe impl
  • Replace parser with native rust impl
  • Better memory impl
  • RAG package refactor, move rerank and embedding to thryd
  • Replace UseLLM with native rust impl

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

Uploaded CPython 3.14Windows x86-64

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

Uploaded CPython 3.14manylinux: glibc 2.34+ x86-64

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

Uploaded CPython 3.14manylinux: glibc 2.34+ ARM64

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

Uploaded CPython 3.14macOS 11.0+ ARM64

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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13manylinux: glibc 2.34+ x86-64

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

Uploaded CPython 3.13manylinux: glibc 2.34+ ARM64

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

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12manylinux: glibc 2.34+ x86-64

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

Uploaded CPython 3.12manylinux: glibc 2.34+ ARM64

fabricatio-0.28.0-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.28.0-cp314-cp314-win_amd64.whl.

File metadata

  • Download URL: fabricatio-0.28.0-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.11.7 {"installer":{"name":"uv","version":"0.11.7","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.28.0-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 5bc279c4014442d40b5b1586ee09e8a7d6432266f902b4c3f73cd640cb8f4056
MD5 29e5cd13017a4d358bc36ba3d0ea766f
BLAKE2b-256 d1234df719f8a865f04b85268b04fa903bd624f8fd79a3063d1775178617d8b1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio-0.28.0-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.11.7 {"installer":{"name":"uv","version":"0.11.7","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.28.0-cp314-cp314-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 079487b96b7ac5a3da9097fe55505ec609f7688a3cf4ab286fc0b696742c0b53
MD5 f79f58cf1fe0c9d0efc49b1c9aa8e9ad
BLAKE2b-256 c5e7a7b9c25ddfab8f90682d0832716f36128f0921ffba91e4c180aa38e1a2c0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio-0.28.0-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.11.7 {"installer":{"name":"uv","version":"0.11.7","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.28.0-cp314-cp314-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 a69ceb020e465db805b20645224149f06f47d88083b2689049975c90a25d3139
MD5 079a4b3104dbe4d6790a391351acd1e7
BLAKE2b-256 63b244adcd21019d7175bafe086fa9d74a098350ef55d637185174f8e27aa1bb

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio-0.28.0-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.11.7 {"installer":{"name":"uv","version":"0.11.7","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.28.0-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 87493d255b814e17a76223522a408cd22996a6aa70bad5959f74298495324081
MD5 2a4e929adba9e6452c1da0cd5cfb9b2b
BLAKE2b-256 586ce770d95e6e8e3698241be8ceed9e2aa7fcdca1d034b8168482b5b33bbc9f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio-0.28.0-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.11.7 {"installer":{"name":"uv","version":"0.11.7","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.28.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 1cd31fbaca05d9352597a62bfffb1345457ce9f755a1598157e2bb5b6dd48b8c
MD5 d322a50da3222e01f732ced53da3e30b
BLAKE2b-256 f4b162eb7f9ffa4ad59115cdbf6b1e1c4f42d48427d8b7278445ee3e12c97f9f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio-0.28.0-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.11.7 {"installer":{"name":"uv","version":"0.11.7","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.28.0-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 2ef6920c0eef5df7a318250c3f83d65f643cba1e42701f15274d4b62df93603e
MD5 e7cfadd466932740cbdacc1d100c43f0
BLAKE2b-256 5780ba9a14e474a3320f7feb42929592babb2ca8b673068304b00e5b4e74d811

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio-0.28.0-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.11.7 {"installer":{"name":"uv","version":"0.11.7","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.28.0-cp313-cp313-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 1975c866f4b95f82336c0e01ba644dd127b30d3170bb8d724136f60cfc04d6d5
MD5 27f1e7ea8d0ad6a504456c58cf0d8318
BLAKE2b-256 b87214e4f382e1395f05079172e5ae45fd6d98a51436cf15063f8ebbc6459cd1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio-0.28.0-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.11.7 {"installer":{"name":"uv","version":"0.11.7","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.28.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 48c6bf59bb58aeae99710f81911acfb8a70a3c94740ffe67613c4647df554856
MD5 e716155a9b29d4dd08ca470bc1ca4d7d
BLAKE2b-256 5d292659d723febb974d8c14f01ecd4a24af5449ec20c82f7d61ebaea9e9fe84

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio-0.28.0-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.11.7 {"installer":{"name":"uv","version":"0.11.7","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.28.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 8c2ab05d945a38cae8346dbfddd18839b8e917882c81a2ead8951cc04829668e
MD5 639c870e3f734e8e1fe7d1f01df7937f
BLAKE2b-256 21385ce178036dc7c83c08bb969d22697c98bd0dc73dd238d95619590465d629

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio-0.28.0-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.11.7 {"installer":{"name":"uv","version":"0.11.7","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.28.0-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 4c8f81abe3f403e0020871662e4f4d139c2101b6ba315229ff1e4c56e0aa0d97
MD5 f6f66487aaf5d30796e9471a0f7cc293
BLAKE2b-256 1c3e30975cbd794d727d389c81817b1c467af0269464daa6d8ebfbb79d65838b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio-0.28.0-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.11.7 {"installer":{"name":"uv","version":"0.11.7","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.28.0-cp312-cp312-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 e9bf8ea6844a1bc532766dba84d437e6b9b9dc576a2ba051af89b42df474b173
MD5 2bbf31030af9d4c9cfe238f1f98cbe04
BLAKE2b-256 5e84114122af72acd070fd2cbbce0fa11d2618e5aa4c89a4e09915f6121ce6e1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio-0.28.0-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.11.7 {"installer":{"name":"uv","version":"0.11.7","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.28.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4b19763663927ba5ee1ef81607876306b39066a45b75cc056e7d5e3c905b0661
MD5 332154ac4c8d738f423e1ee732ea959b
BLAKE2b-256 a8ca54b3592cf1ab185eb9ca94e965a3e5f35876697465a46cf1bd0aad4ec2c8

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