Skip to content
This repository was archived by the owner on Nov 4, 2026. It is now read-only.

feat: deprecate python_repl, a2a_client, mcp_client, and mem0_memory tools - #621

Merged
liramon2 merged 3 commits into
strands-agents:mainfrom
liramon2:deprecation-2
Oct 20, 2026
Merged

liramon2 merged 3 commits into
strands-agents:mainfrom
liramon2:deprecation-2

Conversation

@liramon2

Copy link
Copy Markdown
Contributor

Description

Deprecated python_repl, a2a_client, mcp_client, and mem0_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.

Tool module Points at Kind
python_repl vended python_repl SDK Tool
a2a_client (A2AClientToolProvider) vended make_a2a_client SDK Tool
mcp_client vended make_mcp_router SDK Tool
mem0_memory (mem0_memory, Mem0MemoryTool) Mem0MemoryStore from mem0-strands + MemoryManager Memory store

The replacements are deliberately not all one-for-one. The vended a2a_client and mcp_router require a developer-set allowlist (allowed_endpoints / servers) instead of letting the model reach arbitrary endpoints or launch arbitrary commands, python_repl runs each call in a fresh interpreter through the agent's sandbox, and Mem0MemoryStore has no equivalent for get, list, delete, or history. The README's behavior differences section calls out each gap.

A2AClientToolProvider and Mem0MemoryTool are the first deprecated classes, so they log on construction rather than invocation, and test_deprecations.py now accepts @deprecated on a ClassDef.

Related Issues

Follows #604.

Type of Change

Other (please describe): Deprecation of existing tools

Testing

  • I ran hatch run prepare

Checklist

  • I have read the CONTRIBUTING document
  • I have added any necessary tests that prove my fix is effective or my feature works
  • I have updated the documentation accordingly
  • I have added an appropriate example to the documentation to outline the feature
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

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, and make_mcp_router ship in strands-agents 1.61.0, and mem0-strands is 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.

@liramon2
liramon2 requested a review from a team as a code owner October 15, 2026 19:51
@liramon2
liramon2 requested a review from pgrayy October 15, 2026 19:51
@liramon2
liramon2 deployed to auto-approve October 15, 2026 19:52 — with GitHub Actions Active
@liramon2
liramon2 deployed to auto-approve October 15, 2026 20:13 — with GitHub Actions Active
@liramon2

Copy link
Copy Markdown
Contributor Author

@strandly-the-agent Review this PR

@strandly-the-agent strandly-the-agent left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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):

  1. pyproject.toml:101 — strands-agents[a2a]>=1.0.0 on the user-facing a2a-client extra exists only so test_migration_import_resolves passes; it pulls fastapi/starlette/uvicorn onto every installer of a deprecated client tool, and >=1.0.0 doesn't guarantee make_a2a_client exists anyway.
  2. README.md:329 — mem0-strands requires mem0ai>=2.0.11; this package's mem0-memory extra 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.
  3. README.md:318 — "routes code through the agent's sandbox" oversells the default: a plain Agent runs the vended python_repl on 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_repl and mcp_client load and execute through Agent(tools=[...]) after wrapping; mcp_client.tool_spec byte-identical to main; one DEPRECATION WARNING log per call, none at import.
  • Class decoration: construction logs once; .tools still yields the three a2a_* tools and Agent(tools=provider.tools) registers them; subclass / copy / pickle fine; Mem0MemoryTool.mem0_memory.TOOL_SPEC still reachable.
  • tests/test_deprecations.py ClassDef extension mutation-tested: swapping the class literal for _DEPRECATION_MESSAGE or dropping a marker fails as intended.
  • README claims vs SDK: make_a2a_client(allowed_endpoints=…) with discover/send_message and per-endpoint ClientConfig; make_mcp_router(servers=…) with call_tool, no load_tools; MemoryManager(stores, add_tool_config=…) → search_memory/add_memory; Mem0MemoryStore(user_id=…, extraction=True) with only search/add/add_messages. All accurate. mypy --enable-error-code deprecated reports 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-agents release 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:180 says each tool "logs a warning when invoked"; for A2AClientToolProvider / Mem0MemoryTool it is on construction.
  • ⚪ README.md:186-187 says mypy reports "the from strands_tools import ... line"; for the two classes it is from 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 prints class …Mem0MemoryTool is deprecated: mem0_memory is deprecated); a2a_client.py:56 names its class. Only if the shared-constant test tolerates a second constant.
  • ⚪ On py3.10–3.12 inspect.signature(A2AClientToolProvider) degrades to (*args, **kwargs) because typing_extensions.deprecated installs a __new__ (CPython <3.13 prefers it over __init__). Affects help()/autodoc only; mypy/pyright/IDE unaffected. Not worth changing on a class slated for removal.
  • ⚪ Under -W error::DeprecationWarning the class raises from __new__ before __init__, so the logger.warning never fires — user gets the exception with the full message instead. Same bucket as the sync-tool category=None call deferred in #566; noting, not re-raising.
  • ⚪ Two ruff format reflows 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]) at mem0_memory.py:751 registers nothing on strands-agents 1.61.1 (unrecognized tool specification); identical on main, the class decorator doesn't change it. Likewise mypy flags the README's Agent(tools=provider.tools) with [arg-type].

Comment thread pyproject.toml Resolved
Comment thread README.md Resolved
Comment thread README.md Resolved
@liramon2
liramon2 deployed to auto-approve October 16, 2026 00:01 — with GitHub Actions Active
@liramon2

Copy link
Copy Markdown
Contributor Author

@strandly-the-agent Review this PR

@strandly-the-agent strandly-the-agent left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-facing a2a-client extra and pinned >=1.61.0 in hatch-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 is Requires-Python >=3.10).
  • README.md mem0 bullet — fixed. Now states the mem0ai 2.x conflict ("drop the mem0-memory extra first") and that backend env vars don't carry over without MEM0_API_KEY. Both claims re-checked against mem0-strands 0.1.1.
  • README.md python_repl bullet — fixed. Host-by-default + removed consent prompt are now explicit; DockerSandbox exists at strands.sandbox.docker.DockerSandbox in 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.

@liramon2
liramon2 merged commit f3c06ad into strands-agents:main Oct 20, 2026
19 checks passed

This branch was successfully deployed

1 active deployment
auto-approve — 4f27431d Deployed Oct 16, 2026 by liramon2 via check-access-and-checkout #623
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants