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

Uploaded CPython 3.14Windows x86-64

fabricatio_tool-0.8.12-cp314-cp314-manylinux_2_39_x86_64.whl (9.9 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.39+ x86-64

fabricatio_tool-0.8.12-cp314-cp314-manylinux_2_39_aarch64.whl (8.8 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.39+ ARM64

fabricatio_tool-0.8.12-cp314-cp314-macosx_11_0_arm64.whl (9.0 MB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

fabricatio_tool-0.8.12-cp313-cp313-win_amd64.whl (9.0 MB view details)

Uploaded CPython 3.13Windows x86-64

fabricatio_tool-0.8.12-cp313-cp313-manylinux_2_39_x86_64.whl (9.9 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.39+ x86-64

fabricatio_tool-0.8.12-cp313-cp313-manylinux_2_39_aarch64.whl (8.8 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.39+ ARM64

fabricatio_tool-0.8.12-cp313-cp313-macosx_11_0_arm64.whl (8.9 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

fabricatio_tool-0.8.12-cp312-cp312-win_amd64.whl (9.0 MB view details)

Uploaded CPython 3.12Windows x86-64

fabricatio_tool-0.8.12-cp312-cp312-manylinux_2_39_x86_64.whl (9.9 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.39+ x86-64

fabricatio_tool-0.8.12-cp312-cp312-manylinux_2_39_aarch64.whl (8.8 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.39+ ARM64

fabricatio_tool-0.8.12-cp312-cp312-macosx_11_0_arm64.whl (8.9 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: fabricatio_tool-0.8.12-cp314-cp314-win_amd64.whl
  • Upload date:
  • Size: 9.0 MB
  • Tags: CPython 3.14, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","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.12-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 634d747fafa351999de1f524d852b9505a8bf7d4e6b4c8d4afc2460b40da4816
MD5 6ca9aaf8a576df804afc6f2d210a3965
BLAKE2b-256 9795ca6b23753b927743035a0efedef3a23221e03c827ca6318603a8d4797238

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio_tool-0.8.12-cp314-cp314-manylinux_2_39_x86_64.whl
  • Upload date:
  • Size: 9.9 MB
  • Tags: CPython 3.14, manylinux: glibc 2.39+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","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.12-cp314-cp314-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 a095125e7e674af22e517c9ea4f4befd9a3ac6f555a896492d8dcf5cccad6910
MD5 1d28a16eaaa52ee71ce9048250156eb8
BLAKE2b-256 e98d14a29f0ce7b051d8ad4e7629fc7dc70631c3e404aae0c445ec1360e5b02e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio_tool-0.8.12-cp314-cp314-manylinux_2_39_aarch64.whl
  • Upload date:
  • Size: 8.8 MB
  • Tags: CPython 3.14, manylinux: glibc 2.39+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","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.12-cp314-cp314-manylinux_2_39_aarch64.whl
Algorithm Hash digest
SHA256 6e87294eff0346e86785d43e012c044fbf27b3de4af7d8492ed3c7a439ad37f6
MD5 9b7b934c53f8b1b161534a62550901e0
BLAKE2b-256 ec34885a64951a655351d244e9bef477d3421cd48245f078eb63996fd9a092ac

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio_tool-0.8.12-cp314-cp314-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 9.0 MB
  • Tags: CPython 3.14, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","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.12-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7a54bf107eb3cc0b7e4f762fc5c5da382d8bd1a7ffed0cdc33879aabb46308e9
MD5 6a94c5d2ff466d6e01e01bb5a171b869
BLAKE2b-256 d3d6ff94d1a1d69690b89af423a0223f8c009db0dc6e7591ad198086645d62b0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio_tool-0.8.12-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 9.0 MB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","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.12-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 4bb86f014a048f01e07cdf905ed8ae081bd157a05f8ef4525cfed13a36dda33d
MD5 51bdd40b58229b9329dc2e4f3c69630b
BLAKE2b-256 a0a2c6bb7a94a4369d87f595fb15355bdf13328a1084f70a3c2e8f482dd80939

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio_tool-0.8.12-cp313-cp313-manylinux_2_39_x86_64.whl
  • Upload date:
  • Size: 9.9 MB
  • Tags: CPython 3.13, manylinux: glibc 2.39+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","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.12-cp313-cp313-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 2eb992501240fe74b90ddd916d002362cfa2a6afda370388403b7813676f69f7
MD5 9d40ea7fbfe630b39d2e72b5e263e031
BLAKE2b-256 b312dae85c3798a8cedc90e516c5a60fed25ab356fd9c729357d49bf689601c5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio_tool-0.8.12-cp313-cp313-manylinux_2_39_aarch64.whl
  • Upload date:
  • Size: 8.8 MB
  • Tags: CPython 3.13, manylinux: glibc 2.39+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","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.12-cp313-cp313-manylinux_2_39_aarch64.whl
Algorithm Hash digest
SHA256 a8f6f60206fe31e94bb31e7e747181887094dcdcb10e7f3b9bdea0e7923bd1ce
MD5 b851f5dd985c3216fafb4f39393af086
BLAKE2b-256 96aeb9785a09aba4f7c3038f11b85d36339a3bc95ac5fcec07ba27132a0857b7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio_tool-0.8.12-cp313-cp313-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 8.9 MB
  • Tags: CPython 3.13, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","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.12-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a5a918747be4421928b1c6bee05ba8ce91f197f4b94efa8bea942d5c217d2256
MD5 4d48c04346025701b4a864e904313a54
BLAKE2b-256 b99816f8f4c9700347171e6ce911c5fd1b51de0490a5e2db16dba1b6b6216689

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio_tool-0.8.12-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 9.0 MB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","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.12-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 e69aed392a8f76349403b434ab85449885ff501ab6639a0a7f323e4f6f9f3378
MD5 ef4d5a5f675dc41ab1be083171cb2c93
BLAKE2b-256 cf9dbc1c60c23fbfa777b5c9deb65dfd7268ace46c9abecb281ea4b8a2ffd290

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio_tool-0.8.12-cp312-cp312-manylinux_2_39_x86_64.whl
  • Upload date:
  • Size: 9.9 MB
  • Tags: CPython 3.12, manylinux: glibc 2.39+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","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.12-cp312-cp312-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 eba58ec19317aa72f2d94ce905a3fee20096d2deabb222ab41fac986daa63065
MD5 3e611f0195e1fc0424350265c857e8ea
BLAKE2b-256 0cf08234fdc8fcd58e55e9a6c4e8f83d63d0a2059c7cfc0840992e3546e0a6ce

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio_tool-0.8.12-cp312-cp312-manylinux_2_39_aarch64.whl
  • Upload date:
  • Size: 8.8 MB
  • Tags: CPython 3.12, manylinux: glibc 2.39+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","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.12-cp312-cp312-manylinux_2_39_aarch64.whl
Algorithm Hash digest
SHA256 51bf431e61b53839fc05107d02edcfc34a7f83b96f21a680fc170a0c7de5eb52
MD5 4b3aefe9e83694f70c88e8f8d92b7850
BLAKE2b-256 88efc483eef6f8b83004bda51789cd34d8b9e2472d3f2a77d261e18e97fbd2eb

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabricatio_tool-0.8.12-cp312-cp312-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 8.9 MB
  • Tags: CPython 3.12, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","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.12-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 50fe4df3a51c652dcc22015125d9bee40faaec3c5fc5260f0441b968100d3262
MD5 eaa9fde65f9e2610a9e6129aaa5ef869
BLAKE2b-256 b5af3059292663a2169bf1dfab90eac4845ddd9b612ccc10524214237054055c

See more details on using hashes here.

Release history Release notifications | RSS feed

0.8.13

12 files

This release

0.8.12 This release

12 files

0.8.11

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