Repository navigation
feat: deprecate python_repl, a2a_client, mcp_client, and mem0_memory tools - #621
Conversation
|
@strandly-the-agent Review this PR |
strandly-the-agent
left a comment
There was a problem hiding this comment.
Verdict: changes requested — the code is right; the migration story has three gaps worth closing before merge. No 🔴. The @deprecated-on-class pattern, the legacy TOOL_SPEC wrapping, and every replacement symbol/keyword in the messages check out against strands-agents 1.61.1 and mem0-strands 0.1.1.
🟡 (inline):
pyproject.toml:101—strands-agents[a2a]>=1.0.0on the user-facinga2a-clientextra exists only sotest_migration_import_resolvespasses; it pulls fastapi/starlette/uvicorn onto every installer of a deprecated client tool, and>=1.0.0doesn't guaranteemake_a2a_clientexists anyway.README.md:329—mem0-strandsrequiresmem0ai>=2.0.11; this package'smem0-memoryextra pins<1.0.0, so the two cannot be installed together (verified, resolver error below). The bullet also drops the env-var backend selection (OPENSEARCH_HOST/ FAISS default) without saying so.README.md:318— "routes code through the agent's sandbox" oversells the default: a plainAgentruns the vendedpython_replon the host with no isolation, and the old consent prompt is gone.
✅ Verified (head 965b18b, py3.13, strands-agents 1.61.1, typing_extensions 4.16.0)
ruff format --check+ruff check: clean.pytest tests(excluding browser/code_interpreter/use_computer/shell, which need sandbox deps or a PTY): 1364 passed, 24 skipped. The 5 touched test files: 335 passed, 1 skipped.python_replandmcp_clientload and execute throughAgent(tools=[...])after wrapping;mcp_client.tool_specbyte-identical to main; oneDEPRECATION WARNINGlog per call, none at import.- Class decoration: construction logs once;
.toolsstill yields the threea2a_*tools andAgent(tools=provider.tools)registers them; subclass /copy/picklefine;Mem0MemoryTool.mem0_memory.TOOL_SPECstill reachable. tests/test_deprecations.pyClassDef extension mutation-tested: swapping the class literal for_DEPRECATION_MESSAGEor dropping a marker fails as intended.- README claims vs SDK:
make_a2a_client(allowed_endpoints=…)withdiscover/send_messageand per-endpointClientConfig;make_mcp_router(servers=…)withcall_tool, noload_tools;MemoryManager(stores, add_tool_config=…)→search_memory/add_memory;Mem0MemoryStore(user_id=…, extraction=True)with onlysearch/add/add_messages. All accurate. mypy--enable-error-code deprecatedreports the import line for all five symbols, so README:186 holds. - Resolver check:
uv pip install --dry-run "strands-agents-tools[mem0-memory]" mem0-strands→ No solution found … mem0-strands depends on mem0ai>=2.0.11 and strands-agents-tools[mem0-memory] depends on mem0ai>=0.1.99,<1.0.0.
Questions (non-blocking)
- The README never says which
strands-agentsrelease ships the vended replacements (the PR body says 1.61.0; the package floor is>=1.0.0). Pre-existing for the #604 rows, but this PR adds three more — worth one sentence in the Deprecations intro?
Reading order
pyproject.toml → README.md (Deprecations table + behaviour bullets) → src/strands_tools/a2a_client.py / mem0_memory.py (the two class sites) → tests/test_deprecations.py. The mcp_client.py / python_repl.py hunks are the established #604 shape.
Appendix — non-blocking (7)
- ⚪
README.md:180says each tool "logs a warning when invoked"; forA2AClientToolProvider/Mem0MemoryToolit is on construction. - ⚪
README.md:186-187says mypy reports "thefrom strands_tools import ...line"; for the two classes it isfrom strands_tools.a2a_client import …/from strands_tools.mem0_memory import …. "the import line" covers both. - ⚪
mem0_memory.py:722-726—Mem0MemoryTool's literal says "mem0_memory is deprecated" (mypy printsclass …Mem0MemoryTool is deprecated: mem0_memory is deprecated);a2a_client.py:56names its class. Only if the shared-constant test tolerates a second constant. - ⚪ On py3.10–3.12
inspect.signature(A2AClientToolProvider)degrades to(*args, **kwargs)becausetyping_extensions.deprecatedinstalls a__new__(CPython <3.13 prefers it over__init__). Affectshelp()/autodoc only; mypy/pyright/IDE unaffected. Not worth changing on a class slated for removal. - ⚪ Under
-W error::DeprecationWarningthe class raises from__new__before__init__, so thelogger.warningnever fires — user gets the exception with the full message instead. Same bucket as the sync-toolcategory=Nonecall deferred in #566; noting, not re-raising. - ⚪ Two
ruff formatreflows unrelated to the deprecation:mem0_memory.py:952-955,tests/test_mem0.py:620-623. - Pre-existing, not filed (tool is being deprecated): the docstring example
Agent(tools=[tool.mem0_memory])atmem0_memory.py:751registers nothing on strands-agents 1.61.1 (unrecognized tool specification); identical onmain, the class decorator doesn't change it. Likewise mypy flags the README'sAgent(tools=provider.tools)with[arg-type].
|
@strandly-the-agent Review this PR |
strandly-the-agent
left a comment
There was a problem hiding this comment.
Approve — all three 🟡 from my previous review are fixed in 4f27431, and the fixes hold up.
pyproject.toml— fixed.strands-agents[a2a]is off the user-facinga2a-clientextra and pinned>=1.61.0inhatch-test.extra-dependencies, which is the env CI runs (hatch test tests --cover,test-lint.yml:67). Resolves on py3.10 (strands-agents 1.61.1 isRequires-Python >=3.10).README.mdmem0 bullet — fixed. Now states themem0ai2.x conflict ("drop themem0-memoryextra first") and that backend env vars don't carry over withoutMEM0_API_KEY. Both claims re-checked againstmem0-strands0.1.1.README.mdpython_repl bullet — fixed. Host-by-default + removed consent prompt are now explicit;DockerSandboxexists atstrands.sandbox.docker.DockerSandboxin 1.61.1.
The two ⚪ README items (warn-on-construction wording, "the import line") were taken too. Nothing new introduced.
✅ Verified (head 4f27431, py3.13, strands-agents 1.61.1)
- Delta since 965b18b is README.md + pyproject.toml only (
git diff 965b18b..4f27431 --stat: 2 files, +15/−15). ruff format --check+ruff check: clean.pytest tests/test_deprecations.py tests/test_a2a_client.py tests/test_mcp_client.py tests/test_mem0.py tests/test_python_repl.py: 335 passed, 1 skipped.uv pip install --dry-run "strands-agents[a2a]>=1.61.0" "a2a-sdk[sql]>=0.3.0,<0.4.0"in a py3.10 venv → resolves to strands-agents 1.61.1.
Description
Deprecated
python_repl,a2a_client,mcp_client, andmem0_memory. These tools now log a warning naming where to go instead during static analysis and runtime. Warnings ship in v0.8.10 and become error logs in v0.9.0.python_replpython_repla2a_client(A2AClientToolProvider)make_a2a_clientmcp_clientmake_mcp_routermem0_memory(mem0_memory,Mem0MemoryTool)Mem0MemoryStorefrom mem0-strands +MemoryManagerThe replacements are deliberately not all one-for-one. The vended
a2a_clientandmcp_routerrequire a developer-set allowlist (allowed_endpoints/servers) instead of letting the model reach arbitrary endpoints or launch arbitrary commands,python_replruns each call in a fresh interpreter through the agent's sandbox, andMem0MemoryStorehas no equivalent forget,list,delete, orhistory. The README's behavior differences section calls out each gap.A2AClientToolProviderandMem0MemoryToolare the first deprecated classes, so they log on construction rather than invocation, andtest_deprecations.pynow accepts@deprecatedon aClassDef.Related Issues
Follows #604.
Type of Change
Other (please describe): Deprecation of existing tools
Testing
hatch run prepareChecklist
On the last two: this intentionally adds deprecation warnings, which is its purpose. No dependent changes are required — the vended
python_repl,make_a2a_client, andmake_mcp_routership instrands-agents1.61.0, andmem0-strandsis published on PyPI by Mem0.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.