-
Notifications
You must be signed in to change notification settings - Fork 832
feat: add vended tools — shell, editor, python_repl (2/N) #2215
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
agent-of-mkmeral
wants to merge
7
commits into
strands-agents:feature/sandbox
Choose a base branch
from
agent-of-mkmeral:feat/sandbox-vended-tools
base: feature/sandbox
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
19ea55d
feat: add vended tools — shell, editor, python_repl (2/N)
agent-of-mkmeral c62a68d
refactor: address review feedback — flatten modules, split tests, fix…
agent-of-mkmeral 8fc6d8b
fix: filter CWD marker from streamed output, remove dead except blocks
strands-agent 9b25238
refactor: one-chunk-behind streaming for CWD marker filtering
agent-of-mkmeral ba8d70d
fix: resolve 6 adversarial testing findings in vended tools
agent-of-mkmeral f21618f
refactor: restore real-time streaming with marker-aware buffer
strands-agent 1a46e0f
fix: add timeout coercion to python_repl (matching shell.py fix)
agent-of-mkmeral File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| """Vended tools for Strands agents. | ||
|
|
||
| These are production-ready tools that ship with the SDK and integrate | ||
| with the :class:`~strands.sandbox.base.Sandbox` abstraction. They work | ||
| transparently whether the agent uses a local :class:`~strands.sandbox.host.HostSandbox` | ||
| or a remote sandbox implementation. | ||
|
|
||
| Each tool reads its configuration from ``tool_context.agent.state`` using | ||
| a namespaced key (e.g., ``strands_shell_tool``). This means configuration | ||
| persists across tool calls and survives session serialization. | ||
|
|
||
| Available tools: | ||
|
|
||
| - :func:`~strands.vended_tools.shell.shell` — Execute shell commands | ||
| - :func:`~strands.vended_tools.editor.editor` — View, create, and edit files | ||
| - :func:`~strands.vended_tools.python_repl.python_repl` — Execute Python code | ||
|
|
||
| Example:: | ||
|
|
||
| from strands import Agent | ||
| from strands.vended_tools import shell, editor, python_repl | ||
|
|
||
| agent = Agent(tools=[shell, editor, python_repl]) | ||
|
|
||
| # Configure tools via agent state (persists across calls) | ||
| agent.state.set("strands_shell_tool", { | ||
| "timeout": 60, | ||
| }) | ||
| """ | ||
|
|
||
| from .editor import editor | ||
| from .python_repl import python_repl | ||
| from .shell import shell | ||
|
|
||
| __all__ = [ | ||
| "editor", | ||
| "python_repl", | ||
| "shell", | ||
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| """File editor tool for viewing, creating, and editing files in the agent's sandbox. | ||
|
|
||
| Example:: | ||
|
|
||
| from strands import Agent | ||
| from strands.vended_tools import editor | ||
|
|
||
| agent = Agent(tools=[editor]) | ||
| agent("View the contents of /tmp/example.py") | ||
|
|
||
| Configuration via agent state:: | ||
|
|
||
| agent.state.set("strands_editor_tool", { | ||
| "max_file_size": 1048576, # Maximum file size in bytes (default: 1MB) | ||
| }) | ||
| """ | ||
|
|
||
| from .editor import editor | ||
|
|
||
| __all__ = ["editor"] | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.