agentix.tools¶
tools ¶
Defining tools.
The @tool decorator turns a plain, typed Python function into a registered
:class:Tool whose JSON Schema is derived from the function's type hints and
docstring. One decorated function is the single source of truth: the name, the
description, the parameter schema the model sees, and the executable body —
so the schema can't drift from the implementation.
@tool
def get_weather(city: str) -> str:
'''Get the current weather for a city.
Args:
city: City name, e.g. 'Paris'.
'''
return f"{city}: 21C"
A :class:ToolRegistry collects tools, exposes their schemas for the model,
and doubles as a :class:~agentix.executors.ToolExecutor for the loop.
Tool ¶
A callable wrapped with the metadata the agent loop needs.
Stays callable, so a decorated function can still be invoked directly (handy in tests and for non-agent use).
schema
property
¶
The provider-neutral schema dict (name, description, parameters).
ToolRegistry ¶
Collects tools; provides schemas for the model and acts as the
executor for the loop (delegating to a :class:LocalToolExecutor).
tool ¶
tool(
func: ToolFn | None = None,
*,
name: str | None = None,
description: str | None = None,
) -> Any
Decorator that turns a function into a :class:Tool.
Usable bare (@tool) or with overrides (@tool(name="...", ...)).
The schema is generated from type hints; the description defaults to the
first paragraph of the docstring, and per-parameter descriptions are read
from a Google-style Args: section.