A LLM multi-agent framework.
Project description
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
-
ToolExecuterexec results feedback to llm - Use
stubgenfeat andcfg_attrto make the stub generation as an opt-in for all mixed packages. - Use
Thrydimpl to move some requests to rust side - Add Texts-based skill system, as a subpackage
- Port build workflow to
Justfile -
thryd::Routeruse concurrent safe impl - Replace parser 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:
fabricatioperforms 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
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fabricatio-0.28.0.dev0-cp314-cp314-win_amd64.whl.
File metadata
- Download URL: fabricatio-0.28.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3431067d2f99b995c4d326a10da3436882b39e15ca3e4a2377bc25d099d69853
|
|
| MD5 |
fa304331af0bbd154112ef434c322da7
|
|
| BLAKE2b-256 |
d05d5e477d74f4d063f83c51c8208ead782c403beba97ed94029e600420796e1
|
File details
Details for the file fabricatio-0.28.0.dev0-cp314-cp314-manylinux_2_34_x86_64.whl.
File metadata
- Download URL: fabricatio-0.28.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fb7921a88ca397a9b5c48409a78851086dc2eccd49cbcac60c923e847390019e
|
|
| MD5 |
34eab6bf01ab3f21aa26e3a43ce5b3cb
|
|
| BLAKE2b-256 |
f4bf7184d64489ec706968e16b38da979ed90088cdce728ca2cd212c0b9a911e
|
File details
Details for the file fabricatio-0.28.0.dev0-cp314-cp314-manylinux_2_34_aarch64.whl.
File metadata
- Download URL: fabricatio-0.28.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bd41c6fee9808c7c93f9b6ccbd7984612650a91aec85276ca37c605fa20a8cdb
|
|
| MD5 |
70683f66080abbd7bef1ea6db3d79048
|
|
| BLAKE2b-256 |
cb3511f509ed774df4a963824c94692e72e72fc5b1e853b06628e37153674da1
|
File details
Details for the file fabricatio-0.28.0.dev0-cp314-cp314-macosx_11_0_arm64.whl.
File metadata
- Download URL: fabricatio-0.28.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6ac5a4f58b75afe2c0de8f76ce8088db8d348180f2a83575d5437726aeb0c15f
|
|
| MD5 |
fe6cefc1b7bd0724d0aac4d859878f9a
|
|
| BLAKE2b-256 |
e1d063aabc12beecf71a05b3fb826c53509cefe668190bd9c705d3bd8b3df0ff
|
File details
Details for the file fabricatio-0.28.0.dev0-cp313-cp313-win_amd64.whl.
File metadata
- Download URL: fabricatio-0.28.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7c882516b04115cc445365d9bbe3b5933744f768e34f62be6caa70ad7beed998
|
|
| MD5 |
2e74aa046575265d614f622de8ccfe30
|
|
| BLAKE2b-256 |
b1530c0787cbdf089d6d855be5963fe78429188a09b34c35d743c995c99b8f6b
|
File details
Details for the file fabricatio-0.28.0.dev0-cp313-cp313-manylinux_2_34_x86_64.whl.
File metadata
- Download URL: fabricatio-0.28.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cc40f8fb1efc078b0b5bffc4e6d7fae7719e6be64e3161fc30efc7bdfe0d0a18
|
|
| MD5 |
23681c1c4a968bb7505ce42fbec347ac
|
|
| BLAKE2b-256 |
91d157cbb68f6207fbe2c52939b73c503c2367097c85eacbe4c433e78e57c68f
|
File details
Details for the file fabricatio-0.28.0.dev0-cp313-cp313-manylinux_2_34_aarch64.whl.
File metadata
- Download URL: fabricatio-0.28.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
97e524236a60ed232766ce34d4ca0298cb7fee982706658e9ab4643a0ac16dec
|
|
| MD5 |
debc2e6b86786b3ffac98c3935be02b4
|
|
| BLAKE2b-256 |
66e8c3b5f5c00c9da4313325aedb8ee5a9e066bc10cacf6bd4961e3238350648
|
File details
Details for the file fabricatio-0.28.0.dev0-cp313-cp313-macosx_11_0_arm64.whl.
File metadata
- Download URL: fabricatio-0.28.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b706c9a7f3e722a03201b5e7c9441baa0ce250e5e9fa196c9e77cbc1fa8aaca5
|
|
| MD5 |
9a85bf3d8d572c3016155d8c6f6ca42b
|
|
| BLAKE2b-256 |
03928a8c50f1fac9d6913e05b0739fb92cbdc1b7dc6dc9b772466f4149ead7d2
|
File details
Details for the file fabricatio-0.28.0.dev0-cp312-cp312-win_amd64.whl.
File metadata
- Download URL: fabricatio-0.28.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
29750af56998f9b7f23d6fb84c62ed241c34b95b8dfccb8546b64b1dab6d5412
|
|
| MD5 |
97a31949880f7f360b38c0ad80159cce
|
|
| BLAKE2b-256 |
5f9745ed32e2a40e2c0e7307370ae1828885e45507a66910e6160ebadfe47e30
|
File details
Details for the file fabricatio-0.28.0.dev0-cp312-cp312-manylinux_2_34_x86_64.whl.
File metadata
- Download URL: fabricatio-0.28.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1f5d193efbf12e40dfea30483eb4cae1aa1e4a41fa6cda3caa6583da614cbccb
|
|
| MD5 |
cf630fed25af14e503865dd90f25dd53
|
|
| BLAKE2b-256 |
38494b9c72f268456d183e98fb15b71346e42774c346685490b4e1146b3bc1b2
|
File details
Details for the file fabricatio-0.28.0.dev0-cp312-cp312-manylinux_2_34_aarch64.whl.
File metadata
- Download URL: fabricatio-0.28.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f6d9455282a70318ef31ab4a7a0c7d70504cfd8514371e3e76d4ea08db288e19
|
|
| MD5 |
b880c4c8270ace3a335835b099f31fb3
|
|
| BLAKE2b-256 |
daf94a0127b013c48cc5dff33abb19a96320b61c373f467f0ab7c80e7605f290
|
File details
Details for the file fabricatio-0.28.0.dev0-cp312-cp312-macosx_11_0_arm64.whl.
File metadata
- Download URL: fabricatio-0.28.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b3fefa303ef6b737d6c528a8b744a49f166a8a179c770e050aa6a303c683696b
|
|
| MD5 |
daa918167c6e469be54b52a4c66d9ec0
|
|
| BLAKE2b-256 |
bd71507761130a2984fbb561c41868c646327a31ff8a2371a9319923ed6d9f6b
|