Skip to main content

BaseTool

Defined in the base module.
AI Agent Abstract base class for all PraisonAI tools. Subclass this to create custom tools that can be:
  • Used directly by agents
  • Distributed as pip-installable plugins
  • Auto-discovered via entry_points
Attributes: name: Unique identifier for the tool description: Human-readable description (used by LLM) version: Tool version string (default: “1.0.0”) parameters: JSON Schema for parameters (auto-generated if not provided)

Constructor

Optional
No description available.

Properties

str
No description available.
str
No description available.
str
No description available.
Optional
No description available.

Methods

validate_class()

Validate a tool class before instantiation.

run()

Execute the tool with given arguments.

to_model_output()

Optional hook returning a compact, model-facing view of result.

safe_run()

Execute tool with error handling, returning ToolResult.

get_schema()

Get OpenAI-compatible function schema for this tool.

validate()

Validate the tool configuration.

validate_schema_roundtrip()

Validate that schema can round-trip through OpenAI-style serialization.

Usage

Source

View on GitHub

praisonaiagents/tools/base.py at line 179

Tools Concept

Create Custom Tools

Tool Development