# AWS Bedrock AgentCore Tools
This module provides tools for interacting with [AWS Bedrock AgentCore](https://aws.amazon.com/bedrock/agentcore/)'s browser and code interpreter sandbox tools.
## Installation
(Optional) To run the examples below, first install:
```bash
pip install llama-index llama-index-llms-bedrock-converse
```
Install the main tools package:
```bash
pip install llama-index-tools-aws-bedrock-agentcore
```
## Toolspecs
### Browser
The Bedrock AgentCore `Browser` toolspec provides a set of tools for interacting with web browsers in a secure sandbox environment. It enables your LlamaIndex agents to navigate websites, extract content, click elements, and more.
Included tools:
- `navigate_browser`: Navigate to a URL
- `click_element`: Click on an element using CSS selectors
- `extract_text`: Extract all text from the current webpage
- `extract_hyperlinks`: Extract all hyperlinks from the current webpage
- `get_elements`: Get elements matching a CSS selector
- `navigate_back`: Navigate to the previous page
- `current_webpage`: Get information about the current webpage
Example usage:
```python
import asyncio
from llama_index.llms.bedrock_converse import BedrockConverse
from llama_index.tools.aws_bedrock_agentcore import AgentCoreBrowserToolSpec
from llama_index.core.agent.workflow import FunctionAgent
import nest_asyncio
nest_asyncio.apply() # In case of existing loop (ex. in JupyterLab)
async def main():
tool_spec = AgentCoreBrowserToolSpec(region="us-west-2")
tools = tool_spec.to_tool_list()
llm = BedrockConverse(
model="us.anthropic.claude-3-7-sonnet-20250219-v1:0",
region_name="us-west-2",
)
agent = FunctionAgent(
tools=tools,
llm=llm,
)
task = "Go to https://news.ycombinator.com/ and tell me the titles of the top 5 posts."
response = await agent.run(task)
print(str(response))
await tool_spec.cleanup()
if __name__ == "__main__":
asyncio.run(main())
```
### Code Interpreter
The Bedrock AgentCore `code_interpreter` toolspec provides a set of tools interacting with a secure code interpreter sandbox environment. It enables your LlamaIndex agents to execute code, run shell commands, manage files, and perform computational task.
Included tools:
- `execute_code`: Run code in various languages (primarily Python)
- `execute_command`: Run shell commands
- `read_files`: Read content of files in the environment
- `list_files`: List files in directories
- `delete_files`: Remove files from the environment
- `write_files`: Create or update files
- `start_command`: Start long-running commands asynchronously
- `get_task`: Check status of async tasks
- `stop_task`: Stop running tasks
Example usage:
```python
import asyncio
from llama_index.llms.bedrock_converse import BedrockConverse
from llama_index.tools.aws_bedrock_agentcore import (
AgentCoreCodeInterpreterToolSpec,
)
from llama_index.core.agent.workflow import FunctionAgent
import nest_asyncio
nest_asyncio.apply() # In case of existing loop (ex. in JupyterLab)
async def main():
tool_spec = AgentCoreCodeInterpreterToolSpec(region="us-west-2")
tools = tool_spec.to_tool_list()
llm = BedrockConverse(
model="us.anthropic.claude-3-7-sonnet-20250219-v1:0",
region_name="us-west-2",
)
agent = FunctionAgent(
tools=tools,
llm=llm,
)
code_task = "Write a Python function that calculates the factorial of a number and test it."
code_response = await agent.run(code_task)
print(str(code_response))
command_task = "Use terminal CLI commands to: 1) Show the environment's Python version. 2) Show me the list of Python package currently installed in the environment."
command_response = await agent.run(command_task)
print(str(command_response))
await tool_spec.cleanup()
if __name__ == "__main__":
asyncio.run(main())
```
Raw data
{
"_id": null,
"home_page": null,
"name": "llama-index-tools-aws-bedrock-agentcore",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.10",
"maintainer_email": null,
"keywords": "agentcore, aws, bedrock",
"author": null,
"author_email": "Your Name <you@example.com>",
"download_url": "https://files.pythonhosted.org/packages/bf/d7/11fa21876e23780b26983913be078f2b8bd7beaaa943da8874a132ae99e1/llama_index_tools_aws_bedrock_agentcore-0.1.2.tar.gz",
"platform": null,
"description": "# AWS Bedrock AgentCore Tools\n\nThis module provides tools for interacting with [AWS Bedrock AgentCore](https://aws.amazon.com/bedrock/agentcore/)'s browser and code interpreter sandbox tools.\n\n## Installation\n\n(Optional) To run the examples below, first install:\n\n```bash\npip install llama-index llama-index-llms-bedrock-converse\n```\n\nInstall the main tools package:\n\n```bash\npip install llama-index-tools-aws-bedrock-agentcore\n```\n\n## Toolspecs\n\n### Browser\n\nThe Bedrock AgentCore `Browser` toolspec provides a set of tools for interacting with web browsers in a secure sandbox environment. It enables your LlamaIndex agents to navigate websites, extract content, click elements, and more.\n\nIncluded tools:\n\n- `navigate_browser`: Navigate to a URL\n- `click_element`: Click on an element using CSS selectors\n- `extract_text`: Extract all text from the current webpage\n- `extract_hyperlinks`: Extract all hyperlinks from the current webpage\n- `get_elements`: Get elements matching a CSS selector\n- `navigate_back`: Navigate to the previous page\n- `current_webpage`: Get information about the current webpage\n\nExample usage:\n\n```python\nimport asyncio\nfrom llama_index.llms.bedrock_converse import BedrockConverse\nfrom llama_index.tools.aws_bedrock_agentcore import AgentCoreBrowserToolSpec\nfrom llama_index.core.agent.workflow import FunctionAgent\n\nimport nest_asyncio\n\nnest_asyncio.apply() # In case of existing loop (ex. in JupyterLab)\n\n\nasync def main():\n tool_spec = AgentCoreBrowserToolSpec(region=\"us-west-2\")\n tools = tool_spec.to_tool_list()\n\n llm = BedrockConverse(\n model=\"us.anthropic.claude-3-7-sonnet-20250219-v1:0\",\n region_name=\"us-west-2\",\n )\n\n agent = FunctionAgent(\n tools=tools,\n llm=llm,\n )\n\n task = \"Go to https://news.ycombinator.com/ and tell me the titles of the top 5 posts.\"\n\n response = await agent.run(task)\n print(str(response))\n\n await tool_spec.cleanup()\n\n\nif __name__ == \"__main__\":\n asyncio.run(main())\n```\n\n### Code Interpreter\n\nThe Bedrock AgentCore `code_interpreter` toolspec provides a set of tools interacting with a secure code interpreter sandbox environment. It enables your LlamaIndex agents to execute code, run shell commands, manage files, and perform computational task.\n\nIncluded tools:\n\n- `execute_code`: Run code in various languages (primarily Python)\n- `execute_command`: Run shell commands\n- `read_files`: Read content of files in the environment\n- `list_files`: List files in directories\n- `delete_files`: Remove files from the environment\n- `write_files`: Create or update files\n- `start_command`: Start long-running commands asynchronously\n- `get_task`: Check status of async tasks\n- `stop_task`: Stop running tasks\n\nExample usage:\n\n```python\nimport asyncio\nfrom llama_index.llms.bedrock_converse import BedrockConverse\nfrom llama_index.tools.aws_bedrock_agentcore import (\n AgentCoreCodeInterpreterToolSpec,\n)\nfrom llama_index.core.agent.workflow import FunctionAgent\n\nimport nest_asyncio\n\nnest_asyncio.apply() # In case of existing loop (ex. in JupyterLab)\n\n\nasync def main():\n tool_spec = AgentCoreCodeInterpreterToolSpec(region=\"us-west-2\")\n tools = tool_spec.to_tool_list()\n\n llm = BedrockConverse(\n model=\"us.anthropic.claude-3-7-sonnet-20250219-v1:0\",\n region_name=\"us-west-2\",\n )\n\n agent = FunctionAgent(\n tools=tools,\n llm=llm,\n )\n\n code_task = \"Write a Python function that calculates the factorial of a number and test it.\"\n\n code_response = await agent.run(code_task)\n print(str(code_response))\n\n command_task = \"Use terminal CLI commands to: 1) Show the environment's Python version. 2) Show me the list of Python package currently installed in the environment.\"\n\n command_response = await agent.run(command_task)\n print(str(command_response))\n\n await tool_spec.cleanup()\n\n\nif __name__ == \"__main__\":\n asyncio.run(main())\n```\n",
"bugtrack_url": null,
"license": null,
"summary": "llama-index tools AWS Bedrock AgentCore integration",
"version": "0.1.2",
"project_urls": null,
"split_keywords": [
"agentcore",
" aws",
" bedrock"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "90c8bba9d450fcfd50f89e93a471bb76879473cc90a1dc62eeeacc94c7769c2b",
"md5": "916ab14ac87e525274f084a5542363b4",
"sha256": "df93279f0679374aff6185ebe404e33bec052ddea34743a280eaeaeea9834672"
},
"downloads": -1,
"filename": "llama_index_tools_aws_bedrock_agentcore-0.1.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "916ab14ac87e525274f084a5542363b4",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.10",
"size": 13911,
"upload_time": "2025-09-09T03:22:09",
"upload_time_iso_8601": "2025-09-09T03:22:09.157347Z",
"url": "https://files.pythonhosted.org/packages/90/c8/bba9d450fcfd50f89e93a471bb76879473cc90a1dc62eeeacc94c7769c2b/llama_index_tools_aws_bedrock_agentcore-0.1.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "bfd711fa21876e23780b26983913be078f2b8bd7beaaa943da8874a132ae99e1",
"md5": "ac81fadda9d4aa4a81a23506700e26bc",
"sha256": "95f1ae8aee957bdb1e729acb106796f6be513e77c563b3433da80e392fca3efc"
},
"downloads": -1,
"filename": "llama_index_tools_aws_bedrock_agentcore-0.1.2.tar.gz",
"has_sig": false,
"md5_digest": "ac81fadda9d4aa4a81a23506700e26bc",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.10",
"size": 11159,
"upload_time": "2025-09-09T03:22:09",
"upload_time_iso_8601": "2025-09-09T03:22:09.925355Z",
"url": "https://files.pythonhosted.org/packages/bf/d7/11fa21876e23780b26983913be078f2b8bd7beaaa943da8874a132ae99e1/llama_index_tools_aws_bedrock_agentcore-0.1.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-09-09 03:22:09",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "llama-index-tools-aws-bedrock-agentcore"
}