register • AI Agent SDK

register: Register a tool with the registry.

register

Method

</div>

This is a method of the ToolRegistry class in the registry module.

Register a tool with the registry.

Thread-safe: Uses lock for concurrent access in multi-agent scenarios.

Signature

python
def register(tool: Union[BaseTool, Callable], name: Optional[str], overwrite: bool, trust_level: Optional[str], dynamic_schema_overrides: Optional[Callable[[Dict[str, Any]], Dict[str, Any]]]) -> None

Parameters

ParamField Union[BaseTool, Callable]

BaseTool instance or callable function

ParamField Optional[str]

Override name (default: tool.name or function.__name__)

ParamField bool

If True, overwrite existing tool with same name

ParamField Optional[str]

Trust level for the tool (“trusted” or “external”)

ParamField Optional

Optional function to dynamically modify tool schema. Called with base schema dict, returns modified schema dict.

Exceptions

ValueError

If tool with same name exists and overwrite=False

Uses

  • ToolTrustLevel
  • ValueError
  • callable
  • TypeError
  • logging.debug
  • ToolEntry

Used By

Source

View on GitHub

praisonaiagents/tools/registry.py at line 122