Create validated, structured functions that can be used safely by LLM agents.
Tool
class allows you to wrap Python functions—synchronous or asynchronous—with input validation, rich metadata, and compatibility with LLM agent frameworks such as LangChain.
It enables:
StructuredTool
Name | Type | Description |
---|---|---|
name | str | Unique identifier for the tool |
description | str | Used in UIs and LLM prompt construction |
func | Callable | The actual function (sync or async) to execute |
input_schema | Optional[BaseModel] | Pydantic schema for validating and describing tool inputs |
raise_on_error | bool (default=True) | If False , will suppress exceptions and log errors |
describe()
ToolInputValidationError
will be raised with detailed information:
describe()
to integrate with UIs or LLM-based planning systems