Skip to main content

fabricatio-tool

MIT License Python Versions PyPI Version PyPI Downloads PyPI Downloads Bindings: PyO3 Build Tool: uv + maturin

Tool execution layer for Fabricatio — wraps Python callables as discoverable tools, lets LLMs generate orchestration code, and executes it with safety validation.


Installation

pip install fabricatio[tool]
# or
uv pip install fabricatio[tool]

For all Fabricatio packages:

pip install fabricatio[full]

Overview

fabricatio-tool enables Fabricatio agents to use arbitrary Python functions as tools. Tools are grouped into toolboxes, discovered by an LLM-driven selection process, composed into execution code (also LLM-generated), and run inside a ToolExecutor with import/call safety checks. Results are collected in a ResultCollector for downstream use.

The package also includes built-in filesystem tools, MCP (Model Context Protocol) client integration, and optional user-confirmation guards for destructive operations.

Core concepts

Concept Description
Tool A named, described callable with auto-extracted signature and briefing
ToolBox A named collection of related Tool instances
ToolExecutor Runs LLM-generated code that invokes tools; validates imports and calls
ResultCollector Key-value container for tool execution results and errors
Handle / HandleTask Mixin classes that wire tool discovery → code generation → execution

Key classes and functions

fabricatio_tool.models.tool

  • Tool(source, name, description) — wraps a callable with metadata. invoke(*args, **kwargs) calls through. .signature and .briefing are auto-generated.
  • ToolBox(name, description) — collects tools. add_tool(func) appends a tool; collect_tool() works as a decorator. get(name) looks up a tool by name. .briefing produces an LLM-friendly description.

fabricatio_tool.models.collector

  • ResultCollectorsubmit(key, val), revoke(key), take(key) for typed retrieval, error() for retrieving execution errors.
  • ApplicationError — captures exception type, message, traceback, and the generated source for retry.

fabricatio_tool.models.executor

  • ToolExecutor(candidates, data)execute(source) runs tool-usage code asynchronously. inject_tools(cxt), inject_data(cxt), inject_collector(cxt) prepare the execution context. from_recipe(recipe, toolboxes) constructs an executor by selecting tools by name.

fabricatio_tool.capabilities

  • UseTool — LLM-driven selection: choose_toolboxes(request), choose_tools(request), gather_tools(request), gather_tools_fine_grind(request).
  • Handledraft_tool_usage_code(request, tools, data) generates Python code via LLM. handle(request, data) and handle_fine_grind(request, data) run the full pipeline.
  • HandleTask — extends Handle with handle_task(task, data) for Fabricatio Task objects.

fabricatio_tool.config

  • ToolConfig — configuration model: check_modules, check_imports, check_calls (whitelist/blacklist), mcp_servers, confirm_on_ops, logging_on_ops.
  • CheckConfigModel(targets, mode) — whitelist or blacklist mode for validation.
  • tool_config — singleton instance loaded from Fabricatio config.

fabricatio_tool.fs

Filesystem utilities callable as tools:

Function Description
dump_text(path, text) Write text to a file
copy_file(src, dst) Copy a file
move_file(src, dst) Move/rename a file
delete_file(path) Delete a file
create_directory(path) Create a directory
delete_directory(path) Recursively delete a directory
absolute_path(path) Resolve to absolute POSIX path
gather_files(directory, ext) Glob for files by extension
safe_text_read(path) Read file as UTF-8 text
safe_json_read(path) Read and parse JSON file
treeview(path, max_depth) Render a directory tree (Rust)

fabricatio_tool.mcp

  • get_global_mcp_manager(conf) — singleton MCP manager (Rust-backed).
  • mcp_tool_to_function(client_id, tool_name) — converts an MCP tool to an async callable.
  • mcp_to_toolbox(client_id) — converts all tools from an MCP client into a ToolBox.

fabricatio_tool.decorators

  • confirm_to_execute(func) — wraps a function with an interactive confirmation prompt via questionary.

fabricatio_tool.toolboxes

  • fs_toolbox — pre-built ToolBox containing all filesystem tools listed above.

Usage example

from fabricatio_tool.models.tool import Tool, ToolBox
from fabricatio_tool.models.executor import ToolExecutor

# Define a tool
def add(a: int, b: int) -> int:
    """Add two integers."""
    return a + b

