Skip to content

xtr_ai.decorator

Declaring a service's methods as tools an agent can call.

TOOL_ATTRIBUTE module-attribute

TOOL_ATTRIBUTE: Final = '__xtr_ai_tool__'

The attribute @as_tool sets on the method it marks.

ToolDeclaration dataclass

ToolDeclaration(method: str, agents: tuple[str, ...], name: str | None = None, description: str | None = None)

A method declared a tool, for the agents named.

Attributes:

  • method (str) –

    The method's attribute name on its class.

  • agents (tuple[str, ...]) –

    The agents the tool is given to.

  • name (str | None) –

    The tool's name; the method's name when None.

  • description (str | None) –

    The tool's description; the method's docstring when None.