agentic_fabric.tools.file_tools¶
Framework-neutral file manipulation tools for agents.
These tools enable agents to read and write code to specific directories in
workspace package codebases. Write restrictions are configurable via
environment variables or the configure_write_restrictions function.
Without CrewAI and Pydantic installed, the tool classes function as plain
callables: _run methods are directly invocable but args_schema is
None. Frameworks that require a Pydantic args_schema will need
CrewAI (or at least Pydantic) installed.
Module Contents¶
Classes¶
Tool for writing code files to a game package codebase. |
|
Tool for reading code files from a game package codebase. |
|
Tool for listing files in a directory. |
Functions¶
Get the workspace root directory for the target game code package. |
|
Replace the module-level |
Data¶
API¶
- agentic_fabric.tools.file_tools.get_workspace_root(package_name: str | None = None) pathlib.Path¶
Get the workspace root directory for the target game code package.
Returns packages/<package_name> as the workspace root, where the game code lives.
Uses marker file search to find workspace root reliably, regardless of where this module is installed or imported from.
Args: package_name: Name of the target package. If not provided, uses TARGET_PACKAGE environment variable, or the only package directory when the workspace has exactly one package.
Returns: Path to packages/<package_name> directory.
- agentic_fabric.tools.file_tools.ALLOWED_WRITE_DIRS: list[str] = 'list(...)'¶
- agentic_fabric.tools.file_tools.ALLOWED_EXTENSIONS: set[str] = 'set(...)'¶
- agentic_fabric.tools.file_tools.configure_write_restrictions(allowed_dirs: list[str] | None = None, allowed_extensions: set[str] | None = None) None¶
Replace the module-level
ALLOWED_WRITE_DIRSandALLOWED_EXTENSIONS.Pass
Nonefor either argument to leave that restriction unchanged. This is intended to be called once at application startup to customize write restrictions for the host project.Args: allowed_dirs: New list of allowed write directories relative to the selected package root. Replaces the existing list when provided. allowed_extensions: New set of allowed file extensions (with leading dots, e.g.
{".py", ".toml"}). Replaces the existing set when provided.
- agentic_fabric.tools.file_tools.WriteFileInput = '_build_pydantic_schema(...)'¶
- class agentic_fabric.tools.file_tools.GameCodeWriterTool¶
Bases:
crewai.tools.BaseToolTool for writing code files to a game package codebase.
This tool is restricted to specific directories to ensure agents only modify appropriate parts of the codebase.
- name: str = 'Write Game Code File'¶
- description: str = <Multiline-String>¶
- args_schema: Any = None¶
- agentic_fabric.tools.file_tools.ReadFileInput = '_build_pydantic_schema(...)'¶
- class agentic_fabric.tools.file_tools.GameCodeReaderTool¶
Bases:
crewai.tools.BaseToolTool for reading code files from a game package codebase.
Use this to understand existing patterns before writing new code.
- name: str = 'Read Game Code File'¶
- description: str = <Multiline-String>¶
- args_schema: Any = None¶
- agentic_fabric.tools.file_tools.ListDirInput = '_build_pydantic_schema(...)'¶