generated from amazon-archives/__template_Apache-2.0
-
Notifications
You must be signed in to change notification settings - Fork 199
feat(tools): add use_browser tool to Strands tools repository #102
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
Merged
Merged
Changes from 17 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
b0c55a8
feat(tools): add use_browser tool to Strands tools repository
jimbrub cd481da
test(use_browser): add more unit testing for use_browser tool
jimbrub 24c8f69
feat(tools): add retry and multi-tab support to use_browser tool
jimbrub a6338ce
feat: add more retry logic and environment variables
jimbrub e188713
fix(use_browser): fix screenshot error and using Playwright specific …
jimbrub b679d34
fix(use_browser): fix logs and fix how actions are being called, now …
jimbrub 11c2281
fix(use_browser): fix merge conflicts in README file
jimbrub 65aeb9e
Delete src/strands_tools/use_computer.py
jimbrub dd8988c
test(use_browser): add more unit testing for use_browser tool
jimbrub 4b9961c
Update use_browser.py
jimbrub 139e201
test(use_browser): add more unit testing for use_browser tool
jimbrub c3793ba
fix(use_browser): fix merge conflicts in README file
jimbrub cef17cd
feat(use_browser): Added BrowserApiMethods class which has all the br…
jimbrub a2b871d
feat: Updating readme and pyproject.toml
jimbrub d0e981f
feat: Adding use_browser tool
jimbrub c8be34b
fix: fixing README file
jimbrub fa928d4
fix: fixing dependencies for testing
jimbrub 3896e3a
fix: cleaning logs and updating README file
jimbrub 73bcc90
fix: fixing log statements to pass all checks
jimbrub 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 |
|---|---|---|
|
|
@@ -53,7 +53,9 @@ Strands Agents Tools provides a powerful set of tools for your agents to use. It | |
| - 🧠 **Advanced Reasoning** - Tools for complex thinking and reasoning capabilities | ||
| - 🐝 **Swarm Intelligence** - Coordinate multiple AI agents for parallel problem solving with shared memory | ||
| - 🔄 **Multiple tools in Parallel** - Call multiple other tools at the same time in parallel with Batch Tool | ||
|
|
||
| - 🔄 **Multiple tools in Parallel** - Call multiple other tools at the same time in parallel with Batch Tool | ||
| - 🔍 **Browser Tool** - Tool giving an agent access to perform automated actions on a browser (chromium) | ||
|
|
||
| ## 📦 Installation | ||
|
|
||
| ### Quick Install | ||
|
|
@@ -121,6 +123,7 @@ Below is a comprehensive table of all available tools, how to use them with an a | |
| | use_llm | `agent.tool.use_llm(prompt="Analyze this data", system_prompt="You are a data analyst")` | Create nested AI loops with customized system prompts for specialized tasks | | ||
| | workflow | `agent.tool.workflow(action="create", name="data_pipeline", steps=[{"tool": "file_read"}, {"tool": "python_repl"}])` | Define, execute, and manage multi-step automated workflows | | ||
| | batch| `agent.tool.batch(invocations=[{"name": "current_time", "arguments": {"timezone": "Europe/London"}}, {"name": "stop", "arguments": {}}])` | Call multiple other tools in parallel. | | ||
| | use_browser | `agent.tool.use_browser(action="navigate", url="https://www.example.com") ` | Web scraping, automated testing, form filling, web automation tasks | | ||
|
|
||
| \* *These tools do not work on windows* | ||
|
|
||
|
|
@@ -301,6 +304,32 @@ result = agent.tool.batch( | |
| ) | ||
| ``` | ||
|
|
||
| ### Use Browser | ||
| ```python | ||
| from strands import Agent | ||
| from strands_tools import use_browser | ||
|
|
||
| agent = Agent(tools=[use_browser]) | ||
|
|
||
| # Simple navigation | ||
| result = agent.tool.use_browser(action="navigate", url="https://example.com") | ||
|
|
||
| # Sequential actions for form filling | ||
| result = agent.tool.use_browser(actions=[ | ||
| {"action": "navigate", "args": {"url": "https://example.com/login"}}, | ||
| {"action": "type", "args": {"selector": "#username", "text": "[email protected]"}}, | ||
| {"action": "click", "args": {"selector": "#submit"}} | ||
| ]) | ||
|
|
||
| # Web scraping with content extraction | ||
| result = agent.tool.use_browser(actions=[ | ||
| {"action": "navigate", "args": {"url": "https://example.com/data"}}, | ||
| {"action": "get_text", "args": {"selector": ".content"}}, | ||
| {"action": "click", "args": {"selector": ".next-page"}}, | ||
| {"action": "get_html", "args": {"selector": "main"}} | ||
| ]) | ||
| ``` | ||
|
|
||
| ## 🌍 Environment Variables Configuration | ||
|
|
||
| Agents Tools provides extensive customization through environment variables. This allows you to configure tool behavior without modifying code, making it ideal for different environments (development, testing, production). | ||
|
|
@@ -443,6 +472,20 @@ The Mem0 Memory Tool supports three different backend configurations: | |
| | FILE_READ_USE_GIT_DEFAULT | Default setting for using git in time machine mode | true | | ||
| | FILE_READ_NUM_REVISIONS_DEFAULT | Default number of revisions to show in time machine mode | 5 | | ||
|
|
||
| #### Use Browser Tool | ||
|
|
||
| | Environment Variable | Description | Default | | ||
| |----------------------|-------------|---------| | ||
| | STRANDS_DEFAULT_WAIT_TIME | Default setting for wait time with actions | 1 | | ||
| | STRANDS_BROWSER_MAX_RETRIES | Default number of retries to perform when an action fails | 3 | | ||
| | STRANDS_BROWSER_RETRY_DELAY | Default retry delay time for retry mechanisms | 1 | | ||
| | STRANDS_BROWSER_SCREENSHOTS_DIR | Default directory where screenshots will be saved | screenshots | | ||
| | STRANDS_BROWSER_USER_DATA_DIR | Default directory where data for reloading a browser instance is stored | ~/.browser_automation | | ||
| | STRANDS_BROWSER_HEADLESS | Default headless setting for launching browsers | false | | ||
| | STRANDS_BROWSER_WIDTH | Default width of the browser | 1280 | | ||
| | STRANDS_BROWSER_HEIGHT | Default height of the browser | 800 | | ||
|
|
||
|
|
||
| ## Contributing ❤️ | ||
|
|
||
| We welcome contributions! See our [Contributing Guide](CONTRIBUTING.md) for details on: | ||
|
|
||
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
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.