ant_ai.tools.registry
ToolRegistry
pydantic-model
Bases: BaseModel
Maintains a name-keyed mapping of Tool instances.
Show JSON schema:
{
"description": "Maintains a name-keyed mapping of Tool instances.",
"properties": {},
"title": "ToolRegistry",
"type": "object"
}
Source code in src/ant_ai/tools/registry.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | |
register
register(tool: Tool) -> None
Add tool to the registry.
For namespace tools (class-based with multiple methods), each method is registered as an individual callable tool named "ClassName_method".
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tool
|
Tool
|
Tool to add to the registry. |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
If a tool with the same name is already registered. |
Source code in src/ant_ai/tools/registry.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | |
remove
remove(name: str) -> None
Remove the tool named name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Name of the tool to remove from the registry. |
required |
Raises:
| Type | Description |
|---|---|
KeyError
|
If no such tool is registered. |
Source code in src/ant_ai/tools/registry.py
52 53 54 55 56 57 58 59 60 61 62 63 | |
to_serialized
to_serialized() -> list[dict]
Serialize all tools for inclusion in an LLM API request.
Source code in src/ant_ai/tools/registry.py
79 80 81 | |