strands-agents-tools 0.2.18__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. strands_agents_tools-0.2.18.dist-info/METADATA +1327 -0
  2. strands_agents_tools-0.2.18.dist-info/RECORD +77 -0
  3. strands_agents_tools-0.2.18.dist-info/WHEEL +4 -0
  4. strands_agents_tools-0.2.18.dist-info/licenses/LICENSE +175 -0
  5. strands_agents_tools-0.2.18.dist-info/licenses/NOTICE +1 -0
  6. strands_tools/__init__.py +0 -0
  7. strands_tools/a2a_client.py +353 -0
  8. strands_tools/agent_core_memory.py +501 -0
  9. strands_tools/agent_graph.py +663 -0
  10. strands_tools/batch.py +173 -0
  11. strands_tools/bright_data.py +508 -0
  12. strands_tools/browser/__init__.py +87 -0
  13. strands_tools/browser/agent_core_browser.py +100 -0
  14. strands_tools/browser/browser.py +972 -0
  15. strands_tools/browser/local_chromium_browser.py +90 -0
  16. strands_tools/browser/models.py +305 -0
  17. strands_tools/calculator.py +778 -0
  18. strands_tools/chat_video.py +377 -0
  19. strands_tools/code_interpreter/__init__.py +34 -0
  20. strands_tools/code_interpreter/agent_core_code_interpreter.py +498 -0
  21. strands_tools/code_interpreter/code_interpreter.py +333 -0
  22. strands_tools/code_interpreter/models.py +142 -0
  23. strands_tools/cron.py +248 -0
  24. strands_tools/current_time.py +50 -0
  25. strands_tools/diagram.py +1177 -0
  26. strands_tools/editor.py +807 -0
  27. strands_tools/elasticsearch_memory.py +732 -0
  28. strands_tools/environment.py +764 -0
  29. strands_tools/exa.py +570 -0
  30. strands_tools/file_read.py +1248 -0
  31. strands_tools/file_write.py +291 -0
  32. strands_tools/generate_image.py +280 -0
  33. strands_tools/generate_image_stability.py +458 -0
  34. strands_tools/graph.py +694 -0
  35. strands_tools/handoff_to_user.py +224 -0
  36. strands_tools/http_request.py +935 -0
  37. strands_tools/image_reader.py +157 -0
  38. strands_tools/journal.py +385 -0
  39. strands_tools/load_tool.py +218 -0
  40. strands_tools/mcp_client.py +721 -0
  41. strands_tools/mem0_memory.py +850 -0
  42. strands_tools/memory.py +1112 -0
  43. strands_tools/mongodb_memory.py +1190 -0
  44. strands_tools/nova_reels.py +345 -0
  45. strands_tools/python_repl.py +738 -0
  46. strands_tools/retrieve.py +421 -0
  47. strands_tools/rss.py +462 -0
  48. strands_tools/search_video.py +332 -0
  49. strands_tools/shell.py +608 -0
  50. strands_tools/slack.py +746 -0
  51. strands_tools/sleep.py +55 -0
  52. strands_tools/speak.py +194 -0
  53. strands_tools/stop.py +115 -0
  54. strands_tools/swarm.py +494 -0
  55. strands_tools/tavily.py +756 -0
  56. strands_tools/think.py +397 -0
  57. strands_tools/use_agent.py +289 -0
  58. strands_tools/use_aws.py +392 -0
  59. strands_tools/use_computer.py +1086 -0
  60. strands_tools/use_llm.py +213 -0
  61. strands_tools/utils/__init__.py +0 -0
  62. strands_tools/utils/aws_util.py +26 -0
  63. strands_tools/utils/console_util.py +18 -0
  64. strands_tools/utils/data_util.py +25 -0
  65. strands_tools/utils/detect_language.py +40 -0
  66. strands_tools/utils/generate_schema_util.py +278 -0
  67. strands_tools/utils/models/__init__.py +15 -0
  68. strands_tools/utils/models/anthropic.py +16 -0
  69. strands_tools/utils/models/bedrock.py +19 -0
  70. strands_tools/utils/models/litellm.py +15 -0
  71. strands_tools/utils/models/llamaapi.py +15 -0
  72. strands_tools/utils/models/model.py +396 -0
  73. strands_tools/utils/models/ollama.py +16 -0
  74. strands_tools/utils/models/openai.py +16 -0
  75. strands_tools/utils/models/writer.py +16 -0
  76. strands_tools/utils/user_input.py +71 -0
  77. strands_tools/workflow.py +1178 -0
