You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The docs and examples still use the deprecated code_interpreter() and local_code_interpreter() helpers instead of python_tool(). PR #1271 updated docs/examples/tools/README.md and python_tool_example.py, but three files still reference the deprecated functions:
docs/examples/tools/interpreter_example.py — uses code_interpreter / local_code_interpreter throughout (the runnable companion to the README that fix: address default execution tier security posture #1271 changed, so the two now diverge)
docs/docs/how-to/tools-and-agents.md — lines ~114–162 and ~264–274
docs/examples/tools/README.md — "Tool with LLM" / "Forcing Tool Use" / "Validating" examples and the "Available Tools" list still name both deprecated functions
Both code_interpreter() and local_code_interpreter() emit DeprecationWarning and point at python_tool() (mellea/stdlib/tools/interpreter.py:1199-1244). The docs should demonstrate the supported API.
Why this is more than a rename
python_tool() is not a drop-in substitution for the deprecated callables — the migration touches four things:
Aspect
Deprecated
python_tool
Import
code_interpreter, local_code_interpreter
python_tool
Wrapping
MelleaTool.from_callable(local_code_interpreter)
python_tool(tier="local_unsafe") — already a MelleaTool
Direct call
code_interpreter("print(1+1)")
tool.run(code="print(1+1)") → ExecutionResult
Tool-call key & uses_tool arg
"local_code_interpreter" / the callable
"python" (default name=) or your name=; the name string, not the object
Two caveats that block a naive find-replace:
uses_tool(tool) / tool_arg_validator(tool_name=tool) cannot take the MelleaTool object._name2str (mellea/stdlib/requirements/tool_reqs.py:16) accepts only a str or a callable with __name__; a MelleaTool instance hits the case _ → TypeError. Pass the tool's name string instead.
frommellea.stdlib.toolsimportpython_tool# create once, reuse the name in requirements and lookupstool=python_tool(tier="local_unsafe", name="python")
# direct, no LLM:result=tool.run(code="print(1 + 1)")
# force + validate:m.instruct(
description="Use the code interpreter tool to make a plot of y=x^2.",
requirements=[uses_tool("python")], # name string, not the objectmodel_options={ModelOption.TOOLS: [tool]},
tool_calls=True,
)
code=response.tool_calls["python"].args["code"]
Note: the README examples just changed in #1271 will need a second pass so their tool_calls[...] keys and uses_tool(...) args use "python" rather than "local_code_interpreter".
Acceptance criteria
docs/examples/tools/interpreter_example.py migrated to python_tool (passes its # pytest: ollama, e2e run)
Problem
The docs and examples still use the deprecated
code_interpreter()andlocal_code_interpreter()helpers instead ofpython_tool(). PR #1271 updateddocs/examples/tools/README.mdandpython_tool_example.py, but three files still reference the deprecated functions:docs/examples/tools/interpreter_example.py— usescode_interpreter/local_code_interpreterthroughout (the runnable companion to the README that fix: address default execution tier security posture #1271 changed, so the two now diverge)docs/docs/how-to/tools-and-agents.md— lines ~114–162 and ~264–274docs/examples/tools/README.md— "Tool with LLM" / "Forcing Tool Use" / "Validating" examples and the "Available Tools" list still name both deprecated functionsBoth
code_interpreter()andlocal_code_interpreter()emitDeprecationWarningand point atpython_tool()(mellea/stdlib/tools/interpreter.py:1199-1244). The docs should demonstrate the supported API.Why this is more than a rename
python_tool()is not a drop-in substitution for the deprecated callables — the migration touches four things:python_toolcode_interpreter,local_code_interpreterpython_toolMelleaTool.from_callable(local_code_interpreter)python_tool(tier="local_unsafe")— already aMelleaToolcode_interpreter("print(1+1)")tool.run(code="print(1+1)")→ExecutionResultuses_toolarg"local_code_interpreter"/ the callable"python"(defaultname=) or yourname=; the name string, not the objectTwo caveats that block a naive find-replace:
uses_tool(tool)/tool_arg_validator(tool_name=tool)cannot take theMelleaToolobject._name2str(mellea/stdlib/requirements/tool_reqs.py:16) accepts only astror a callable with__name__; aMelleaToolinstance hits thecase _→TypeError. Pass the tool's name string instead.python_tool()emits the newUserWarningfrom fix: address default execution tier security posture #1271 unlesstier=is passed explicitly. Passingtier="local_unsafe"is exactly the conscious trust decision fix: address default execution tier security posture #1271 introduced, so the migrated examples should pass it explicitly — turning the examples into a demonstration of the new contract.Suggested shape
Note: the README examples just changed in #1271 will need a second pass so their
tool_calls[...]keys anduses_tool(...)args use"python"rather than"local_code_interpreter".Acceptance criteria
docs/examples/tools/interpreter_example.pymigrated topython_tool(passes its# pytest: ollama, e2erun)docs/docs/how-to/tools-and-agents.mdmigrated;markdownlint-cli2cleandocs/examples/tools/README.mdmigrated (tool-call keys +uses_toolargs use the name string; "Available Tools" list updated)code_interpreter/local_code_interpreterindocs/except where intentionally documenting the deprecationUserWarningContext
Follow-up to #1271, which deliberately kept its scope to the security-posture warnings. Surfaced during review of that PR.