# Build a toolbox
box = ToolBox(name="math", description="Math operations")
box.add_tool(add, confirm=False, logging=True)

# Execute LLM-generated tool-usage code
executor = ToolExecutor(candidates=box.tools, data={})
source = """
async def execute(collector):
    result = await add(3, 4)
    collector.submit('sum', result)
"""
await executor.execute(source)
print(executor.collector.take('sum'))  # 7

With filesystem toolbox

from fabricatio_tool.toolboxes import fs_toolbox

# Use the built-in filesystem tools
executor = ToolExecutor(candidates=fs_toolbox.tools, data={})
source = """
async def execute(collector):
    import pathlib
    await dump_text(pathlib.Path('example.txt'), 'Hello, Fabricatio!')
    content = await safe_text_read(pathlib.Path('example.txt'))
    collector.submit('content', content)
"""
await executor.execute(source)
print(executor.collector.take('content'))  # Hello, Fabricatio!

Using capability mixins

from fabricatio_tool.capabilities.handle import Handle

class MyAgent(Handle):
    ...

agent = MyAgent()
result = await agent.handle(
    "Find all Python files and count their total lines",
    data={"dir": "src/"},
    model="default",
)
if result and not result.error():
    print(result.take("output"))

Safety

ToolExecutor validates generated code against configurable whitelists or blacklists for modules, imports, and function calls. By default, only safe builtins (str, int, float, bool, dict, set, list, pathlib.Path, print, len) and math are permitted. Destructive tools can be gated behind confirm_to_execute, which prompts the user interactively.

Dependencies

  • fabricatio-core — core interfaces and utilities
  • pydantic>=2.11.7
  • questionary>=2.1.0

License

MIT — see LICENSE

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_tool-0.8.11-cp314-cp314-win_amd64.whl (8.8 MB view details)

Uploaded CPython 3.14Windows x86-64

