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

Uploaded CPython 3.14Windows x86-64

fabricatio_tool-0.8.10-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.10-cp314-cp314-manylinux_2_39_aarch64.whl (8.6 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.39+ ARM64

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

Uploaded CPython 3.14macOS 11.0+ ARM64

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

Uploaded CPython 3.13Windows x86-64

fabricatio_tool-0.8.10-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.10-cp313-cp313-manylinux_2_39_aarch64.whl (8.6 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.39+ ARM64

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

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

fabricatio_tool-0.8.10-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.10-cp312-cp312-manylinux_2_39_aarch64.whl (8.6 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.39+ ARM64

fabricatio_tool-0.8.10-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.10-cp314-cp314-win_amd64.whl.

File metadata

  • Download URL: fabricatio_tool-0.8.10-cp314-cp314-win_amd64.whl
  • Upload date:
  • Size: 8.7 MB
  • Tags: CPython 3.14, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.29 {"installer":{"name":"uv","version":"0.11.29","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.10-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 f43eff96b0e7bc7d15a67d3290a0e87a393c09a63b5ce516b5fc06831ee0929b
MD5 0db38d2012a350a6e64c7eb891e346cc
BLAKE2b-256 d778c2d2d43d4c673921d1ac670319b6d821927fc34f955b46c631c2854dc0d7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio_tool-0.8.10-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.11.29 {"installer":{"name":"uv","version":"0.11.29","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.10-cp314-cp314-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 4fecfff713fffb844d036fcc4cf5c1eaa33eeb3af996e3bc81864820f4ed8a54
MD5 c6832a0621e640f38e4a16bae11f94bb
BLAKE2b-256 22cfce4874bf1094ac82761d5968acd45f86d5107d23ab676a0617f8d491a3dd

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio_tool-0.8.10-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.11.29 {"installer":{"name":"uv","version":"0.11.29","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.10-cp314-cp314-manylinux_2_39_aarch64.whl
Algorithm Hash digest
SHA256 2abcff4a3fc33e6ae7296e451a3373ad6b766e806e28dbd33e0ddd6b6b7c7f15
MD5 d0d0a07cfb8ba65419c23526ae48f031
BLAKE2b-256 299ae92e0b0c8c98b50de2638fb66fe2c6e05143c81b2d0c4af142f4663690d6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio_tool-0.8.10-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.11.29 {"installer":{"name":"uv","version":"0.11.29","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.10-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a3b5d9de863f941c5c343ff25aaca167a0ffeca8e9b4ec10dc96c39262683b0c
MD5 21d697d8bcad1ab1afcbe8dae00d48f8
BLAKE2b-256 479aa082f69a9dca925f3a39b7df281464933eeb697580129b6303dcad3b8f2d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio_tool-0.8.10-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.11.29 {"installer":{"name":"uv","version":"0.11.29","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.10-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 018e2cb276bcfd1611fb06addad0e558fe74ca95323f5008242fd2ff7f9a7805
MD5 3397ef06a2d0708f6fa5b28070383448
BLAKE2b-256 9e758ad1f723ce2e0ab34e8cb21f8acaf9848cfa1c058368cbdf7f80d83d95f5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio_tool-0.8.10-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.11.29 {"installer":{"name":"uv","version":"0.11.29","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.10-cp313-cp313-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 f724ede8d1c5a9d0e46d9351cc159582955141331f6dadbc319b018e766f7383
MD5 79573eb0a6831670bf8a6a9cc72f31b5
BLAKE2b-256 b72094b6be25c1965bd44e0affe12c84a1d6f6b8ef1c91dbf2b3c1d4a1eecf15

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio_tool-0.8.10-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.11.29 {"installer":{"name":"uv","version":"0.11.29","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.10-cp313-cp313-manylinux_2_39_aarch64.whl
Algorithm Hash digest
SHA256 2b8dfeffa929fbe0d38d2c361bb27ecd75f24005c9dbd25feb9cd030692c3138
MD5 06b6e60938e53babc7136e0da8164964
BLAKE2b-256 3be67e522713b9708ccc5c88c53fa41d9df1570b0fa77e593d8cd5a9603245a8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio_tool-0.8.10-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.11.29 {"installer":{"name":"uv","version":"0.11.29","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.10-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 120d24cfcade31e55bb3f107fa715732e146441f2b9c293479eabfc4e794da87
MD5 cfacde5a3a2b82b86010fda294fdf4b0
BLAKE2b-256 e5b1275b278434d459cb061585a0454a52986b756817efdce5d872cc1d5ab61b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio_tool-0.8.10-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.11.29 {"installer":{"name":"uv","version":"0.11.29","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.10-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 4865b9fcbe0559a63a22279b1cf3269337b05e10ddd5e63c57d86e52121b72da
MD5 0036f9793b4cb3187afd8defc34d10d5
BLAKE2b-256 b341c6ab31f8c10be302faf144528f5d35fa7a5e14825865f7eff97a46376467

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio_tool-0.8.10-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.11.29 {"installer":{"name":"uv","version":"0.11.29","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.10-cp312-cp312-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 f9c929eb64ec2385db097f7e352219f804a2d3b4327f2f1cae9be5be4bf49c44
MD5 845a05d9f14373204f13f5852af2031b
BLAKE2b-256 07b64c7e5e9ce486e8053ada587389c907681cd48f634acfed68e9fcd4bdf207

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio_tool-0.8.10-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.11.29 {"installer":{"name":"uv","version":"0.11.29","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.10-cp312-cp312-manylinux_2_39_aarch64.whl
Algorithm Hash digest
SHA256 048cea0af945ae7f9d2d52a7f89820325c33989fe78be7b2dc4d0688c3e9bc54
MD5 0e1245c52579fea0eac048746115c618
BLAKE2b-256 5486f8bbe12b3cd457777beca467bbe30bfe1764610e24c25ce9a4940ecd930a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio_tool-0.8.10-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.11.29 {"installer":{"name":"uv","version":"0.11.29","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.10-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6e19c116b449c53e57d1d12de5caa77693287e6675ecc148ade46002f1f4114a
MD5 82b31d4bd0a2755efd9cdf35f681b1a1
BLAKE2b-256 edbbcdb877e9d48ff05a415a323af6aad937a2b12fbbcdc031a04832eabc18a5

See more details on using hashes here.

Release history Release notifications | RSS feed

0.8.13

12 files

0.8.12

12 files

0.8.11

12 files

This release

0.8.10 This release

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