@@ -0,0 +1,1327 @@
1
+ Metadata-Version: 2.4
2
+ Name: strands-agents-tools
3
+ Version: 0.2.18
4
+ Summary: A collection of specialized tools for Strands Agents
5
+ Project-URL: Homepage, https://github.com/strands-agents/tools
6
+ Project-URL: Bug Tracker, https://github.com/strands-agents/tools/issues
7
+ Project-URL: Documentation, https://strandsagents.com/
8
+ Author-email: AWS <opensource@amazon.com>
9
+ License: Apache-2.0
10
+ License-File: LICENSE
11
+ License-File: NOTICE
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: Apache Software License
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Programming Language :: Python :: 3.14
22
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
23
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
24
+ Requires-Python: >=3.10
25
+ Requires-Dist: aiohttp<4.0.0,>=3.8.0
26
+ Requires-Dist: aws-requests-auth<0.5.0,>=0.4.3
27
+ Requires-Dist: botocore<2.0.0,>=1.39.7
28
+ Requires-Dist: dill<0.5.0,>=0.4.0
29
+ Requires-Dist: markdownify<2.0.0,>=1.0.0
30
+ Requires-Dist: pillow<12.0.0,>=11.2.1
31
+ Requires-Dist: prompt-toolkit<4.0.0,>=3.0.51
32
+ Requires-Dist: pyjwt<3.0.0,>=2.10.1
33
+ Requires-Dist: requests<3.0.0,>=2.28.0
34
+ Requires-Dist: rich<15.0.0,>=14.0.0
35
+ Requires-Dist: slack-bolt<2.0.0,>=1.23.0
36
+ Requires-Dist: strands-agents>=1.0.0
37
+ Requires-Dist: sympy<2.0.0,>=1.12.0
38
+ Requires-Dist: tenacity<10.0.0,>=9.1.2
39
+ Requires-Dist: typing-extensions<5.0.0,>=4.0.0
40
+ Requires-Dist: tzdata; platform_system == 'Windows'
41
+ Requires-Dist: watchdog<7.0.0,>=6.0.0
42
+ Provides-Extra: a2a-client
43
+ Requires-Dist: a2a-sdk[sql]<0.4.0,>=0.3.0; extra == 'a2a-client'
44
+ Provides-Extra: agent-core-browser
45
+ Requires-Dist: bedrock-agentcore==0.1.0; extra == 'agent-core-browser'
46
+ Requires-Dist: nest-asyncio<2.0.0,>=1.5.0; extra == 'agent-core-browser'
47
+ Requires-Dist: playwright<2.0.0,>=1.42.0; extra == 'agent-core-browser'
48
+ Provides-Extra: agent-core-code-interpreter
49
+ Requires-Dist: bedrock-agentcore==0.1.0; extra == 'agent-core-code-interpreter'
50
+ Provides-Extra: build
51
+ Requires-Dist: hatch<1.16.0,>=1.0.0; extra == 'build'
52
+ Provides-Extra: dev
53
+ Requires-Dist: commitizen<5.0.0,>=4.4.0; extra == 'dev'
54
+ Requires-Dist: hatch<1.16.0,>=1.0.0; extra == 'dev'
55
+ Requires-Dist: mem0ai<1.0.0,>=0.1.104; extra == 'dev'
56
+ Requires-Dist: mypy<1.0.0,>=0.981; extra == 'dev'
57
+ Requires-Dist: nest-asyncio<2.0.0,>=1.5.0; extra == 'dev'
58
+ Requires-Dist: opensearch-py<3.0.0,>=2.8.0; extra == 'dev'
59
+ Requires-Dist: playwright<2.0.0,>=1.42.0; extra == 'dev'
60
+ Requires-Dist: pre-commit<4.2.0,>=3.2.0; extra == 'dev'
61
+ Requires-Dist: pytest<9.0.0,>=8.0.0; extra == 'dev'
62
+ Requires-Dist: responses<1.0.0,>=0.6.1; extra == 'dev'
63
+ Requires-Dist: ruff<0.14.0,>=0.13.0; extra == 'dev'
64
+ Requires-Dist: twelvelabs<1.0.0,>=0.4.0; extra == 'dev'
65
+ Provides-Extra: diagram
66
+ Requires-Dist: diagrams<1.0.0,>=0.23.0; extra == 'diagram'
67
+ Requires-Dist: graphviz<1.0.0,>=0.20.0; extra == 'diagram'
68
+ Requires-Dist: matplotlib<4.0.0,>=3.5.0; extra == 'diagram'
69
+ Requires-Dist: networkx<4.0.0,>=2.8.0; extra == 'diagram'
70
+ Provides-Extra: docs
71
+ Requires-Dist: sphinx-autodoc-typehints<2.0.0,>=1.12.0; extra == 'docs'
72
+ Requires-Dist: sphinx-rtd-theme<2.0.0,>=1.0.0; extra == 'docs'
73
+ Requires-Dist: sphinx<6.0.0,>=5.0.0; extra == 'docs'
74
+ Provides-Extra: elasticsearch-memory
75
+ Requires-Dist: elasticsearch<9.0.0,>=8.0.0; extra == 'elasticsearch-memory'
76
+ Provides-Extra: local-chromium-browser
77
+ Requires-Dist: nest-asyncio<2.0.0,>=1.5.0; extra == 'local-chromium-browser'
78
+ Requires-Dist: playwright<2.0.0,>=1.42.0; extra == 'local-chromium-browser'
79
+ Provides-Extra: mem0-memory
80
+ Requires-Dist: mem0ai<1.0.0,>=0.1.99; extra == 'mem0-memory'
81
+ Requires-Dist: opensearch-py<3.0.0,>=2.8.0; extra == 'mem0-memory'
82
+ Provides-Extra: mongodb-memory
83
+ Requires-Dist: pymongo<5.0.0,>=4.0.0; extra == 'mongodb-memory'
84
+ Provides-Extra: rss
85
+ Requires-Dist: feedparser<7.0.0,>=6.0.10; extra == 'rss'
86
+ Requires-Dist: html2text<2021.0.0,>=2020.1.16; extra == 'rss'
87
+ Provides-Extra: twelvelabs
88
+ Requires-Dist: twelvelabs<1.0.0,>=0.4.0; extra == 'twelvelabs'
89
+ Provides-Extra: use-computer
90
+ Requires-Dist: opencv-python<5.0.0,>=4.5.0; extra == 'use-computer'
91
+ Requires-Dist: psutil<6.0.0,>=5.8.0; extra == 'use-computer'
92
+ Requires-Dist: pyautogui<1.0.0,>=0.9.53; extra == 'use-computer'
93
+ Requires-Dist: pytesseract<1.0.0,>=0.3.8; extra == 'use-computer'
94
+ Description-Content-Type: text/markdown
95
+
96
+ <div align="center">
97
+ <div>
98
+ <a href="https://strandsagents.com">
99
+ <img src="https://strandsagents.com/latest/assets/logo-github.svg" alt="Strands Agents" width="55px" height="105px">
100
+ </a>
101
+ </div>
102
+
103
+ <h1>
104
+ Strands Agents Tools
105
+ </h1>
106
+
107
+ <h2>
108
+ A model-driven approach to building AI agents in just a few lines of code.
109
+ </h2>
110
+
111
+ <div align="center">
112
+ <a href="https://github.com/strands-agents/tools/graphs/commit-activity"><img alt="GitHub commit activity" src="https://img.shields.io/github/commit-activity/m/strands-agents/tools"/></a>
113
+ <a href="https://github.com/strands-agents/tools/issues"><img alt="GitHub open issues" src="https://img.shields.io/github/issues/strands-agents/tools"/></a>
114
+ <a href="https://github.com/strands-agents/tools/pulls"><img alt="GitHub open pull requests" src="https://img.shields.io/github/issues-pr/strands-agents/tools"/></a>
115
+ <a href="https://github.com/strands-agents/tools/blob/main/LICENSE"><img alt="License" src="https://img.shields.io/github/license/strands-agents/tools"/></a>
116
+ <a href="https://pypi.org/project/strands-agents-tools/"><img alt="PyPI version" src="https://img.shields.io/pypi/v/strands-agents-tools"/></a>
117
+ <a href="https://python.org"><img alt="Python versions" src="https://img.shields.io/pypi/pyversions/strands-agents-tools"/></a>
118
+ </div>
119
+
120
+ <p>
121
+ <a href="https://strandsagents.com/">Documentation</a>
122
+ ◆ <a href="https://github.com/strands-agents/samples">Samples</a>
123
+ ◆ <a href="https://github.com/strands-agents/sdk-python">Python SDK</a>
124
+ ◆ <a href="https://github.com/strands-agents/tools">Tools</a>
125
+ ◆ <a href="https://github.com/strands-agents/agent-builder">Agent Builder</a>
126
+ ◆ <a href="https://github.com/strands-agents/mcp-server">MCP Server</a>
127
+ </p>
128
+ </div>
129
+
130
+ Strands Agents Tools is a community-driven project that provides a powerful set of tools for your agents to use. It bridges the gap between large language models and practical applications by offering ready-to-use tools for file operations, system execution, API interactions, mathematical operations, and more.
131
+
132
+ ## ✨ Features
133
+
134
+ - 📁 **File Operations** - Read, write, and edit files with syntax highlighting and intelligent modifications
135
+ - 🖥️ **Shell Integration** - Execute and interact with shell commands securely
136
+ - 🧠 **Memory** - Store user and agent memories across agent runs to provide personalized experiences with both Mem0, Amazon Bedrock Knowledge Bases, Elasticsearch, and MongoDB Atlas
137
+ - 🕸️ **Web Infrastructure** - Perform web searches, extract page content, and crawl websites with Tavily and Exa-powered tools
138
+ - 🌐 **HTTP Client** - Make API requests with comprehensive authentication support
139
+ - 💬 **Slack Client** - Real-time Slack events, message processing, and Slack API access
140
+ - 🐍 **Python Execution** - Run Python code snippets with state persistence, user confirmation for code execution, and safety features
141
+ - 🧮 **Mathematical Tools** - Perform advanced calculations with symbolic math capabilities
142
+ - ☁️ **AWS Integration** - Seamless access to AWS services
143
+ - 🖼️ **Image Processing** - Generate and process images for AI applications
144
+ - 🎥 **Video Processing** - Use models and agents to generate dynamic videos
145
+ - 🎙️ **Audio Output** - Enable models to generate audio and speak
146
+ - 🔄 **Environment Management** - Handle environment variables safely
147
+ - 📝 **Journaling** - Create and manage structured logs and journals
148
+ - ⏱️ **Task Scheduling** - Schedule and manage cron jobs
149
+ - 🧠 **Advanced Reasoning** - Tools for complex thinking and reasoning capabilities
150
+ - 🐝 **Swarm Intelligence** - Coordinate multiple AI agents for parallel problem solving with shared memory
151
+ - 🔌 **Dynamic MCP Client** - ⚠️ Dynamically connect to external MCP servers and load remote tools (use with caution - see security warnings)
152
+ - 🔄 **Multiple tools in Parallel** - Call multiple other tools at the same time in parallel with Batch Tool
153
+ - 🔍 **Browser Tool** - Tool giving an agent access to perform automated actions on a browser (chromium)
154
+ - 📈 **Diagram** - Create AWS cloud diagrams, basic diagrams, or UML diagrams using python libraries
155
+ - 📰 **RSS Feed Manager** - Subscribe, fetch, and process RSS feeds with content filtering and persistent storage
156
+ - 🖱️ **Computer Tool** - Automate desktop actions including mouse movements, keyboard input, screenshots, and application management
157
+
158
+ ## 📦 Installation
159
+
160
+ ### Quick Install
161
+
162
+ ```bash
163
+ pip install strands-agents-tools
164
+ ```
165
+
166
+ To install the dependencies for optional tools:
167
+
168
+ ```bash
169
+ pip install strands-agents-tools[mem0_memory, use_browser, rss, use_computer]
170
+ ```
171
+
172
+ ### Development Install
173
+
174
+ ```bash
175
+ # Clone the repository
176
+ git clone https://github.com/strands-agents/tools.git
177
+ cd tools
178
+
179
+ # Create and activate virtual environment
180
+ python3 -m venv .venv
181
+ source .venv/bin/activate # On Windows: venv\Scripts\activate
182
+
183
+ # Install in development mode
184
+ pip install -e ".[dev]"
185
+
186
+ # Install pre-commit hooks
187
+ pre-commit install
188
+ ```
189
+
190
+ ### Tools Overview
191
+
192
+ Below is a comprehensive table of all available tools, how to use them with an agent, and typical use cases:
193
+
194
+ | Tool | Agent Usage | Use Case |
195
+ |------|-------------|----------|
196
+ | a2a_client | `provider = A2AClientToolProvider(known_agent_urls=["http://localhost:9000"]); agent = Agent(tools=provider.tools)` | Discover and communicate with A2A-compliant agents, send messages between agents |
197
+ | file_read | `agent.tool.file_read(path="path/to/file.txt")` | Reading configuration files, parsing code files, loading datasets |
198
+ | file_write | `agent.tool.file_write(path="path/to/file.txt", content="file content")` | Writing results to files, creating new files, saving output data |
199
+ | editor | `agent.tool.editor(command="view", path="path/to/file.py")` | Advanced file operations like syntax highlighting, pattern replacement, and multi-file edits |
200
+ | shell* | `agent.tool.shell(command="ls -la")` | Executing shell commands, interacting with the operating system, running scripts |
201
+ | http_request | `agent.tool.http_request(method="GET", url="https://api.example.com/data")` | Making API calls, fetching web data, sending data to external services |
202
+ | tavily_search | `agent.tool.tavily_search(query="What is artificial intelligence?", search_depth="advanced")` | Real-time web search optimized for AI agents with a variety of custom parameters |
203
+ | tavily_extract | `agent.tool.tavily_extract(urls=["www.tavily.com"], extract_depth="advanced")` | Extract clean, structured content from web pages with advanced processing and noise removal |
204
+ | tavily_crawl | `agent.tool.tavily_crawl(url="www.tavily.com", max_depth=2, instructions="Find API docs")` | Crawl websites intelligently starting from a base URL with filtering and extraction |
205
+ | tavily_map | `agent.tool.tavily_map(url="www.tavily.com", max_depth=2, instructions="Find all pages")` | Map website structure and discover URLs starting from a base URL without content extraction |
206
+ | exa_search | `agent.tool.exa_search(query="Best project management tools", text=True)` | Intelligent web search with auto mode (default) that combines neural and keyword search for optimal results |
207
+ | exa_get_contents | `agent.tool.exa_get_contents(urls=["https://example.com/article"], text=True, summary={"query": "key points"})` | Extract full content and summaries from specific URLs with live crawling fallback |
208
+ | python_repl* | `agent.tool.python_repl(code="import pandas as pd\ndf = pd.read_csv('data.csv')\nprint(df.head())")` | Running Python code snippets, data analysis, executing complex logic with user confirmation for security |
209
+ | calculator | `agent.tool.calculator(expression="2 * sin(pi/4) + log(e**2)")` | Performing mathematical operations, symbolic math, equation solving |
210
+ | code_interpreter | `code_interpreter = AgentCoreCodeInterpreter(region="us-west-2"); agent = Agent(tools=[code_interpreter.code_interpreter])` | Execute code in isolated sandbox environments with multi-language support (Python, JavaScript, TypeScript), persistent sessions, and file operations |
211
+ | use_aws | `agent.tool.use_aws(service_name="s3", operation_name="list_buckets", parameters={}, region="us-west-2")` | Interacting with AWS services, cloud resource management |
212
+ | retrieve | `agent.tool.retrieve(text="What is STRANDS?")` | Retrieving information from Amazon Bedrock Knowledge Bases with optional metadata |
213
+ | nova_reels | `agent.tool.nova_reels(action="create", text="A cinematic shot of mountains", s3_bucket="my-bucket")` | Create high-quality videos using Amazon Bedrock Nova Reel with configurable parameters via environment variables |
214
+ | agent_core_memory | `agent.tool.agent_core_memory(action="record", content="Hello, I like vegetarian food")` | Store and retrieve memories with Amazon Bedrock Agent Core Memory service |
215
+ | mem0_memory | `agent.tool.mem0_memory(action="store", content="Remember I like to play tennis", user_id="alex")` | Store user and agent memories across agent runs to provide personalized experience |
216
+ | bright_data | `agent.tool.bright_data(action="scrape_as_markdown", url="https://example.com")` | Web scraping, search queries, screenshot capture, and structured data extraction from websites and different data feeds|
217
+ | memory | `agent.tool.memory(action="retrieve", query="product features")` | Store, retrieve, list, and manage documents in Amazon Bedrock Knowledge Bases with configurable parameters via environment variables |
218
+ | environment | `agent.tool.environment(action="list", prefix="AWS_")` | Managing environment variables, configuration management |
219
+ | generate_image_stability | `agent.tool.generate_image_stability(prompt="A tranquil pool")` | Creating images using Stability AI models |
220
+ | generate_image | `agent.tool.generate_image(prompt="A sunset over mountains")` | Creating AI-generated images for various applications |
221
+ | image_reader | `agent.tool.image_reader(image_path="path/to/image.jpg")` | Processing and reading image files for AI analysis |
222
+ | journal | `agent.tool.journal(action="write", content="Today's progress notes")` | Creating structured logs, maintaining documentation |
223
+ | think | `agent.tool.think(thought="Complex problem to analyze", cycle_count=3)` | Advanced reasoning, multi-step thinking processes |
224
+ | load_tool | `agent.tool.load_tool(path="path/to/custom_tool.py", name="custom_tool")` | Dynamically loading custom tools and extensions |
225
+ | swarm | `agent.tool.swarm(task="Analyze this problem", swarm_size=3, coordination_pattern="collaborative")` | Coordinating multiple AI agents to solve complex problems through collective intelligence |
226
+ | current_time | `agent.tool.current_time(timezone="US/Pacific")` | Get the current time in ISO 8601 format for a specified timezone |
227
+ | sleep | `agent.tool.sleep(seconds=5)` | Pause execution for the specified number of seconds, interruptible with SIGINT (Ctrl+C) |
228
+ | agent_graph | `agent.tool.agent_graph(agents=["agent1", "agent2"], connections=[{"from": "agent1", "to": "agent2"}])` | Create and visualize agent relationship graphs for complex multi-agent systems |
229
+ | cron* | `agent.tool.cron(action="schedule", name="task", schedule="0 * * * *", command="backup.sh")` | Schedule and manage recurring tasks with cron job syntax <br> **Does not work on Windows |
230
+ | slack | `agent.tool.slack(action="post_message", channel="general", text="Hello team!")` | Interact with Slack workspace for messaging and monitoring |
231
+ | speak | `agent.tool.speak(text="Operation completed successfully", style="green", mode="polly")` | Output status messages with rich formatting and optional text-to-speech |
232
+ | stop | `agent.tool.stop(message="Process terminated by user request")` | Gracefully terminate agent execution with custom message |
233
+ | handoff_to_user | `agent.tool.handoff_to_user(message="Please confirm action", breakout_of_loop=False)` | Hand off control to user for confirmation, input, or complete task handoff |
234
+ | 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 |
235
+ | workflow | `agent.tool.workflow(action="create", name="data_pipeline", steps=[{"tool": "file_read"}, {"tool": "python_repl"}])` | Define, execute, and manage multi-step automated workflows |
236
+ | mcp_client | `agent.tool.mcp_client(action="connect", connection_id="my_server", transport="stdio", command="python", args=["server.py"])` | ⚠️ **SECURITY WARNING**: Dynamically connect to external MCP servers via stdio, sse, or streamable_http, list tools, and call remote tools. This can pose security risks as agents may connect to malicious servers. Use with caution in production. |
237
+ | batch| `agent.tool.batch(invocations=[{"name": "current_time", "arguments": {"timezone": "Europe/London"}}, {"name": "stop", "arguments": {}}])` | Call multiple other tools in parallel. |
238
+ | browser | `browser = LocalChromiumBrowser(); agent = Agent(tools=[browser.browser])` | Web scraping, automated testing, form filling, web automation tasks |
239
+ | diagram | `agent.tool.diagram(diagram_type="cloud", nodes=[{"id": "s3", "type": "S3"}], edges=[])` | Create AWS cloud architecture diagrams, network diagrams, graphs, and UML diagrams (all 14 types) |
240
+ | rss | `agent.tool.rss(action="subscribe", url="https://example.com/feed.xml", feed_id="tech_news")` | Manage RSS feeds: subscribe, fetch, read, search, and update content from various sources |
241
+ | use_computer | `agent.tool.use_computer(action="click", x=100, y=200, app_name="Chrome") ` | Desktop automation, GUI interaction, screen capture |
242
+ | search_video | `agent.tool.search_video(query="people discussing AI")` | Semantic video search using TwelveLabs' Marengo model |
243
+ | chat_video | `agent.tool.chat_video(prompt="What are the main topics?", video_id="video_123")` | Interactive video analysis using TwelveLabs' Pegasus model |
244
+ | mongodb_memory | `agent.tool.mongodb_memory(action="record", content="User prefers vegetarian pizza", connection_string="mongodb+srv://...", database_name="memories")` | Store and retrieve memories using MongoDB Atlas with semantic search via AWS Bedrock Titan embeddings |
245
+
246
+ \* *These tools do not work on windows*
247
+
248
+ ## 💻 Usage Examples
249
+
250
+ ### File Operations
251
+
252
+ ```python
253
+ from strands import Agent
254
+ from strands_tools import file_read, file_write, editor
255
+
256
+ agent = Agent(tools=[file_read, file_write, editor])
257
+
258
+ agent.tool.file_read(path="config.json")
259
+ agent.tool.file_write(path="output.txt", content="Hello, world!")
260
+ agent.tool.editor(command="view", path="script.py")
261
+ ```
262
+
263
+ ### Dynamic MCP Client Integration
264
+
265
+ ⚠️ **SECURITY WARNING**: The Dynamic MCP Client allows agents to autonomously connect to external MCP servers and load remote tools at runtime. This poses significant security risks as agents can potentially connect to malicious servers and execute untrusted code. Use with extreme caution in production environments.
266
+
267
+ This tool is different from the static MCP server implementation in the Strands SDK (see [MCP Tools Documentation](https://github.com/strands-agents/docs/blob/main/docs/user-guide/concepts/tools/mcp-tools.md)) which uses pre-configured, trusted MCP servers.
268
+
269
+ ```python
270
+ from strands import Agent
271
+ from strands_tools import mcp_client
272
+
273
+ agent = Agent(tools=[mcp_client])
274
+
275
+ # Connect to a custom MCP server via stdio
276
+ agent.tool.mcp_client(
277
+ action="connect",
278
+ connection_id="my_tools",
279
+ transport="stdio",
280
+ command="python",
281
+ args=["my_mcp_server.py"]
282
+ )
283
+
284
+ # List available tools on the server
285
+ tools = agent.tool.mcp_client(
286
+ action="list_tools",
287
+ connection_id="my_tools"
288
+ )
289
+
290
+ # Call a tool from the MCP server
291
+ result = agent.tool.mcp_client(
292
+ action="call_tool",
293
+ connection_id="my_tools",
294
+ tool_name="calculate",
295
+ tool_args={"x": 10, "y": 20}
296
+ )
297
+
298
+ # Connect to a SSE-based server
299
+ agent.tool.mcp_client(
300
+ action="connect",
301
+ connection_id="web_server",
302
+ transport="sse",
303
+ server_url="http://localhost:8080/sse"
304
+ )
305
+
306
+ # Connect to a streamable HTTP server
307
+ agent.tool.mcp_client(
308
+ action="connect",
309
+ connection_id="http_server",
310
+ transport="streamable_http",
311
+ server_url="https://api.example.com/mcp",
312
+ headers={"Authorization": "Bearer token"},
313
+ timeout=60
314
+ )
315
+
316
+ # Load MCP tools into agent's registry for direct access
317
+ # ⚠️ WARNING: This loads external tools directly into the agent
318
+ agent.tool.mcp_client(
319
+ action="load_tools",
320
+ connection_id="my_tools"
321
+ )
322
+ # Now you can call MCP tools directly as: agent.tool.calculate(x=10, y=20)
323
+ ```
324
+
325
+ ### Shell Commands
326
+
327
+ *Note: `shell` does not work on Windows.*
328
+
329
+ ```python
330
+ from strands import Agent
331
+ from strands_tools import shell
332
+
333
+ agent = Agent(tools=[shell])
334
+
335
+ # Execute a single command
336
+ result = agent.tool.shell(command="ls -la")
337
+
338
+ # Execute a sequence of commands
339
+ results = agent.tool.shell(command=["mkdir -p test_dir", "cd test_dir", "touch test.txt"])
340
+
341
+ # Execute commands with error handling
342
+ agent.tool.shell(command="risky-command", ignore_errors=True)
343
+ ```
344
+
345
+ ### HTTP Requests
346
+
347
+ ```python
348
+ from strands import Agent
349
+ from strands_tools import http_request
350
+
351
+ agent = Agent(tools=[http_request])
352
+
353
+ # Make a simple GET request
354
+ response = agent.tool.http_request(
355
+ method="GET",
356
+ url="https://api.example.com/data"
357
+ )
358
+
359
+ # POST request with authentication
360
+ response = agent.tool.http_request(
361
+ method="POST",
362
+ url="https://api.example.com/resource",
363
+ headers={"Content-Type": "application/json"},
364
+ body=json.dumps({"key": "value"}),
365
+ auth_type="Bearer",
366
+ auth_token="your_token_here"
367
+ )
368
+
369
+ # Convert HTML webpages to markdown for better readability
370
+ response = agent.tool.http_request(
371
+ method="GET",
372
+ url="https://example.com/article",
373
+ convert_to_markdown=True
374
+ )
375
+ ```
376
+
377
+ ### Tavily Search, Extract, Crawl, and Map
378
+
379
+ ```python
380
+ from strands import Agent
381
+ from strands_tools.tavily import (
382
+ tavily_search, tavily_extract, tavily_crawl, tavily_map
383
+ )
384
+
385
+ # For async usage, call the corresponding *_async function with await.
386
+ # Synchronous usage
387
+ agent = Agent(tools=[tavily_search, tavily_extract, tavily_crawl, tavily_map])
388
+
389
+ # Real-time web search
390
+ result = agent.tool.tavily_search(
391
+ query="Latest developments in renewable energy",
392
+ search_depth="advanced",
393
+ topic="news",
394
+ max_results=10,
395
+ include_raw_content=True
396
+ )
397
+
398
+ # Extract content from multiple URLs
399
+ result = agent.tool.tavily_extract(
400
+ urls=["www.tavily.com", "www.apple.com"],
401
+ extract_depth="advanced",
402
+ format="markdown"
403
+ )
404
+
405
+ # Advanced crawl with instructions and filtering
406
+ result = agent.tool.tavily_crawl(
407
+ url="www.tavily.com",
408
+ max_depth=2,
409
+ limit=50,
410
+ instructions="Find all API documentation and developer guides",
411
+ extract_depth="advanced",
412
+ include_images=True
413
+ )
414
+
415
+ # Basic website mapping
416
+ result = agent.tool.tavily_map(url="www.tavily.com")
417
+
418
+ ```
419
+
420
+ ### Exa Search and Contents
421
+
422
+ ```python
423
+ from strands import Agent
424
+ from strands_tools.exa import exa_search, exa_get_contents
425
+
426
+ agent = Agent(tools=[exa_search, exa_get_contents])
427
+
428
+ # Basic search (auto mode is default and recommended)
429
+ result = agent.tool.exa_search(
430
+ query="Best project management software",
431
+ text=True
432
+ )
433
+
434
+ # Company-specific search when needed
435
+ result = agent.tool.exa_search(
436
+ query="Anthropic AI safety research",
437
+ category="company",
438
+ include_domains=["anthropic.com"],
439
+ num_results=5,
440
+ summary={"query": "key research areas and findings"}
441
+ )
442
+
443
+ # News search with date filtering
444
+ result = agent.tool.exa_search(
445
+ query="AI regulation policy updates",
446
+ category="news",
447
+ start_published_date="2024-01-01T00:00:00.000Z",
448
+ text=True
449
+ )
450
+
451
+ # Get detailed content from specific URLs
452
+ result = agent.tool.exa_get_contents(
453
+ urls=[
454
+ "https://example.com/blog-post",
455
+ "https://github.com/microsoft/semantic-kernel"
456
+ ],
457
+ text={"maxCharacters": 5000, "includeHtmlTags": False},
458
+ summary={
459
+ "query": "main points and practical applications"
460
+ },
461
+ subpages=2,
462
+ extras={"links": 5, "imageLinks": 2}
463
+ )
464
+
465
+ # Structured summary with JSON schema
466
+ result = agent.tool.exa_get_contents(
467
+ urls=["https://example.com/article"],
468
+ summary={
469
+ "query": "main findings and recommendations",
470
+ "schema": {
471
+ "type": "object",
472
+ "properties": {
473
+ "main_points": {"type": "string", "description": "Key points from the article"},
474
+ "recommendations": {"type": "string", "description": "Suggested actions or advice"},
475
+ "conclusion": {"type": "string", "description": "Overall conclusion"},
476
+ "relevance": {"type": "string", "description": "Why this matters"}
477
+ },
478
+ "required": ["main_points", "conclusion"]
479
+ }
480
+ }
481
+ )
482
+
483
+ ```
484
+
485
+ ### Python Code Execution
486
+
487
+ *Note: `python_repl` does not work on Windows.*
488
+
489
+ ```python
490
+ from strands import Agent
491
+ from strands_tools import python_repl
492
+
493
+ agent = Agent(tools=[python_repl])
494
+
495
+ # Execute Python code with state persistence
496
+ result = agent.tool.python_repl(code="""
497
+ import pandas as pd
498
+
499
+ # Load and process data
500
+ data = pd.read_csv('data.csv')
501
+ processed = data.groupby('category').mean()
502
+
503
+ processed.head()
504
+ """)
505
+ ```
506
+
507
+ ### Code Interpreter
508
+
509
+ ```python
510
+ from strands import Agent
511
+ from strands_tools.code_interpreter import AgentCoreCodeInterpreter
512
+
513
+ # Create the code interpreter tool
514
+ bedrock_agent_core_code_interpreter = AgentCoreCodeInterpreter(region="us-west-2")
515
+ agent = Agent(tools=[bedrock_agent_core_code_interpreter.code_interpreter])
516
+
517
+ # Create a session
518
+ agent.tool.code_interpreter({
519
+ "action": {
520
+ "type": "initSession",
521
+ "description": "Data analysis session",
522
+ "session_name": "analysis-session"
523
+ }
524
+ })
525
+
526
+ # Execute Python code
527
+ agent.tool.code_interpreter({
528
+ "action": {
529
+ "type": "executeCode",
530
+ "session_name": "analysis-session",
531
+ "code": "print('Hello from sandbox!')",
532
+ "language": "python"
533
+ }
534
+ })
535
+ ```
536
+
537
+ ### Swarm Intelligence
538
+
539
+ ```python
540
+ from strands import Agent
541
+ from strands_tools import swarm
542
+
543
+ agent = Agent(tools=[swarm])
544
+
545
+ # Create a collaborative swarm of agents to tackle a complex problem
546
+ result = agent.tool.swarm(
547
+ task="Generate creative solutions for reducing plastic waste in urban areas",
548
+ swarm_size=5,
549
+ coordination_pattern="collaborative"
550
+ )
551
+
552
+ # Create a competitive swarm for diverse solution generation
553
+ result = agent.tool.swarm(
554
+ task="Design an innovative product for smart home automation",
555
+ swarm_size=3,
556
+ coordination_pattern="competitive"
557
+ )
558
+
559
+ # Hybrid approach combining collaboration and competition
560
+ result = agent.tool.swarm(
561
+ task="Develop marketing strategies for a new sustainable fashion brand",
562
+ swarm_size=4,
563
+ coordination_pattern="hybrid"
564
+ )
565
+ ```
566
+
567
+ ### Use AWS
568
+
569
+ ```python
570
+ from strands import Agent
571
+ from strands_tools import use_aws
572
+
573
+ agent = Agent(tools=[use_aws])
574
+
575
+ # List S3 buckets
576
+ result = agent.tool.use_aws(
577
+ service_name="s3",
578
+ operation_name="list_buckets",
579
+ parameters={},
580
+ region="us-east-1",
581
+ label="List all S3 buckets"
582
+ )
583
+
584
+ # Get the contents of a specific S3 bucket
585
+ result = agent.tool.use_aws(
586
+ service_name="s3",
587
+ operation_name="list_objects_v2",
588
+ parameters={"Bucket": "example-bucket"}, # Replace with your actual bucket name
589
+ region="us-east-1",
590
+ label="List objects in a specific S3 bucket"
591
+ )
592
+
593
+ # Get the list of EC2 subnets
594
+ result = agent.tool.use_aws(
595
+ service_name="ec2",
596
+ operation_name="describe_subnets",
597
+ parameters={},
598
+ region="us-east-1",
599
+ label="List all subnets"
600
+ )
601
+ ```
602
+
603
+ ### Retrieve Tool
604
+
605
+ ```python
606
+ from strands import Agent
607
+ from strands_tools import retrieve
608
+
609
+ agent = Agent(tools=[retrieve])
610
+
611
+ # Basic retrieval without metadata
612
+ result = agent.tool.retrieve(
613
+ text="What is artificial intelligence?"
614
+ )
615
+
616
+ # Retrieval with metadata enabled
617
+ result = agent.tool.retrieve(
618
+ text="What are the latest developments in machine learning?",
619
+ enableMetadata=True
620
+ )
621
+
622
+ # Using environment variable to set default metadata behavior
623
+ # Set RETRIEVE_ENABLE_METADATA_DEFAULT=true in your environment
624
+ result = agent.tool.retrieve(
625
+ text="Tell me about cloud computing"
626
+ # enableMetadata will default to the environment variable value
627
+ )
628
+ ```
629
+
630
+ ### Batch Tool
631
+
632
+ ```python
633
+ import os
634
+ import sys
635
+
636
+ from strands import Agent
637
+ from strands_tools import batch, http_request, use_aws
638
+
639
+ # Example usage of the batch with http_request and use_aws tools
640
+ agent = Agent(tools=[batch, http_request, use_aws])
641
+
642
+ result = agent.tool.batch(
643
+ invocations=[
644
+ {"name": "http_request", "arguments": {"method": "GET", "url": "https://api.ipify.org?format=json"}},
645
+ {
646
+ "name": "use_aws",
647
+ "arguments": {
648
+ "service_name": "s3",
649
+ "operation_name": "list_buckets",
650
+ "parameters": {},
651
+ "region": "us-east-1",
652
+ "label": "List S3 Buckets"
653
+ }
654
+ },
655
+ ]
656
+ )
657
+ ```
658
+
659
+ ### Video Tools
660
+
661
+ ```python
662
+ from strands import Agent
663
+ from strands_tools import search_video, chat_video
664
+
665
+ agent = Agent(tools=[search_video, chat_video])
666
+
667
+ # Search for video content using natural language
668
+ result = agent.tool.search_video(
669
+ query="people discussing AI technology",
670
+ threshold="high",
671
+ group_by="video",
672
+ page_limit=5
673
+ )
674
+
675
+ # Chat with existing video (no index_id needed)
676
+ result = agent.tool.chat_video(
677
+ prompt="What are the main topics discussed in this video?",
678
+ video_id="existing-video-id"
679
+ )
680
+
681
+ # Chat with new video file (index_id required for upload)
682
+ result = agent.tool.chat_video(
683
+ prompt="Describe what happens in this video",
684
+ video_path="/path/to/video.mp4",
685
+ index_id="your-index-id" # or set TWELVELABS_PEGASUS_INDEX_ID env var
686
+ )
687
+ ```
688
+
689
+ ### AgentCore Memory
690
+ ```python
691
+ from strands import Agent
692
+ from strands_tools.agent_core_memory import AgentCoreMemoryToolProvider
693
+
694
+
695
+ provider = AgentCoreMemoryToolProvider(
696
+ memory_id="memory-123abc", # Required
697
+ actor_id="user-456", # Required
698
+ session_id="session-789", # Required
699
+ namespace="default", # Required
700
+ region="us-west-2" # Optional, defaults to us-west-2
701
+ )
702
+
703
+ agent = Agent(tools=provider.tools)
704
+
705
+ # Create a new memory
706
+ result = agent.tool.agent_core_memory(
707
+ action="record",
708
+ content="I am allergic to shellfish"
709
+ )
710
+
711
+ # Search for relevant memories
712
+ result = agent.tool.agent_core_memory(
713
+ action="retrieve",
714
+ query="user preferences"
715
+ )
716
+
717
+ # List all memories
718
+ result = agent.tool.agent_core_memory(
719
+ action="list"
720
+ )
721
+
722
+ # Get a specific memory by ID
723
+ result = agent.tool.agent_core_memory(
724
+ action="get",
725
+ memory_record_id="mr-12345"
726
+ )
727
+ ```
728
+
729
+ ### Browser
730
+ ```python
731
+ from strands import Agent
732
+ from strands_tools.browser import LocalChromiumBrowser
733
+
734
+ # Create browser tool
735
+ browser = LocalChromiumBrowser()
736
+ agent = Agent(tools=[browser.browser])
737
+
738
+ # Simple navigation
739
+ result = agent.tool.browser({
740
+ "action": {
741
+ "type": "navigate",
742
+ "url": "https://example.com"
743
+ }
744
+ })
745
+
746
+ # Initialize a session first
747
+ result = agent.tool.browser({
748
+ "action": {
749
+ "type": "initSession",
750
+ "session_name": "main-session",
751
+ "description": "Web automation session"
752
+ }
753
+ })
754
+ ```
755
+
756
+ ### Handoff to User
757
+
758
+ ```python
759
+ from strands import Agent
760
+ from strands_tools import handoff_to_user
761
+
762
+ agent = Agent(tools=[handoff_to_user])
763
+
764
+ # Request user confirmation and continue
765
+ response = agent.tool.handoff_to_user(
766
+ message="I need your approval to proceed with deleting these files. Type 'yes' to confirm.",
767
+ breakout_of_loop=False
768
+ )
769
+
770
+ # Complete handoff to user (stops agent execution)
771
+ agent.tool.handoff_to_user(
772
+ message="Task completed. Please review the results and take any necessary follow-up actions.",
773
+ breakout_of_loop=True
774
+ )
775
+ ```
776
+
777
+ ### A2A Client
778
+
779
+ ```python
780
+ from strands import Agent
781
+ from strands_tools.a2a_client import A2AClientToolProvider
782
+
783
+ # Initialize the A2A client provider with known agent URLs
784
+ provider = A2AClientToolProvider(known_agent_urls=["http://localhost:9000"])
785
+ agent = Agent(tools=provider.tools)
786
+
787
+ # Use natural language to interact with A2A agents
788
+ response = agent("discover available agents and send a greeting message")
789
+
790
+ # The agent will automatically use the available tools:
791
+ # - discover_agent(url) to find agents
792
+ # - list_discovered_agents() to see all discovered agents
793
+ # - send_message(message_text, target_agent_url) to communicate
794
+ ```
795
+
796
+ ### Diagram
797
+
798
+ ```python
799
+ from strands import Agent
800
+ from strands_tools import diagram
801
+
802
+ agent = Agent(tools=[diagram])
803
+
804
+ # Create an AWS cloud architecture diagram
805
+ result = agent.tool.diagram(
806
+ diagram_type="cloud",
807
+ nodes=[
808
+ {"id": "users", "type": "Users", "label": "End Users"},
809
+ {"id": "cloudfront", "type": "CloudFront", "label": "CDN"},
810
+ {"id": "s3", "type": "S3", "label": "Static Assets"},
811
+ {"id": "api", "type": "APIGateway", "label": "API Gateway"},
812
+ {"id": "lambda", "type": "Lambda", "label": "Backend Service"}
813
+ ],
814
+ edges=[
815
+ {"from": "users", "to": "cloudfront"},
816
+ {"from": "cloudfront", "to": "s3"},
817
+ {"from": "users", "to": "api"},
818
+ {"from": "api", "to": "lambda"}
819
+ ],
820
+ title="Web Application Architecture"
821
+ )
822
+
823
+ # Create a UML class diagram
824
+ result = agent.tool.diagram(
825
+ diagram_type="class",
826
+ elements=[
827
+ {
828
+ "name": "User",
829
+ "attributes": ["+id: int", "-name: string", "#email: string"],
830
+ "methods": ["+login(): bool", "+logout(): void"]
831
+ },
832
+ {
833
+ "name": "Order",
834
+ "attributes": ["+id: int", "-items: List", "-total: float"],
835
+ "methods": ["+addItem(item): void", "+calculateTotal(): float"]
836
+ }
837
+ ],
838
+ relationships=[
839
+ {"from": "User", "to": "Order", "type": "association", "multiplicity": "1..*"}
840
+ ],
841
+ title="E-commerce Domain Model"
842
+ )
843
+ ```
844
+
845
+ ### RSS Feed Management
846
+
847
+ ```python
848
+ from strands import Agent
849
+ from strands_tools import rss
850
+
851
+ agent = Agent(tools=[rss])
852
+
853
+ # Subscribe to a feed
854
+ result = agent.tool.rss(
855
+ action="subscribe",
856
+ url="https://news.example.com/rss/technology"
857
+ )
858
+
859
+ # List all subscribed feeds
860
+ feeds = agent.tool.rss(action="list")
861
+
862
+ # Read entries from a specific feed
863
+ entries = agent.tool.rss(
864
+ action="read",
865
+ feed_id="news_example_com_technology",
866
+ max_entries=5,
867
+ include_content=True
868
+ )
869
+
870
+ # Search across all feeds
871
+ search_results = agent.tool.rss(
872
+ action="search",
873
+ query="machine learning",
874
+ max_entries=10
875
+ )
876
+
877
+ # Fetch feed content without subscribing
878
+ latest_news = agent.tool.rss(
879
+ action="fetch",
880
+ url="https://blog.example.org/feed",
881
+ max_entries=3
882
+ )
883
+ ```
884
+
885
+ ### Use Computer
886
+
887
+ ```python
888
+ from strands import Agent
889
+ from strands_tools import use_computer
890
+
891
+ agent = Agent(tools=[use_computer])
892
+
893
+ # Find mouse position
894
+ result = agent.tool.use_computer(action="mouse_position")
895
+
896
+ # Automate adding text
897
+ result = agent.tool.use_computer(action="type", text="Hello, world!", app_name="Notepad")
898
+
899
+ # Analyze current computer screen
900
+ result = agent.tool.use_computer(action="analyze_screen")
901
+
902
+ result = agent.tool.use_computer(action="open_app", app_name="Calculator")
903
+ result = agent.tool.use_computer(action="close_app", app_name="Calendar")
904
+
905
+ result = agent.tool.use_computer(
906
+ action="hotkey",
907
+ hotkey_str="command+ctrl+f", # For macOS
908
+ app_name="Chrome"
909
+ )
910
+ ```
911
+
912
+ ### Elasticsearch Memory
913
+
914
+ **Note**: This tool requires AWS account credentials to generate embeddings using Amazon Bedrock Titan models.
915
+
916
+ ```python
917
+ from strands import Agent
918
+ from strands_tools.elasticsearch_memory import elasticsearch_memory
919
+
920
+ # Create agent with direct tool usage
921
+ agent = Agent(tools=[elasticsearch_memory])
922
+
923
+ # Store a memory with semantic embeddings
924
+ result = agent.tool.elasticsearch_memory(
925
+ action="record",
926
+ content="User prefers vegetarian pizza with extra cheese",
927
+ metadata={"category": "food_preferences", "type": "dietary"},
928
+ cloud_id="your-elasticsearch-cloud-id",
929
+ api_key="your-api-key",
930
+ index_name="memories",
931
+ namespace="user_123"
932
+ )
933
+
934
+ # Search memories using semantic similarity (vector search)
935
+ result = agent.tool.elasticsearch_memory(
936
+ action="retrieve",
937
+ query="food preferences and dietary restrictions",
938
+ max_results=5,
939
+ cloud_id="your-elasticsearch-cloud-id",
940
+ api_key="your-api-key",
941
+ index_name="memories",
942
+ namespace="user_123"
943
+ )
944
+
945
+ # Use configuration dictionary for cleaner code
946
+ config = {
947
+ "cloud_id": "your-elasticsearch-cloud-id",
948
+ "api_key": "your-api-key",
949
+ "index_name": "memories",
950
+ "namespace": "user_123"
951
+ }
952
+
953
+ # List all memories with pagination
954
+ result = agent.tool.elasticsearch_memory(
955
+ action="list",
956
+ max_results=10,
957
+ **config
958
+ )
959
+
960
+ # Get specific memory by ID
961
+ result = agent.tool.elasticsearch_memory(
962
+ action="get",
963
+ memory_id="mem_1234567890_abcd1234",
964
+ **config
965
+ )
966
+
967
+ # Delete a memory
968
+ result = agent.tool.elasticsearch_memory(
969
+ action="delete",
970
+ memory_id="mem_1234567890_abcd1234",
971
+ **config
972
+ )
973
+
974
+ # Use Elasticsearch Serverless (URL-based connection)
975
+ result = agent.tool.elasticsearch_memory(
976
+ action="record",
977
+ content="User prefers vegetarian pizza",
978
+ es_url="https://your-serverless-cluster.es.region.aws.elastic.cloud:443",
979
+ api_key="your-api-key",
980
+ index_name="memories",
981
+ namespace="user_123"
982
+ )
983
+ ```
984
+
985
+ ### MongoDB Atlas Memory
986
+
987
+ **Note**: This tool requires AWS account credentials to generate embeddings using Amazon Bedrock Titan models.
988
+
989
+ ```python
990
+ from strands import Agent
991
+ from strands_tools.mongodb_memory import mongodb_memory
992
+
993
+ # Create agent with direct tool usage
994
+ agent = Agent(tools=[mongodb_memory])
995
+
996
+ # Store a memory with semantic embeddings
997
+ result = agent.tool.mongodb_memory(
998
+ action="record",
999
+ content="User prefers vegetarian pizza with extra cheese",
1000
+ metadata={"category": "food_preferences", "type": "dietary"},
1001
+ connection_string="mongodb+srv://username:password@cluster0.mongodb.net/?retryWrites=true&w=majority",
1002
+ database_name="memories",
1003
+ collection_name="user_memories",
1004
+ namespace="user_123"
1005
+ )
1006
+
1007
+ # Search memories using semantic similarity (vector search)
1008
+ result = agent.tool.mongodb_memory(
1009
+ action="retrieve",
1010
+ query="food preferences and dietary restrictions",
1011
+ max_results=5,
1012
+ connection_string="mongodb+srv://username:password@cluster0.mongodb.net/?retryWrites=true&w=majority",
1013
+ database_name="memories",
1014
+ collection_name="user_memories",
1015
+ namespace="user_123"
1016
+ )
1017
+
1018
+ # Use configuration dictionary for cleaner code
1019
+ config = {
1020
+ "connection_string": "mongodb+srv://username:password@cluster0.mongodb.net/?retryWrites=true&w=majority",
1021
+ "database_name": "memories",
1022
+ "collection_name": "user_memories",
1023
+ "namespace": "user_123"
1024
+ }
1025
+
1026
+ # List all memories with pagination
1027
+ result = agent.tool.mongodb_memory(
1028
+ action="list",
1029
+ max_results=10,
1030
+ **config
1031
+ )
1032
+
1033
+ # Get specific memory by ID
1034
+ result = agent.tool.mongodb_memory(
1035
+ action="get",
1036
+ memory_id="mem_1234567890_abcd1234",
1037
+ **config
1038
+ )
1039
+
1040
+ # Delete a memory
1041
+ result = agent.tool.mongodb_memory(
1042
+ action="delete",
1043
+ memory_id="mem_1234567890_abcd1234",
1044
+ **config
1045
+ )
1046
+
1047
+ # Use environment variables for connection
1048
+ # Set MONGODB_ATLAS_CLUSTER_URI in your environment
1049
+ result = agent.tool.mongodb_memory(
1050
+ action="record",
1051
+ content="User prefers vegetarian pizza",
1052
+ database_name="memories",
1053
+ collection_name="user_memories",
1054
+ namespace="user_123"
1055
+ )
1056
+ ```
1057
+
1058
+ ## 🌍 Environment Variables Configuration
1059
+
1060
+ 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).
1061
+
1062
+ ### Global Environment Variables
1063
+
1064
+ These variables affect multiple tools:
1065
+
1066
+ | Environment Variable | Description | Default | Affected Tools |
1067
+ |----------------------|-------------|---------|---------------|
1068
+ | BYPASS_TOOL_CONSENT | Bypass consent for tool invocation, set to "true" to enable | false | All tools that require consent (e.g. shell, file_write, python_repl) |
1069
+ | STRANDS_TOOL_CONSOLE_MODE | Enable rich UI for tools, set to "enabled" to enable | disabled | All tools that have optional rich UI |
1070
+ | AWS_REGION | Default AWS region for AWS operations | us-west-2 | use_aws, retrieve, generate_image, memory, nova_reels |
1071
+ | AWS_PROFILE | AWS profile name to use from ~/.aws/credentials | default | use_aws, retrieve |
1072
+ | LOG_LEVEL | Logging level (DEBUG, INFO, WARNING, ERROR) | INFO | All tools |
1073
+
1074
+ ### Tool-Specific Environment Variables
1075
+
1076
+ #### Calculator Tool
1077
+
1078
+ | Environment Variable | Description | Default |
1079
+ |----------------------|-------------|---------|
1080
+ | CALCULATOR_MODE | Default calculation mode | evaluate |
1081
+ | CALCULATOR_PRECISION | Number of decimal places for results | 10 |
1082
+ | CALCULATOR_SCIENTIFIC | Whether to use scientific notation for numbers | False |
1083
+ | CALCULATOR_FORCE_NUMERIC | Force numeric evaluation of symbolic expressions | False |
1084
+ | CALCULATOR_FORCE_SCIENTIFIC_THRESHOLD | Threshold for automatic scientific notation | 1e21 |
1085
+ | CALCULATOR_DERIVE_ORDER | Default order for derivatives | 1 |
1086
+ | CALCULATOR_SERIES_POINT | Default point for series expansion | 0 |
1087
+ | CALCULATOR_SERIES_ORDER | Default order for series expansion | 5 |
1088
+
1089
+ #### Current Time Tool
1090
+
1091
+ | Environment Variable | Description | Default |
1092
+ |----------------------|-------------|---------|
1093
+ | DEFAULT_TIMEZONE | Default timezone for current_time tool | UTC |
1094
+
1095
+ #### Sleep Tool
1096
+
1097
+ | Environment Variable | Description | Default |
1098
+ |----------------------|-------------|---------|
1099
+ | MAX_SLEEP_SECONDS | Maximum allowed sleep duration in seconds | 300 |
1100
+
1101
+ #### Tavily Search, Extract, Crawl, and Map Tools
1102
+
1103
+ | Environment Variable | Description | Default |
1104
+ |----------------------|-------------|---------|
1105
+ | TAVILY_API_KEY | Tavily API key (required for all Tavily functionality) | None |
1106
+ - Visit https://www.tavily.com/ to create a free account and API key.
1107
+
1108
+ #### Exa Search and Contents Tools
1109
+
1110
+ | Environment Variable | Description | Default |
1111
+ |----------------------|-------------|---------|
1112
+ | EXA_API_KEY | Exa API key (required for all Exa functionality) | None |
1113
+ - Visit https://dashboard.exa.ai/api-keys to create a free account and API key.
1114
+
1115
+ #### Mem0 Memory Tool
1116
+
1117
+ The Mem0 Memory Tool supports three different backend configurations:
1118
+
1119
+ 1. **Mem0 Platform**:
1120
+ - Uses the Mem0 Platform API for memory management
1121
+ - Requires a Mem0 API key
1122
+
1123
+ 2. **OpenSearch** (Recommended for AWS environments):
1124
+ - Uses OpenSearch as the vector store backend
1125
+ - Requires AWS credentials and OpenSearch configuration
1126
+
1127
+ 3. **FAISS** (Default for local development):
1128
+ - Uses FAISS as the local vector store backend
1129
+ - Requires faiss-cpu package for local vector storage
1130
+
1131
+ 4. **Neptune Analytics** (Optional Graph backend for search enhancement):
1132
+ - Uses Neptune Analytics as the graph store backend to enhance memory recall.
1133
+ - Requires AWS credentials and Neptune Analytics configuration
1134
+ ```
1135
+ # Configure your Neptune Analytics graph ID in the .env file:
1136
+ export NEPTUNE_ANALYTICS_GRAPH_IDENTIFIER=sample-graph-id
1137
+
1138
+ # Configure your Neptune Analytics graph ID in Python code:
1139
+ import os
1140
+ os.environ['NEPTUNE_ANALYTICS_GRAPH_IDENTIFIER'] = "g-sample-graph-id"
1141
+
1142
+ ```
1143
+
1144
+ | Environment Variable | Description | Default | Required For |
1145
+ |----------------------|-------------|---------|--------------|
1146
+ | MEM0_API_KEY | Mem0 Platform API key | None | Mem0 Platform |
1147
+ | OPENSEARCH_HOST | OpenSearch Host URL | None | OpenSearch |
1148
+ | AWS_REGION | AWS Region for OpenSearch | us-west-2 | OpenSearch |
1149
+ | NEPTUNE_ANALYTICS_GRAPH_IDENTIFIER | Neptune Analytics Graph Identifier | None | Neptune Analytics |
1150
+ | DEV | Enable development mode (bypasses confirmations) | false | All modes |
1151
+ | MEM0_LLM_PROVIDER | LLM provider for memory processing | aws_bedrock | All modes |
1152
+ | MEM0_LLM_MODEL | LLM model for memory processing | anthropic.claude-3-5-haiku-20241022-v1:0 | All modes |
1153
+ | MEM0_LLM_TEMPERATURE | LLM temperature (0.0-2.0) | 0.1 | All modes |
1154
+ | MEM0_LLM_MAX_TOKENS | LLM maximum tokens | 2000 | All modes |
1155
+ | MEM0_EMBEDDER_PROVIDER | Embedder provider for vector embeddings | aws_bedrock | All modes |
1156
+ | MEM0_EMBEDDER_MODEL | Embedder model for vector embeddings | amazon.titan-embed-text-v2:0 | All modes |
1157
+
1158
+
1159
+ **Note**:
1160
+ - If `MEM0_API_KEY` is set, the tool will use the Mem0 Platform
1161
+ - If `OPENSEARCH_HOST` is set, the tool will use OpenSearch
1162
+ - If neither is set, the tool will default to FAISS (requires `faiss-cpu` package)
1163
+ - If `NEPTUNE_ANALYTICS_GRAPH_IDENTIFIER` is set, the tool will configure Neptune Analytics as graph store to enhance memory search
1164
+ - LLM configuration applies to all backend modes and allows customization of the language model used for memory processing
1165
+
1166
+ #### Bright Data Tool
1167
+
1168
+ | Environment Variable | Description | Default |
1169
+ |----------------------|-------------|---------|
1170
+ | BRIGHTDATA_API_KEY | Bright Data API Key | None |
1171
+ | BRIGHTDATA_ZONE | Bright Data Web Unlocker Zone | web_unlocker1 |
1172
+
1173
+ #### Memory Tool
1174
+
1175
+ | Environment Variable | Description | Default |
1176
+ |----------------------|-------------|---------|
1177
+ | MEMORY_DEFAULT_MAX_RESULTS | Default maximum results for list operations | 50 |
1178
+ | MEMORY_DEFAULT_MIN_SCORE | Default minimum relevance score for filtering results | 0.4 |
1179
+
1180
+ #### Nova Reels Tool
1181
+
1182
+ | Environment Variable | Description | Default |
1183
+ |----------------------|-------------|---------|
1184
+ | NOVA_REEL_DEFAULT_SEED | Default seed for video generation | 0 |
1185
+ | NOVA_REEL_DEFAULT_FPS | Default frames per second for generated videos | 24 |
1186
+ | NOVA_REEL_DEFAULT_DIMENSION | Default video resolution in WIDTHxHEIGHT format | 1280x720 |
1187
+ | NOVA_REEL_DEFAULT_MAX_RESULTS | Default maximum number of jobs to return for list action | 10 |
1188
+
1189
+ #### Python REPL Tool
1190
+
1191
+ | Environment Variable | Description | Default |
1192
+ |----------------------|-------------|---------|
1193
+ | PYTHON_REPL_BINARY_MAX_LEN | Maximum length for binary content before truncation | 100 |
1194
+ | PYTHON_REPL_INTERACTIVE | Whether to enable interactive PTY mode | None |
1195
+ | PYTHON_REPL_RESET_STATE | Whether to reset the REPL state before execution | None |
1196
+ | PYTHON_REPL_PERSISTENCE_DIR | Set Directory for python_repl tool to write state file | None |
1197
+
1198
+ #### Shell Tool
1199
+
1200
+ | Environment Variable | Description | Default |
1201
+ |----------------------|-------------|---------|
1202
+ | SHELL_DEFAULT_TIMEOUT | Default timeout in seconds for shell commands | 900 |
1203
+
1204
+ #### Slack Tool
1205
+
1206
+ | Environment Variable | Description | Default |
1207
+ |----------------------|-------------|---------|
1208
+ | SLACK_DEFAULT_EVENT_COUNT | Default number of events to retrieve | 42 |
1209
+ | STRANDS_SLACK_AUTO_REPLY | Enable automatic replies to messages | false |
1210
+ | STRANDS_SLACK_LISTEN_ONLY_TAG | Only process messages containing this tag | None |
1211
+
1212
+ #### Speak Tool
1213
+
1214
+ | Environment Variable | Description | Default |
1215
+ |----------------------|-------------|---------|
1216
+ | SPEAK_DEFAULT_STYLE | Default style for status messages | green |
1217
+ | SPEAK_DEFAULT_MODE | Default speech mode (fast/polly) | fast |
1218
+ | SPEAK_DEFAULT_VOICE_ID | Default Polly voice ID | Joanna |
1219
+ | SPEAK_DEFAULT_OUTPUT_PATH | Default audio output path | speech_output.mp3 |
1220
+ | SPEAK_DEFAULT_PLAY_AUDIO | Whether to play audio by default | True |
1221
+
1222
+ #### Editor Tool
1223
+
1224
+ | Environment Variable | Description | Default |
1225
+ |----------------------|-------------|---------|
1226
+ | EDITOR_DIR_TREE_MAX_DEPTH | Maximum depth for directory tree visualization | 2 |
1227
+ | EDITOR_DEFAULT_STYLE | Default style for output panels | default |
1228
+ | EDITOR_DEFAULT_LANGUAGE | Default language for syntax highlighting | python |
1229
+ | EDITOR_DISABLE_BACKUP | Skip creating .bak backup files during edit operations | false |
1230
+
1231
+ #### Environment Tool
1232
+
1233
+ | Environment Variable | Description | Default |
1234
+ |----------------------|-------------|---------|
1235
+ | ENV_VARS_MASKED_DEFAULT | Default setting for masking sensitive values | true |
1236
+
1237
+ #### Dynamic MCP Client Tool
1238
+
1239
+ | Environment Variable | Description | Default |
1240
+ |----------------------|-------------|---------|
1241
+ | STRANDS_MCP_TIMEOUT | Default timeout in seconds for MCP operations | 30.0 |
1242
+
1243
+ #### File Read Tool
1244
+
1245
+ | Environment Variable | Description | Default |
1246
+ |----------------------|-------------|---------|
1247
+ | FILE_READ_RECURSIVE_DEFAULT | Default setting for recursive file searching | true |
1248
+ | FILE_READ_CONTEXT_LINES_DEFAULT | Default number of context lines around search matches | 2 |
1249
+ | FILE_READ_START_LINE_DEFAULT | Default starting line number for lines mode | 0 |
1250
+ | FILE_READ_CHUNK_OFFSET_DEFAULT | Default byte offset for chunk mode | 0 |
1251
+ | FILE_READ_DIFF_TYPE_DEFAULT | Default diff type for file comparisons | unified |
1252
+ | FILE_READ_USE_GIT_DEFAULT | Default setting for using git in time machine mode | true |
1253
+ | FILE_READ_NUM_REVISIONS_DEFAULT | Default number of revisions to show in time machine mode | 5 |
1254
+
1255
+ #### Browser Tool
1256
+
1257
+ | Environment Variable | Description | Default |
1258
+ |----------------------|-------------|---------|
1259
+ | STRANDS_DEFAULT_WAIT_TIME | Default setting for wait time with actions | 1 |
1260
+ | STRANDS_BROWSER_MAX_RETRIES | Default number of retries to perform when an action fails | 3 |
1261
+ | STRANDS_BROWSER_RETRY_DELAY | Default retry delay time for retry mechanisms | 1 |
1262
+ | STRANDS_BROWSER_SCREENSHOTS_DIR | Default directory where screenshots will be saved | screenshots |
1263
+ | STRANDS_BROWSER_USER_DATA_DIR | Default directory where data for reloading a browser instance is stored | ~/.browser_automation |
1264
+ | STRANDS_BROWSER_HEADLESS | Default headless setting for launching browsers | false |
1265
+ | STRANDS_BROWSER_WIDTH | Default width of the browser | 1280 |
1266
+ | STRANDS_BROWSER_HEIGHT | Default height of the browser | 800 |
1267
+
1268
+ #### RSS Tool
1269
+
1270
+ | Environment Variable | Description | Default |
1271
+ |----------------------|-------------|---------|
1272
+ | STRANDS_RSS_MAX_ENTRIES | Default setting for maximum number of entries per feed | 100 |
1273
+ | STRANDS_RSS_UPDATE_INTERVAL | Default amount of time between updating rss feeds in minutes | 60 |
1274
+ | STRANDS_RSS_STORAGE_PATH | Default storage path where rss feeds are stored locally | strands_rss_feeds (this may vary based on your system) |
1275
+
1276
+ #### Retrieve Tool
1277
+
1278
+ | Environment Variable | Description | Default |
1279
+ |----------------------|-------------|---------|
1280
+ | RETRIEVE_ENABLE_METADATA_DEFAULT | Default setting for enabling metadata in retrieve tool responses | false |
1281
+
1282
+ #### Video Tools
1283
+
1284
+ | Environment Variable | Description | Default |
1285
+ |----------------------|-------------|---------|
1286
+ | TWELVELABS_API_KEY | TwelveLabs API key for video analysis | None |
1287
+ | TWELVELABS_MARENGO_INDEX_ID | Default index ID for search_video tool | None |
1288
+ | TWELVELABS_PEGASUS_INDEX_ID | Default index ID for chat_video tool | None |
1289
+
1290
+ #### MongoDB Atlas Memory Tool
1291
+
1292
+ | Environment Variable | Description | Default |
1293
+ |----------------------|-------------|---------|
1294
+ | MONGODB_ATLAS_CLUSTER_URI | MongoDB Atlas connection string | None |
1295
+ | MONGODB_DEFAULT_DATABASE | Default database name for MongoDB operations | memories |
1296
+ | MONGODB_DEFAULT_COLLECTION | Default collection name for MongoDB operations | user_memories |
1297
+ | MONGODB_DEFAULT_NAMESPACE | Default namespace for memory isolation | default |
1298
+ | MONGODB_DEFAULT_MAX_RESULTS | Default maximum results for list operations | 50 |
1299
+ | MONGODB_DEFAULT_MIN_SCORE | Default minimum relevance score for filtering results | 0.4 |
1300
+
1301
+ **Note**: This tool requires AWS account credentials to generate embeddings using Amazon Bedrock Titan models.
1302
+
1303
+
1304
+ ## Contributing ❤️
1305
+
1306
+ This is a community-driven project, powered by passionate developers like you.
1307
+ We enthusiastically welcome contributions from everyone,
1308
+ regardless of experience level—your unique perspective is valuable to us!
1309
+
1310
+ ### How to Get Started?
1311
+
1312
+ 1. **Find your first opportunity**: If you're new to the project, explore our labeled "good first issues" for beginner-friendly tasks.
1313
+ 2. **Understand our workflow**: Review our [Contributing Guide](CONTRIBUTING.md) to learn about our development setup, coding standards, and pull request process.
1314
+ 3. **Make your impact**: Contributions come in many forms—fixing bugs, enhancing documentation, improving performance, adding features, writing tests, or refining the user experience.
1315
+ 4. **Submit your work**: When you're ready, submit a well-documented pull request, and our maintainers will provide feedback to help get your changes merged.
1316
+
1317
+ Your questions, insights, and ideas are always welcome!
1318
+
1319
+ Together, we're building something meaningful that impacts real users. We look forward to collaborating with you!
1320
+
1321
+ ## License
1322
+
1323
+ This project is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details.
1324
+
1325
+ ## Security
1326
+
1327
+ See [CONTRIBUTING](CONTRIBUTING.md#security-issue-notifications) for more information.