Repository navigation
feat: deprecate sleep, editor, and shell in favor of SDK vended tools - #550
Conversation
The Strands SDK now vends equivalents of these tools from strands.vended_tools. Maintaining both implementations invites drift, where a fix applied in one place silently does not apply in the other. Each tool logs a warning on invocation naming its replacement, so users get the signal at the point of use rather than only in release notes. Warnings ship in v0.8.6 and the tools are removed in v0.9.0. http_request is deliberately excluded: the SDK version cannot yet do HTML-to-markdown conversion, so deprecating it now would point users at a replacement that does not cover their use case. Co-Authored-By: Claude <[email protected]>
|
Dependency: this PR's |
These tools are the first of an incremental set of deprecations that ends with this repository being archived. Deleting them in 0.9.0 would break users mid-migration and give them an ImportError with no hint about where the replacement lives. Instead the tools keep working and the warning becomes an error log in 0.9.0 — a louder signal that still carries the migration path. The README now states the archive plan so users can weigh migrating early. Co-Authored-By: Claude <[email protected]>
|
@mehtarac @liramon2 — heads up that the semantics changed after your approvals, so this is worth a second look. Before: these tools were deleted in v0.9.0. The reasoning: these three are the first of an incremental set of deprecations that ends with this repo being archived. Removing them in 0.9.0 would break users mid-migration and give them an Changed in 5aff9eb: message wording in all three tools, the README table ( @mehtarac this also answers your timeline question more usefully — since nothing is deleted at 0.9.0, the exact release date stops being a hard deadline for users. |
Adopts the decorator prescribed by the SDK's FEATURE_LIFECYCLE.md so type checkers and IDEs flag call sites before anything runs. Kept alongside the existing log message rather than replacing it. Python's default warning filter only surfaces DeprecationWarning raised from __main__, and the agent invokes tools from inside SDK internals, so the decorator alone produces no output for the users this targets. The decorator covers static analysis and -W error; the log covers runtime. Bumps the typing_extensions floor to 4.5.0, which is where the decorator was introduced. Co-Authored-By: Claude <[email protected]>
Description
The Strands SDK now vends equivalents of
sleep,editor, andshellfromstrands.vended_tools. Maintaining both implementations invites drift, where a fix applied in one place silently does not apply in the other. This adds a deprecation warning to each tool pointing at its SDK replacement, and documents the migration in the README.Each tool logs a warning on invocation, so users get the signal at the point of use rather than only in release notes. This follows the existing precedent in
use_llm.pyandagent_graph.pyrather thanDeprecationWarning, which would break consumers running with-W error.sleepstrands.vended_tools.sleepeditorstrands.vended_tools.file_editorshellstrands.vended_tools.shellThe tools are not removed. In v0.9.0 the same message is logged at
errorlevel instead ofwarning— a louder signal for anyone who has not migrated, with no behavior change. These tools are the first of an incremental set of deprecations that ends with this repository being archived, so deleting them in 0.9.0 would break users mid-migration and hand them anImportErrorwith no hint about where the replacement lives. The README states the archive plan so users can decide whether to migrate early.Scope notes
The replacements are not drop-in equivalents, so the README states the gaps rather than implying a clean swap: the SDK
shellis stateless and sandbox-routed with no PTY or command batching;file_editorlackspattern_replace/find_line/undo_edit; and SDKsleepconfigures its cap viamake_sleep(max_duration=...)instead ofMAX_SLEEP_SECONDS.http_requestis deliberately excluded. The SDK version is a thin httpx shim without HTML-to-markdown conversion, so deprecating it now would point users at a replacement that does not cover their use case. It should be revisited onceweb_fetch(harness-sdk #3375) merges and ships.Dependency
The
shellmigration message namesstrands.vended_tools.shell, which does not exist yet — the SDK tool is currently calledbash. That name is inaccurate: it delegates toSandbox.execute(), which runssh -cin the Docker and local sandboxes and the remote login shell over SSH, so it invokes whichever shell the sandbox provides rather than bash specifically. A companion PR renaming it toshellis required before this ships in a release. If that rename is rejected or lands under a different name, the message here needs updating first.Related Issues
Documentation PR
Type of Change
Other (please describe): Deprecation of existing tools superseded by the SDK
Testing
Added three
caplog-based tests asserting each tool logs its warning and names the correct replacement. Also verified end-to-end that the warnings fire through the realagent.tool.*path, not just direct function calls:The warning is placed before any early return in each tool, so it fires on every invocation including error paths.
hatch run prepareResult: 1285 passed, 1 failed. The failure is
tests/test_agent_core_memory.py::test_initialization, which is pre-existing onmainand unrelated to this change (it asserts a hardcoded region against the localAWS_REGION).tests/test_shell.py::test_command_executor_execute_with_ptyalso terminates the pytest process locally; likewise reproduced on a cleanmaincheckout.Checklist
Note on the last two items: this change intentionally adds deprecation warnings, which is its purpose; it introduces no unintended ones. The dependent SDK rename described above is not yet merged.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.