nat.plugins.strands.tool_wrapper#

Attributes#

Classes#

NATFunctionAgentTool

Concrete Strands AgentTool that wraps a NAT Function.

Functions#

_json_schema_from_pydantic(→ dict[str, Any])

_to_tool_result(→ dict[str, Any])

_to_error_result(→ dict[str, Any])

strands_tool_wrapper(→ NATFunctionAgentTool)

Create a Strands AgentTool wrapper for a NAT Function.

Module Contents#

logger#
_json_schema_from_pydantic(
model: type[pydantic.BaseModel],
) dict[str, Any]#
_to_tool_result(tool_use_id: str, value: Any) dict[str, Any]#
_to_error_result(tool_use_id: str, err: Exception) dict[str, Any]#
class NATFunctionAgentTool(
name: str,
description: str | None,
input_schema: dict[str, Any],
fn: nat.builder.function.Function,
)#

Bases: strands.types.tools.AgentTool

Concrete Strands AgentTool that wraps a NAT Function.

_tool_name#
_tool_spec: strands.types.tools.ToolSpec#
_fn#
property tool_name: str#
property tool_spec: strands.types.tools.ToolSpec#
property tool_type: str#
async stream(
tool_use: strands.types.tools.ToolUse,
_invocation_state: dict[str, Any],
**_kwargs: Any,
) collections.abc.AsyncGenerator[Any, None]#

Stream tool events and return the final result.

Parameters#

tool_useToolUse

The tool use request containing tool ID and parameters.

_invocation_statedict[str, Any]

Unused parameter for compatibility.

_kwargsAny

Unused parameter for compatibility.

Yields#

Tool events with the last being the tool result.

strands_tool_wrapper(
name: str,
fn: nat.builder.function.Function,
_builder: nat.builder.builder.Builder,
) NATFunctionAgentTool#

Create a Strands AgentTool wrapper for a NAT Function.