fabricatio_tool-0.8.11-cp314-cp314-manylinux_2_39_x86_64.whl (9.6 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.39+ x86-64

fabricatio_tool-0.8.11-cp314-cp314-manylinux_2_39_aarch64.whl (8.6 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.39+ ARM64

fabricatio_tool-0.8.11-cp314-cp314-macosx_11_0_arm64.whl (8.7 MB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

fabricatio_tool-0.8.11-cp313-cp313-win_amd64.whl (8.7 MB view details)

Uploaded CPython 3.13Windows x86-64

fabricatio_tool-0.8.11-cp313-cp313-manylinux_2_39_x86_64.whl (9.6 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.39+ x86-64

fabricatio_tool-0.8.11-cp313-cp313-manylinux_2_39_aarch64.whl (8.6 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.39+ ARM64

fabricatio_tool-0.8.11-cp313-cp313-macosx_11_0_arm64.whl (8.7 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

fabricatio_tool-0.8.11-cp312-cp312-win_amd64.whl (8.7 MB view details)

Uploaded CPython 3.12Windows x86-64

fabricatio_tool-0.8.11-cp312-cp312-manylinux_2_39_x86_64.whl (9.6 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.39+ x86-64

fabricatio_tool-0.8.11-cp312-cp312-manylinux_2_39_aarch64.whl (8.6 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.39+ ARM64

fabricatio_tool-0.8.11-cp312-cp312-macosx_11_0_arm64.whl (8.7 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

File details

Details for the file fabricatio_tool-0.8.11-cp314-cp314-win_amd64.whl.

File metadata

  • Download URL: fabricatio_tool-0.8.11-cp314-cp314-win_amd64.whl
  • Upload date:
  • Size: 8.8 MB
  • Tags: CPython 3.14, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.1 {"installer":{"name":"uv","version":"0.12.1","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_tool-0.8.11-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 6b3418296a452907c71d98d47855cafc19153a37d79f160715f25365f15ac6e3
MD5 d664334cf445750f70a9004db42244c1
BLAKE2b-256 058d88ba0d5535492064c8ac455fbb07e9a63922ead776ab10798de0b45e8199

See more details on using hashes here.

File details

Details for the file fabricatio_tool-0.8.11-cp314-cp314-manylinux_2_39_x86_64.whl.

File metadata

  • Download URL: fabricatio_tool-0.8.11-cp314-cp314-manylinux_2_39_x86_64.whl
  • Upload date:
  • Size: 9.6 MB
  • Tags: CPython 3.14, manylinux: glibc 2.39+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.1 {"installer":{"name":"uv","version":"0.12.1","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_tool-0.8.11-cp314-cp314-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 139d271515edccaf72e898b629920123a7f2c88e60e52e6246bdc28e4ab697a2
MD5 30b561c2a08c122ce6684e0bc7fb8bcf
BLAKE2b-256 152ce6813c5587f9e75399a7ff0a99506a2452ff267531c142286a71d04dd07d

See more details on using hashes here.

File details

Details for the file fabricatio_tool-0.8.11-cp314-cp314-manylinux_2_39_aarch64.whl.

File metadata

  • Download URL: fabricatio_tool-0.8.11-cp314-cp314-manylinux_2_39_aarch64.whl
  • Upload date:
  • Size: 8.6 MB
  • Tags: CPython 3.14, manylinux: glibc 2.39+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.1 {"installer":{"name":"uv","version":"0.12.1","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_tool-0.8.11-cp314-cp314-manylinux_2_39_aarch64.whl
Algorithm Hash digest
SHA256 c7000c84ce3686276738e3a8d68f1d45b6e69d8e2a1533bf13b4cdc6ad72b325
MD5 41715aeb3c5bca23a98c349e44e388fb
BLAKE2b-256 32160a97426f6d74944c66bb6e4b91e6fe3974191fb930e056ed1ec59992ae34

See more details on using hashes here.

File details

Details for the file fabricatio_tool-0.8.11-cp314-cp314-macosx_11_0_arm64.whl.

File metadata

  • Download URL: fabricatio_tool-0.8.11-cp314-cp314-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 8.7 MB
  • Tags: CPython 3.14, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.1 {"installer":{"name":"uv","version":"0.12.1","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_tool-0.8.11-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5a4ab177b3145609f9b05e1a2d76a1ca8921299f61d634086c464336892571e3
MD5 d80c9b886eb640a6223a8248c9c45a8e
BLAKE2b-256 9f4da8d6d26eaafce99f76ce2733137989d53620b2bfbe2e9ad09dcf76b870e2

See more details on using hashes here.

File details

Details for the file fabricatio_tool-0.8.11-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: fabricatio_tool-0.8.11-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 8.7 MB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.1 {"installer":{"name":"uv","version":"0.12.1","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_tool-0.8.11-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 94813d0054a98e1876c7b23f88a877e73cc02bd5c4308ead2825aade853bd1d7
MD5 c36e06278407f20b944d3082390ee59b
BLAKE2b-256 b5ad90d00f5a965de2a40c0fdc2f817d8116aa5a3ec59a3e42420737c4b55323

See more details on using hashes here.

File details

Details for the file fabricatio_tool-0.8.11-cp313-cp313-manylinux_2_39_x86_64.whl.

File metadata

  • Download URL: fabricatio_tool-0.8.11-cp313-cp313-manylinux_2_39_x86_64.whl
  • Upload date:
  • Size: 9.6 MB
  • Tags: CPython 3.13, manylinux: glibc 2.39+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.1 {"installer":{"name":"uv","version":"0.12.1","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_tool-0.8.11-cp313-cp313-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 a27de7f90f114fe21184822a64bac3c1761dcbbe1f1d40a197de3e948c188a2d
MD5 9705393d53a842cb69cc8bd45809af2e
BLAKE2b-256 e65e622bbc1edc22a0757f0b68d9ce445e46326877f6060cec09488883869534

See more details on using hashes here.

File details

Details for the file fabricatio_tool-0.8.11-cp313-cp313-manylinux_2_39_aarch64.whl.

File metadata

  • Download URL: fabricatio_tool-0.8.11-cp313-cp313-manylinux_2_39_aarch64.whl
  • Upload date:
  • Size: 8.6 MB
  • Tags: CPython 3.13, manylinux: glibc 2.39+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.1 {"installer":{"name":"uv","version":"0.12.1","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_tool-0.8.11-cp313-cp313-manylinux_2_39_aarch64.whl
Algorithm Hash digest
SHA256 d39cc230c21ccbf6af63bb027c6005dab3e53fc804b1785cbdabcb4b68de8c20
MD5 798566fdc170fb9f92d1f4b226be742d
BLAKE2b-256 c2cbc804e4cb9e1bd7b1d13f61fa85849e869f19636c3fef06375438d2078382

See more details on using hashes here.

File details

Details for the file fabricatio_tool-0.8.11-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

  • Download URL: fabricatio_tool-0.8.11-cp313-cp313-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 8.7 MB
  • Tags: CPython 3.13, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.1 {"installer":{"name":"uv","version":"0.12.1","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_tool-0.8.11-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5bdf033ffdf5de0b7350fec462cb383c8e9566dec0b33dd4b0c1ff4b472479e3
MD5 f9bdbb60bd414db3344c1b14e25db7e5
BLAKE2b-256 4a188826a49647abaf30697aebf06907f8fd31512970a171afa0be247d3e99d4

See more details on using hashes here.

File details

Details for the file fabricatio_tool-0.8.11-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: fabricatio_tool-0.8.11-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 8.7 MB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.1 {"installer":{"name":"uv","version":"0.12.1","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_tool-0.8.11-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 06d90ac680cc391cb2f81a586a26fb7a5f85e70e151796c1fa5d3916cd557277
MD5 26c8f6d047bb03a7dbc16179f029caef
BLAKE2b-256 fe9799f0b07b3d5f735badce31f2a8e3c42875cd5788d0599f504b53fc397921

See more details on using hashes here.

File details

Details for the file fabricatio_tool-0.8.11-cp312-cp312-manylinux_2_39_x86_64.whl.

File metadata

  • Download URL: fabricatio_tool-0.8.11-cp312-cp312-manylinux_2_39_x86_64.whl
  • Upload date:
  • Size: 9.6 MB
  • Tags: CPython 3.12, manylinux: glibc 2.39+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.1 {"installer":{"name":"uv","version":"0.12.1","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_tool-0.8.11-cp312-cp312-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 c797ff44a85b72523fa9bcd40785aecb020d1d47fe4f422fe9cf8138d8cef72d
MD5 8f266ca101f8e4405568d06bc8e3b560
BLAKE2b-256 a37ff50f41e26a82084ce8d27d90ee9fb232e2c8a24e21b4a8fea3c62585e25a

See more details on using hashes here.

File details

Details for the file fabricatio_tool-0.8.11-cp312-cp312-manylinux_2_39_aarch64.whl.

File metadata

  • Download URL: fabricatio_tool-0.8.11-cp312-cp312-manylinux_2_39_aarch64.whl
  • Upload date:
  • Size: 8.6 MB
  • Tags: CPython 3.12, manylinux: glibc 2.39+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.1 {"installer":{"name":"uv","version":"0.12.1","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_tool-0.8.11-cp312-cp312-manylinux_2_39_aarch64.whl
Algorithm Hash digest
SHA256 3126972bc2b17ddba316b008be2a4b61142fba216835d2fc4bd4efae9efacb79
MD5 d8258e5cd500e1018d7aea64ea5358c3
BLAKE2b-256 7b210803a2c23aa782a5195998f9208588828f2587a3cf1671d73a8f9f0777ef

See more details on using hashes here.

File details

Details for the file fabricatio_tool-0.8.11-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

  • Download URL: fabricatio_tool-0.8.11-cp312-cp312-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 8.7 MB
  • Tags: CPython 3.12, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.1 {"installer":{"name":"uv","version":"0.12.1","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_tool-0.8.11-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 93b97f90f279cdda01daa90e3083d4041875a6e334f6dd51c2ee70f8e83fa99e
MD5 68789a8dafdb6e422f0425d0397066a1
BLAKE2b-256 13b9b8790f310f8f9a90c280c538c909bedf10585627ae85434111f6fe6505cc

See more details on using hashes here.

Release history Release notifications | RSS feed

0.8.13

12 files

0.8.12

12 files

This release

0.8.11 This release

12 files

0.8.10

12 files

0.8.9

12 files

0.8.8

12 files

0.8.7

12 files

0.8.6

12 files

0.8.5

12 files

0.8.4

12 files

0.8.3

12 files

0.8.2

12 files

0.8.0

12 files

0.7.0

12 files

0.6.10

12 files

0.6.9

8 files

0.6.8

8 files

0.6.7

8 files

0.6.6

8 files

0.6.5

8 files

0.6.4

8 files

0.6.3

8 files

0.6.2

8 files

0.6.1

8 files

0.4.2

8 files

0.4.1

8 files

0.4.0

8 files

0.3.1

4 files

0.3.0

4 files

0.2.0

3 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page