yera 0.11.1

yera.tools.decorated_tool

The callable wrapper produced by @tool.

Symbols

class DecoratedTool — Callable wrapper around a tool function.

DecoratedTool

Inherits: BaseTool

Callable wrapper around a tool function.

Produced by the @tool decorator. When called, resolves the tool's declared credential groups, binds them to the tool credential context, runs the wrapped function, and tears the context down on completion (even on failure).

Instances are normally produced by the decorator rather than constructed directly.

Methods

__init__ — Wrap ``func`` as a tool with optional credential groups.
__call__ — Invoke the tool.
invoke — Fill the inputs to this tool using the active LLM and then call it.

DecoratedTool.__init__

__init__(
    func: Callable,
    creds_keys: list[str] | None = None,
    insert_result: bool = True,
)

Wrap func as a tool with optional credential groups.

Parameters

func
type: Callable

The function to wrap.

creds_keys
type: list[str] | None = None

Credential group names to resolve before each call, or None to skip credential resolution.

insert_result
type: bool = True

Whether the tool's return value is added to the conversation. Set False for side-effect-only tools whose output would be noise in the model's context. Failures are reported regardless — the model asked for the call and needs to know it didn't succeed.

DecoratedTool.__call__

__call__(
    *args,
    **kwargs,
) → object

Invoke the tool.

Resolves and binds the tool's credentials (if any), calls the wrapped function, and restores the previous credential context on completion.

Parameters

*args
type: object = ()

Positional arguments forwarded to the wrapped function.

**kwargs
type: object

Keyword arguments forwarded to the wrapped function.

Returns

type: object

The wrapped function's return value.

DecoratedTool.invoke

invoke(
    instruction: str | None = None,
    **kwargs,
) → object

Fill the inputs to this tool using the active LLM and then call it.

Parameters

instruction
type: str | None = None

Optional guiding prompt for structured input generation.

**kwargs
type: str | int | float | bool

additional values to pass down the the llm generation such as temperature.

Returns

type: object

The result of calling the tool.