Skip to content

[FEATURE] Move ToolProvider out of experimental #1563

@Unshure

Description

@Unshure

Problem Statement

I would like to move the ToolProvider class out of experimental, and update references of it to remove mentions of experimental

Proposed Solution

No response

Use Case

You can import ToolProvider from outside of the experimental namespace

Alternatives Solutions

No response

Additional Context

No response


Implementation Requirements

Based on clarification discussion and repository analysis:

Overview

Move ToolProvider abstract base class from strands.experimental.tools to strands.tools as a stable public API, with backward compatibility via deprecation warning.

Technical Approach

1. Move ToolProvider Class

  • Source: src/strands/experimental/tools/tool_provider.py
  • Target: src/strands/tools/tool_provider.py
  • Target Import: from strands.tools import ToolProvider

2. Update Exports

  • Add ToolProvider to src/strands/tools/__init__.py:
    from .tool_provider import ToolProvider
    
    __all__ = [
        # ... existing exports ...
        "ToolProvider",
    ]

3. Backward Compatibility with Deprecation Warning

Update src/strands/experimental/tools/__init__.py following the pattern from hooks/events.py:

"""Experimental tools package."""

import warnings
from typing import Any

from ...tools import ToolProvider

_DEPRECATED_ALIASES = {
    "ToolProvider": ToolProvider,
}

def __getattr__(name: str) -> Any:
    if name in _DEPRECATED_ALIASES:
        warnings.warn(
            f"{name} has been moved to production. "
            f"Use {_DEPRECATED_ALIASES[name].__name__} from strands.tools instead.",
            DeprecationWarning,
            stacklevel=2,
        )
        return _DEPRECATED_ALIASES[name]
    raise AttributeError(f"module {__name__!r} has no attribute {name!r}")

__all__: list[str] = []

4. Update Internal Imports (6 files)

Source files:

File Current Import New Import
src/strands/agent/agent.py from ..experimental.tools import ToolProvider from ..tools import ToolProvider
src/strands/tools/mcp/mcp_client.py from ...experimental.tools import ToolProvider from .. import ToolProvider
src/strands/tools/registry.py from ..experimental.tools import ToolProvider from . import ToolProvider
src/strands/experimental/bidi/agent/agent.py from ...tools import ToolProvider from ....tools import ToolProvider

Test files:

File Current Import New Import
tests/strands/tools/test_registry.py from strands.experimental.tools import ToolProvider from strands.tools import ToolProvider
tests/strands/tools/test_registry_tool_provider.py from strands.experimental.tools.tool_provider import ToolProvider from strands.tools import ToolProvider

5. Update MCPClient Docstring

Remove experimental warning from src/strands/tools/mcp/mcp_client.py:

Remove this warning block from docstring (lines ~110-112):

Warning:
    This class implements the experimental ToolProvider interface and its methods
    are subject to change.

6. Update Documentation

Update AGENTS.md directory structure to reflect new location:

  • Remove: │ │ └── tools/ # Experimental tools
  • Remove: │ │ └── tool_provider.py
  • Add tool_provider.py under src/strands/tools/ section

Acceptance Criteria

  • ToolProvider can be imported from strands.tools
  • Old import path strands.experimental.tools.ToolProvider still works but emits DeprecationWarning
  • All internal imports updated to use new path
  • MCPClient docstring no longer mentions experimental
  • AGENTS.md updated with new directory structure
  • All existing tests pass with updated imports
  • hatch fmt --formatter and hatch fmt --linter pass
  • hatch test passes

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type
No fields configured for issues without a type.

Projects

Status
Just Shipped

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions