LlamaIndex Tools Integration: AgentBay
AgentBay tools integration for LlamaIndex, enabling browser automation, file operations, and command execution.
Installation
pip install llama-index-tools-agentbay llama-index-llms-openai-like
Setup
Set your API keys as environment variables:
export AGENTBAY_API_KEY="your-agentbay-api-key"
export DASHSCOPE_API_KEY="your-dashscope-api-key" # Optional: For DashScope LLM
Quick Start
Use the context manager for automatic resource cleanup:
import os
import asyncio
from llama_index.llms.openai_like import OpenAILike
from llama_index.core.agent import ReActAgent
from llama_index.tools.agentbay import create_code_tools, AgentBaySessionManager
from contextlib import contextmanager
@contextmanager
def agentbay_tools():
manager = AgentBaySessionManager(api_key=os.getenv("AGENTBAY_API_KEY"))
try:
yield create_code_tools(manager)
finally:
manager.cleanup()
async def main():
llm = OpenAILike(
model="qwen-plus",
api_key=os.getenv("DASHSCOPE_API_KEY"),
api_base="https://dashscope.aliyuncs.com/compatible-mode/v1",
is_chat_model=True
)
with agentbay_tools() as tools:
# Note: ReActAgent in llama-index-core >= 0.14.0 is workflow-based
agent = ReActAgent.from_tools(tools, llm=llm, verbose=True)
response = await agent.achat("Calculate the 10th Fibonacci number using Python")
print(response.response)
if __name__ == "__main__":
asyncio.run(main())
Available Tools
- Code Execution:
create_code_tools(Recommended) - Run Python/JS code directly. - Browser Automation:
create_browser_tools- Take screenshots, inspect pages. - File Operations:
create_filesystem_tools- Read/Write files. - Command Execution:
create_command_tools- Run shell commands.
RAG Integration
Extract insights from execution results:
from llama_index.tools.agentbay import create_rag_manager
rag = create_rag_manager()
rag.add_execution_result("result content", "task description")
print(rag.query("What was the result?"))
Support
License
MIT
Metadata
Release files for llama-index-tools-agentbay 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| llama_index_tools_agentbay-0.1.4.tar.gz | 12.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| llama_index_tools_agentbay-0.1.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 27.9 kB
Release files / llama_index_tools_agentbay-0.1.4.tar.gz
| Download URL | llama_index_tools_agentbay-0.1.4.tar.gz |
|---|---|
| Size | 12.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2defa46653acac21f371e9d598d670303140141cacc3518933f8fdb3bb2aac8f
|
|
BLAKE2b-256 checksum How to use checksums |
1bb26776784643d084e7030a7e9cfb4e6c1096d968c55cdf1800393e35fe1221
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.2.1 CPython/3.13.7 Darwin/24.6.0
|
Release files / llama_index_tools_agentbay-0.1.4-py3-none-any.whl
| Download URL | llama_index_tools_agentbay-0.1.4-py3-none-any.whl |
|---|---|
| Size | 15.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
16d6b936860ffb6a27d8aa5c0d2358c0ad42be42f3d2a33ae57439ef1ce95397
|
|
BLAKE2b-256 checksum How to use checksums |
9226f8b273273dbc640444a6f76b0421e54a8f4492912c065c66bd15acc3f2ef
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.2.1 CPython/3.13.7 Darwin/24.6.0
|