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.
    • Define API types + REST route handlers + wire into axum server
    • Add CORS/error middleware + Python binding for server config
    • Integration tests + API docs
  • Run as mcp server.
    • Feature flag + McpServer struct + tool registry + tools/list
    • stdio + HTTP transports + tools/call dispatch
    • Register Fabricatio tools as MCP tools + Python binding + tests
  • Finalize the webui.
    • Chat interface + API client + WebSocket/SSE streaming
    • Config panel + agent status dashboard
    • Error handling + loading states + UX polish
  • Add Plugin system.
    • Plugin protocol + registry + lifecycle (load/unload)
    • Hook points in core lifecycle + entry-point discovery
    • Plugin config support + validation + tests
  • 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
    • Package skeleton + CompressionLevel enum + compression strategies
    • Async compression + Python bindings + tests
  • TreeSetter-based ACE
    • tree-sitter dep + AST node types + tree edit operations (insert/replace/delete/move)
    • TreeSetter orchestrator + Python bindings + multi-language round-trip tests
  • Self-Extensible Agent
    • Capability protocol + runtime registry + dynamic method injection on Role
    • Config-based discovery + hot-reload + tests
  • Add more examples
    • Write missing examples (Structured Output, Extract, Improve)
    • Document undocumented examples + cross-link use-cases.rst + examples index
  • ToolExecuter exec results feedback to llm
    • Add history to CompletionRequest + update providers + Python binding
    • ResultCollector.to_history_messages + feedback loop in handle_fine_grind + tests
  • 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
    • All core LLM operations already routed through rust.router_usage
  • Add Texts-based skill system, as a subpackage
    • Skill YAML/JSON schema + loader + directory scanner
    • Wire into Role + validation + example skill file + tests
  • 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
    • TEI as Provider in thryd (RerankerModel for OpenAI-compat: wontfix — OpenAI doesn't support rerankers)
    • Wire rerank() into Router Python class + add UseReranker capability
  • Replace UseLLM with native rust impl
    • Fix the mock utils that is break by the replacement.
    • router support no_cache
  • Diff use Hashline impl instead of StringGrep
    • HashLine struct + hash-based line matching in Rust
    • Replace match_lines + Diff.apply + benchmarks + edge-case tests
  • 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
  • Structured Output
  • Extraction
  • Content Improvement
  • 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.1-cp314-cp314-win_amd64.whl (2.9 MB view details)

Uploaded CPython 3.14Windows x86-64

fabricatio-0.29.1-cp314-cp314-manylinux_2_34_x86_64.whl (3.4 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.34+ x86-64

fabricatio-0.29.1-cp314-cp314-manylinux_2_34_aarch64.whl (3.2 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.34+ ARM64

fabricatio-0.29.1-cp314-cp314-macosx_11_0_arm64.whl (3.1 MB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

fabricatio-0.29.1-cp313-cp313-win_amd64.whl (2.9 MB view details)

Uploaded CPython 3.13Windows x86-64

fabricatio-0.29.1-cp313-cp313-manylinux_2_34_x86_64.whl (3.4 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.34+ x86-64

fabricatio-0.29.1-cp313-cp313-manylinux_2_34_aarch64.whl (3.2 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.34+ ARM64

fabricatio-0.29.1-cp313-cp313-macosx_11_0_arm64.whl (3.1 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

fabricatio-0.29.1-cp312-cp312-win_amd64.whl (2.9 MB view details)

Uploaded CPython 3.12Windows x86-64

fabricatio-0.29.1-cp312-cp312-manylinux_2_34_x86_64.whl (3.4 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.34+ x86-64

fabricatio-0.29.1-cp312-cp312-manylinux_2_34_aarch64.whl (3.2 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.34+ ARM64

fabricatio-0.29.1-cp312-cp312-macosx_11_0_arm64.whl (3.1 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: fabricatio-0.29.1-cp314-cp314-win_amd64.whl
  • Upload date:
  • Size: 2.9 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.1-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 4289766c2d5ab8c8f37e6fe338046912fd80099accf8332103d876f1cb94da35
MD5 511a0b59b3eb6f791e5d7bd24ad69b6a
BLAKE2b-256 538cd9d787315e4fd3bb46e459eca573caad3693084e7f95ec749c37b585a761

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio-0.29.1-cp314-cp314-manylinux_2_34_x86_64.whl
  • Upload date:
  • Size: 3.4 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.1-cp314-cp314-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 9247a7c8152fa9e8ba5d5b417a4998c480cd0f681f80fd420265ac588088adb1
MD5 4e407eb568dbfb3fb047c87d5ae1775d
BLAKE2b-256 884d9caf01039917b226921c5521f9c474cfeaebcc672df77a8557a6730cf553

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio-0.29.1-cp314-cp314-manylinux_2_34_aarch64.whl
  • Upload date:
  • Size: 3.2 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.1-cp314-cp314-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 dcfc15db229456e8e7cc0ef3b9e79d2872c73c227c59639a795e70c1054781a7
MD5 3177e5f7535cda41755034e43ab27286
BLAKE2b-256 20b1b3fa263556c16423dbc3b52d5be92078fd47cc4181854a4e584685cbcf85

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio-0.29.1-cp314-cp314-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 3.1 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.1-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e710ceac63ac5489ba2261ba5dd97e926baf00165ee41c0845ef0b1cb184a0ab
MD5 e59b4153dbfc5ee56e724982844e65eb
BLAKE2b-256 b6600e05368a91b559814bf88db767fe28c4d097067a0a0d7f60a7299aa774b1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio-0.29.1-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 2.9 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.1-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 beedb881f796ba6fa21ba6f7e9ff41f087f81f096838154fad19f1845079b217
MD5 2bbe17db5f083367eb20da17f2b0c66c
BLAKE2b-256 f22fe168e9aa8b7c59f7edd62f9206c2e65ba514332300dca0e10db700c02ae5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio-0.29.1-cp313-cp313-manylinux_2_34_x86_64.whl
  • Upload date:
  • Size: 3.4 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.1-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 4b25fc303c7dfbe9b2b792a353cdd0f5702134cf5e24e7a276d199b19b76b462
MD5 9c57faf19996a5798343b2567d3a6269
BLAKE2b-256 4c351afbb31d244003fe9e5d443f08766ab25129cbd4add943907331c02884bf

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio-0.29.1-cp313-cp313-manylinux_2_34_aarch64.whl
  • Upload date:
  • Size: 3.2 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.1-cp313-cp313-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 d1606d6c07559ad201f72482c681803e716ef3be7980335635803634d90b43ad
MD5 a2c09a711da9991a2fc3973311ddab39
BLAKE2b-256 f187f276306123277afc91d7dac51a21c76911d0eccdec30afe5cf69c5f7c7cc

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio-0.29.1-cp313-cp313-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 3.1 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.1-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d00851fe8663b05c23b32bf7c426e7edda2045701d435447f18248fdb324bad6
MD5 3e7c75151e564d458620f777ce5594eb
BLAKE2b-256 12e0d2d9e27e92e9535a6377a5f6b06d0d725f5a7d3d137ca1324d8a7ba50844

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio-0.29.1-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 2.9 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.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 cc55eea0e0b1cc34219debc06e0aa18df24c6f23b178ed58da05704dde9dffa9
MD5 a1808b4e215775c17e4404ff104b8d8f
BLAKE2b-256 0578a4d84bef3f617fdcf9a64b9a2b6f5be5660bfa5ca8093b727cfd4acfed27

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio-0.29.1-cp312-cp312-manylinux_2_34_x86_64.whl
  • Upload date:
  • Size: 3.4 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.1-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 15099b2e92d69c57f3f25ed3f7109d28d1e9f0cddfe34351cad85f8d5f6b56eb
MD5 938da7f2ebf07c801abb0a3ef9335c35
BLAKE2b-256 a272c665d5acc200757a286b381477a93bc66b31ad1cc9fbab51e71342e12ef0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio-0.29.1-cp312-cp312-manylinux_2_34_aarch64.whl
  • Upload date:
  • Size: 3.2 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.1-cp312-cp312-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 9ccfff527d3c41b8f7db1980b99f37b2cd1542a7afe2eeda571d3682ae0cb71d
MD5 20abeb5d3f7c356d7b95a41721193bb3
BLAKE2b-256 a12e178ab51681d107116dacf64cc612f7b5d2cf1a160e17274744adb1b0ab3f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio-0.29.1-cp312-cp312-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 3.1 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.1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0ff5ab74314403b8fced194e8d259b8a041f9ca941c0a7c4f8550f49ab7ce3ea
MD5 d386ab3fabe8a2c0c705024891ed3e34
BLAKE2b-256 ef807b0c234ae453ce6ca74f6e36374ea652e38e31d0462a47b8fb13500a0045

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