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
    • Move param resolution to Rust + expose DummyModel via PyO3
  • 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
    • Replace RAG's TEI client with thryd router + remove gRPC deps + tests
  • 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
  • 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-cp314-cp314-win_amd64.whl (2.9 MB view details)

Uploaded CPython 3.14Windows x86-64

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

Uploaded CPython 3.14manylinux: glibc 2.34+ ARM64

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

Uploaded CPython 3.14macOS 11.0+ ARM64

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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13manylinux: glibc 2.34+ ARM64

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

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12manylinux: glibc 2.34+ ARM64

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

File metadata

  • Download URL: fabricatio-0.29.0-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.0-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 7a3c070d48bfc91bd89f761c32c37fee8dc47b19ec890138cf181eb9a5ce17e3
MD5 89b776aaee158331b499dae1393ea5fa
BLAKE2b-256 a85f8d0c5bba5241f1a4db91f3feb014dc33aaee06088314b38232198fe11d2d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio-0.29.0-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.0-cp314-cp314-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 239c886635d8b917c3b6f1c0a3d595ee8810650b2283024a0bbbba55c3bc360f
MD5 bc426c39224eff91577aaa4b7c5bb45b
BLAKE2b-256 4443506b9a3d405f8ef81cac69ec134873d0ad36f214b992ba145f64931d206a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio-0.29.0-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.0-cp314-cp314-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 85a3341bf604c8423cc62436c415a8b3d01b71087b3de61aad02350b69fda388
MD5 0da2746dd2e1f612aa142fc3e800bcd8
BLAKE2b-256 c2dd9804dcf9fd7b9b2f3533877a5d0bfe036df2775b281c03f79b60a3501e10

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio-0.29.0-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.0-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2001b21b7cef68a2ca61abf8968dafc03427fcad43b11afcd9ca7361ff6208ec
MD5 71d20740c58dfcd2bba8559721f07e01
BLAKE2b-256 7819748eb97c53225935e974fc86b6c1a4c0ba5c79e50db1b12a25d284b997d8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio-0.29.0-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.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 4261cc1632d67940f389ede8c62dca0003b2c0e1afbda4c1e4b5bb4d60566377
MD5 2672c7aa36959927f0374f2c8866e5f8
BLAKE2b-256 d90e37b525ca8f210270c915d9eac6ac42f14c22a90255e1e68bc31b566aa971

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio-0.29.0-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.0-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 e7fa53e7f696969a2f984f0f73f319e6adcfe63231fff81d612c26246a1f1a1f
MD5 76db0cf5635330bff4c7cd1272a57498
BLAKE2b-256 b321fe5a887a3120c8127c792b0c4dad57dee44de756c1096952133f7cb802ef

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio-0.29.0-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.0-cp313-cp313-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 39ca3f45c03949e5166ebcc989a8a1bd977f52c919aaf9d4f7a248d25fd58f1b
MD5 e9abdc4cb17d21f7d2e79fa344b584a7
BLAKE2b-256 a72fce86dcefe694703a40ec1b4d3fbce9ed0af768168ff852527e73b3f0b76b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio-0.29.0-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.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a8108163df1248d95b7782be5fcf3a67efd755f4dd2bf074872022d882e7df3f
MD5 fd4833c835b6714edd4386a380ababc8
BLAKE2b-256 87d2cfc938a49c3373668a0d1512ecb495bec45071efaeb9cd2b87600215c7ba

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio-0.29.0-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.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 560874e7b80ed0457fda472443a1c0dbe403cc0da503c3c14741c2ad48af0c60
MD5 96334a530e96d5754e69cb154609e9ae
BLAKE2b-256 da8ec400e6ef294f368124f578a6f44e141d0a88ec4c84cebd635301f293050f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio-0.29.0-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.0-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 981a154f99840de0d8c28d2a7026e151356d9807f6659bf5c9d3c842d0933793
MD5 4ceb4caf4e8c761d2cc6d1ef405c84b2
BLAKE2b-256 55f723963d00fab3557723ae355042ea726249f4c5a0462ef5f26b10d4347b0d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio-0.29.0-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.0-cp312-cp312-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 77be35ddc6e4b7dcdd4e8583e822f9d3d003f69b25f9a5cab045855585d7911a
MD5 57a500abdecdd4442fd2f1eaa9dcceda
BLAKE2b-256 bb1b0fe7d58085b669f9d7af48da261c888994361137ab788c66c95d5d4d0254

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio-0.29.0-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.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 bcf6dbd821067312f2f0e3ea7ff333470ad1b310da6956fb1f87db70234472ad
MD5 28f49ada80e2162d48894e5c331cf039
BLAKE2b-256 fea7b37d57b23a99a8f1b3802aa589cebfa5964e1326f9f8bb21066e467bac53

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