Skip to main content

base

AI Agent Base classes for PraisonAI Agent tools. This module provides the foundation for creating tools that can be used by agents. External developers can create plugins by subclassing BaseTool. Usage:

Import

Classes

ToolValidationError

Raised when a tool fails validation.

ToolResult

Wrapper for tool execution results.

BaseTool

Abstract base class for all PraisonAI tools.

Functions

resolve_model_output()

Return a tool result’s own compact, model-facing view, or None.

multimodal_content()

Convenience factory for building a multimodal ToolResult.

text_part()

Build a text content part.

image_part()

Build an image content part from raw bytes/base64 or a URL/data URI.

file_part()

Build a generic file content part from raw bytes/base64 or a URL.

validate_tool()

Validate any tool-like object.

validate_tool_schema_consistency()

Validate a list of tools for schema consistency with OpenAI format.

get_sorted_tool_schemas()

Get tool schemas sorted by function name for deterministic ordering.