llama-index-tools-aws-bedrock-agentcore


Namellama-index-tools-aws-bedrock-agentcore JSON
Version 0.1.0 PyPI version JSON
download
home_pageNone
Summaryllama-index tools AWS Bedrock AgentCore integration
upload_time2025-08-04 15:24:59
maintainerNone
docs_urlNone
authorNone
requires_python<4.0,>=3.10
licenseNone
keywords agentcore aws bedrock
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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/9a/53/b7b27955a9a5dddcdccf91e9d2a40e25da8fdb489ae0cdd0894d0ec5b46e/llama_index_tools_aws_bedrock_agentcore-0.1.0.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.0",
    "project_urls": null,
    "split_keywords": [
        "agentcore",
        " aws",
        " bedrock"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "21e9b155f08c363d5cf2e7a405bb72e436971451d4e3d76e752132710308ac2d",
                "md5": "171959f57aa9a555807d532289d8668c",
                "sha256": "410d4a6cdea776c05977793e439e5f54f39078082504b96770301de3c8791ab5"
            },
            "downloads": -1,
            "filename": "llama_index_tools_aws_bedrock_agentcore-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "171959f57aa9a555807d532289d8668c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.10",
            "size": 13912,
            "upload_time": "2025-08-04T15:24:58",
            "upload_time_iso_8601": "2025-08-04T15:24:58.077156Z",
            "url": "https://files.pythonhosted.org/packages/21/e9/b155f08c363d5cf2e7a405bb72e436971451d4e3d76e752132710308ac2d/llama_index_tools_aws_bedrock_agentcore-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "9a53b7b27955a9a5dddcdccf91e9d2a40e25da8fdb489ae0cdd0894d0ec5b46e",
                "md5": "572d3b42d7918122fce179d282d8f18b",
                "sha256": "d415a71b0ae95a4a886a501360aea14b1c92f04711c7fced61135db0fbcfe734"
            },
            "downloads": -1,
            "filename": "llama_index_tools_aws_bedrock_agentcore-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "572d3b42d7918122fce179d282d8f18b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.10",
            "size": 11161,
            "upload_time": "2025-08-04T15:24:59",
            "upload_time_iso_8601": "2025-08-04T15:24:59.007625Z",
            "url": "https://files.pythonhosted.org/packages/9a/53/b7b27955a9a5dddcdccf91e9d2a40e25da8fdb489ae0cdd0894d0ec5b46e/llama_index_tools_aws_bedrock_agentcore-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-04 15:24:59",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "llama-index-tools-aws-bedrock-agentcore"
}
        
Elapsed time: 2.26443s