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
    • Add Reranker support in 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.29.0.dev0-cp314-cp314-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.14Windows x86-64

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

Uploaded CPython 3.14manylinux: glibc 2.34+ x86-64

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

Uploaded CPython 3.14manylinux: glibc 2.34+ ARM64

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

Uploaded CPython 3.14macOS 11.0+ ARM64

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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13manylinux: glibc 2.34+ x86-64

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

Uploaded CPython 3.13manylinux: glibc 2.34+ ARM64

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

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12manylinux: glibc 2.34+ x86-64

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

Uploaded CPython 3.12manylinux: glibc 2.34+ ARM64

fabricatio-0.29.0.dev0-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.29.0.dev0-cp314-cp314-win_amd64.whl.

File metadata

  • Download URL: fabricatio-0.29.0.dev0-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.29.0.dev0-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 994a8f0f59ac7fbacd8ee49eacd608ccfd17931161ea2782d5592c90c496e918
MD5 767f05a962529a6de772faa5a1a140a3
BLAKE2b-256 5f3ac5ed70fd50c8824245d69f353f8462fa650419cf95d1a4f0f868ed6270b3

See more details on using hashes here.

File details

Details for the file fabricatio-0.29.0.dev0-cp314-cp314-manylinux_2_34_x86_64.whl.

File metadata

  • Download URL: fabricatio-0.29.0.dev0-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.29.0.dev0-cp314-cp314-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 b4f413836d07e021ebb2069c72eb46cbd6de550cd5e98152ced3c51fc1464c94
MD5 1faaa3f3944ed80c8a4ed2511b530038
BLAKE2b-256 d70e761dec5b25d238293821c8e9c6304b8eedbc677f5c41b8eb0efc5a1f2530

See more details on using hashes here.

File details

Details for the file fabricatio-0.29.0.dev0-cp314-cp314-manylinux_2_34_aarch64.whl.

File metadata

  • Download URL: fabricatio-0.29.0.dev0-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.29.0.dev0-cp314-cp314-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 6cd14053e294f2172a3c68939a01e567b230d6cbb8547f6fca12111be8af05d6
MD5 b9f089510745b9e2f45ff1d2a5676c9a
BLAKE2b-256 e258872352326dd6bd7f6bae6a4721e026f312ad2bd5de701875b945cc8394c5

See more details on using hashes here.

File details

Details for the file fabricatio-0.29.0.dev0-cp314-cp314-macosx_11_0_arm64.whl.

File metadata

  • Download URL: fabricatio-0.29.0.dev0-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.29.0.dev0-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1e50ba50eee05993722f60772eec8ef73b9f6ca3612dd4bd084bfbed9b7a5ebc
MD5 79ee3a5a15cbda71a580c5a10c5fac0f
BLAKE2b-256 813df89a140426cf231967889493776e3c98be3757ac5d25221741c1879301c0

See more details on using hashes here.

File details

Details for the file fabricatio-0.29.0.dev0-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: fabricatio-0.29.0.dev0-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.29.0.dev0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 3eb84fe30e6aecbce040a4230dcc34271a4f8c4b735fbc6c6e44c8f0503cac81
MD5 bba61cc73e555fcbb4e808d87b3cb3fb
BLAKE2b-256 e29de634622d75d8f115e05a784d8eb922723ec4f50ff5ddf91b8d4e23f7ca53

See more details on using hashes here.

File details

Details for the file fabricatio-0.29.0.dev0-cp313-cp313-manylinux_2_34_x86_64.whl.

File metadata

  • Download URL: fabricatio-0.29.0.dev0-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.29.0.dev0-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 8b5870a95bc2a00bdcd83395571deba2113c9638ccd5835542502eb5e923f68d
MD5 95897c961ffe334886c07e2091772f70
BLAKE2b-256 84e0632feb801386cc03260b9768ac311813c9d029ad0d2cf991f5eb830b000b

See more details on using hashes here.

File details

Details for the file fabricatio-0.29.0.dev0-cp313-cp313-manylinux_2_34_aarch64.whl.

File metadata

  • Download URL: fabricatio-0.29.0.dev0-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.29.0.dev0-cp313-cp313-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 b22711d7543316707e750bf927ffa755c4490876161fb7d561476641c4cea1ad
MD5 4b46ba23160720e91159298bb7440bc6
BLAKE2b-256 25d48230bfb0c801d90c386d1b8c4df188216a5f618eb7c111b23ec75810d174

See more details on using hashes here.

File details

Details for the file fabricatio-0.29.0.dev0-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

  • Download URL: fabricatio-0.29.0.dev0-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.29.0.dev0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 744670ca7e89868302006b4e749fe467d97b8d1d18e5ced8e1a9269a01c8b3b1
MD5 4911871c0f800f6ace3f8d82a4842ccc
BLAKE2b-256 603de8a3b8f54e0644a310a5245a2832eabef235b61541e19462dd0e214e582e

See more details on using hashes here.

File details

Details for the file fabricatio-0.29.0.dev0-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: fabricatio-0.29.0.dev0-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.29.0.dev0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 9d1db8c8d030d2e7bc8f95cf8c0a09e9f77aac21071b5873b975a936717148de
MD5 c0678b275b026726dbf5a46d46b0fbf7
BLAKE2b-256 6bcd4740e96189ef57443eea220ab34647fd0eaf2f30efcc46c7ef8e7fb6273b

See more details on using hashes here.

File details

Details for the file fabricatio-0.29.0.dev0-cp312-cp312-manylinux_2_34_x86_64.whl.

File metadata

  • Download URL: fabricatio-0.29.0.dev0-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.29.0.dev0-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 56e25941ed9cc5263c5a79d24f13823933251cd7855f766b351a4d3fbb2d5d71
MD5 b9e603af33a1429c7a4303911259196b
BLAKE2b-256 b9f90046969507b19731811d0cf88dd77e24c631529db013cea14d0b5126facf

See more details on using hashes here.

File details

Details for the file fabricatio-0.29.0.dev0-cp312-cp312-manylinux_2_34_aarch64.whl.

File metadata

  • Download URL: fabricatio-0.29.0.dev0-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.29.0.dev0-cp312-cp312-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 c121bcd019e25cf03ee4c617d535e7b9b2853c20d71f39a38f2509841b0b30db
MD5 84b470f384945a5ec2a5bf06509f473d
BLAKE2b-256 931663dd7c75f190cbff0454740e49aa7a5a4c795a1486f805b54ab78c9d8d27

See more details on using hashes here.

File details

Details for the file fabricatio-0.29.0.dev0-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

  • Download URL: fabricatio-0.29.0.dev0-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.29.0.dev0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 021e30b9a6d390ef36c38d79e7442dfe13d45a34c0fb71e58f6a46bbd07d822b
MD5 28ce23d7d29c3b8ee65fb5c900880c7a
BLAKE2b-256 77fe1980b02dedfd9ed5f9812918f8c08daa0e6de00fb8aba36c761395202483

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