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
  • Diff use Hashline impl instead of StringGrep
  • Placeholder based multiple-agents edits

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

Uploaded CPython 3.14Windows x86-64

fabricatio-0.29.0.dev1-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.dev1-cp314-cp314-manylinux_2_34_aarch64.whl (3.0 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.34+ ARM64

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

Uploaded CPython 3.14macOS 11.0+ ARM64

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

Uploaded CPython 3.13Windows x86-64

fabricatio-0.29.0.dev1-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.dev1-cp313-cp313-manylinux_2_34_aarch64.whl (3.0 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.34+ ARM64

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

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

fabricatio-0.29.0.dev1-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.dev1-cp312-cp312-manylinux_2_34_aarch64.whl (3.0 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.34+ ARM64

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

File metadata

  • Download URL: fabricatio-0.29.0.dev1-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.8 {"installer":{"name":"uv","version":"0.11.8","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.dev1-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 f3289c7d8f606b3b4a4b23bffcbc0e0a2fd3733544bff8faaeb9f0e07ca1d143
MD5 93b92e7225155e458d01134757874ae8
BLAKE2b-256 6fccdfe3c08e52db74c28e4d2600dcf42dba82546879ad8a0c7ebbc64ddcdff5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio-0.29.0.dev1-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.8 {"installer":{"name":"uv","version":"0.11.8","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.dev1-cp314-cp314-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 d857b6d55d0f59a7641171db582c45a76ac0c8b094dc528eef636314f2300be3
MD5 84b9636d3efe5c12c589e040f69092d2
BLAKE2b-256 5159b8eb4b1ca41eb7c1006bbe70c6d73f0de458710c0b5693c26417ca16a66f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio-0.29.0.dev1-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.8 {"installer":{"name":"uv","version":"0.11.8","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.dev1-cp314-cp314-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 78e39030cf81005a480bd7cb4fa388e277e13d475dc18bbe59b965bce203e3ab
MD5 111b84833293dda42252c8b2ed4cd264
BLAKE2b-256 6d20da2879efb70230d87a82c2af2ae9a0f62fdb4f507af435bb62c452e77242

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio-0.29.0.dev1-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.8 {"installer":{"name":"uv","version":"0.11.8","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.dev1-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1e710b3b7bad97ca1ed4d039d97f3aad0cfb86dd8da50ec86dad995230b574b2
MD5 8feb99fb21204412322ad13e133c2586
BLAKE2b-256 5ccf4e38c1d578ae46c15f96541869cc2146104e1c0912db2ca28d8c0d4057df

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio-0.29.0.dev1-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.8 {"installer":{"name":"uv","version":"0.11.8","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.dev1-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 9b41c3ce4a6fed46792dc8b575a2c27c90723ecdfca16e712dba81c4474ded6c
MD5 51ff68819a0311aff06b9673ef50288a
BLAKE2b-256 0e7e88da382344b48202575077383bcd0b008887499ca588d55ed90f5385e9c9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio-0.29.0.dev1-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.8 {"installer":{"name":"uv","version":"0.11.8","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.dev1-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 96ec565a3d2ecd0aab95841341f5e028c6a1f644cadad5fe7f3157f0370e11b6
MD5 5557e04f95730356b37a6c9ff78ca2d7
BLAKE2b-256 29d04f7b2c2e4e0ddd35abc64dc061b71f2aec62f67df42d815a86e04c9522b7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio-0.29.0.dev1-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.8 {"installer":{"name":"uv","version":"0.11.8","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.dev1-cp313-cp313-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 f4de95520795c53720c8cd6e3c91fad164645fc4996ea202d5ca31c24a074daa
MD5 d471de61f1c3e00f8b6d679ed25a1e20
BLAKE2b-256 814803f407064d9ee3d55051ef9c9ab83a58bb5d4b7843bfcb67af65b89d9369

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio-0.29.0.dev1-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.8 {"installer":{"name":"uv","version":"0.11.8","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.dev1-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b5eb3c9ce0c6811621d509cec88418c8d705f634d21291265c68da376339f11b
MD5 e09002d4fecf7c1a94d99b7060604d3a
BLAKE2b-256 cbbe9d27c62616aa1d4cd086b829a59a5747ad8e5e7caa12d8a89ab774f04e08

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio-0.29.0.dev1-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.8 {"installer":{"name":"uv","version":"0.11.8","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.dev1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 ba4f616b95b6af3c4218d66dad17c172d757b9d30c32ae092f3981358650c83d
MD5 14d65a9dda202503399bb7e5f963c239
BLAKE2b-256 b57f5a01dd7fc6a7bd0cd4f9e9689204cbf6c60ef6675924f8ed964464cb738a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio-0.29.0.dev1-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.8 {"installer":{"name":"uv","version":"0.11.8","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.dev1-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 8f38e4e718a6daf9ce0a28bf32cabbc42f2a2da0d2ef169cdb7a16289cadaa5e
MD5 a76d7f1ad922d082a2e9cf855b080ab4
BLAKE2b-256 a0afccfbbece60c83ddb988b6f4106449b5a18d645bd15bda3530b772ba14d61

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio-0.29.0.dev1-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.8 {"installer":{"name":"uv","version":"0.11.8","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.dev1-cp312-cp312-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 ec74fcfb86a8086700576e5bf037a6eec7152d124e26a180be94d7374aa5ecc5
MD5 96127490991a2d52779818445e9fddf7
BLAKE2b-256 d12466905ad1f9e2be0f81ea0ab7c4a72385c498070903334e70eaf36d15bb1a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio-0.29.0.dev1-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.8 {"installer":{"name":"uv","version":"0.11.8","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.dev1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1ed58bf5352a032acba2efa01f2234f296a24d9effdd410e6ab78e72a867a991
MD5 3e54f8c28782911d9bb0e144446fea7e
BLAKE2b-256 041a2e7b61badb2972555a4ecaf57b1da15b4eeb428db0ff5bfff3e81c1e397c

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