strands.tools.tool_provider
Tool provider interface.
ToolProvider
Section titled “ToolProvider”class ToolProvider(ABC)Defined in: src/strands/tools/tool_provider.py:11
Interface for providing tools with lifecycle management.
Provides a way to load a collection of tools and clean them up when done, with lifecycle managed by the agent.
load_tools
Section titled “load_tools”@abstractmethodasync def load_tools(**kwargs: Any) -> Sequence["AgentTool"]Defined in: src/strands/tools/tool_provider.py:19
Load and return the tools in this provider.
Arguments:
**kwargs- Additional arguments for future compatibility.
Returns:
List of tools that are ready to use.
add_consumer
Section titled “add_consumer”@abstractmethoddef add_consumer(consumer_id: Any, **kwargs: Any) -> NoneDefined in: src/strands/tools/tool_provider.py:31
Add a consumer to this tool provider.
Arguments:
consumer_id- Unique identifier for the consumer.**kwargs- Additional arguments for future compatibility.
remove_consumer
Section titled “remove_consumer”@abstractmethoddef remove_consumer(consumer_id: Any, **kwargs: Any) -> NoneDefined in: src/strands/tools/tool_provider.py:41
Remove a consumer from this tool provider.
This method must be idempotent - calling it multiple times with the same ID should have no additional effect after the first call.
Provider may clean up resources when no consumers remain.
Arguments:
consumer_id- Unique identifier for the consumer.**kwargs- Additional arguments for future compatibility.