Skip to content

Toolkits

Toolkits are collections of pre-built tools for common tasks like File I/O and System operations.

Overview

Instead of writing every tool from scratch, you can use Toolkit classes to generate standard tools.

Usage

from yosrai.toolkit import FileToolkit, SystemToolkit, WebToolkit

# Safe file access confined to a directory
file_tools = FileToolkit(root_dir="./workspace").get_tools()

# Web Search and Browsing capability
web_tools = WebToolkit(max_results=3).get_tools()
# Includes: search_duckduckgo, read_web_page

# Safe shell execution (optional)
sys_tools = SystemToolkit(allow_shell=True).get_tools()

agent = Agent(..., tools=file_tools + web_tools)

API Reference

yosrai.toolkit.base.Toolkit

Bases: ABC

Abstract base class for a collection of tools.

get_tools() abstractmethod

Return a list of tools (functions decorated with @tool) provided by this toolkit.

yosrai.toolkit.filesystem.FileToolkit

Bases: Toolkit

Toolkit for safe file system operations. Limits access to a specific root directory.

yosrai.toolkit.system.SystemToolkit

Bases: Toolkit

Toolkit for system operations (Shell). WARNING: Use with caution.

yosrai.toolkit.web.WebToolkit

Bases: Toolkit

Toolkit for web search and data retrieval.