This topic describes how to use the AgentBay software development kit (SDK) for various automation scenarios. It provides practical examples, use cases, and basic implementation code. The guides also demonstrate how to integrate the SDK with popular developer frameworks, such as LangChain, to help developers quickly get started and integrate the SDK into their projects.
Sandbox environments (envs)
The envs folder contains examples organized by sandbox environment. In AgentBay, a sandbox environment is an isolated cloud computing environment used to safely and efficiently perform specific types of operations. Each environment provides specialized features for different use cases.
Two sandbox environments are available:
browser: A web browser sandbox environment that provides web automation features, such as form filling, web scraping, and UI interactions.
codespace: A code execution sandbox environment that provides features for running and testing code in an isolated environment.
Getting started
Obtain an AgentBay API key and install the SDK.
Set the environment variables in one of the following ways:
Directly export the environment variable:
export AGENTBAY_API_KEY=your_api_key_hereRecommended method: Use the
.envfile in each tutorial folder.
The tutorials may require additional API keys, such as a DashScope API key for Large Language Model (LLM) features.
Select a specific tutorial.
Follow the setup instructions in the tutorial.
Run the example script to see the SDK in action.
Tutorials
The AgentBay SDK provides a comprehensive set of tools for efficient interaction with the AgentBay cloud environment. The following tutorials demonstrate the practical applications of the SDK in different areas:
Form filling
This tutorial demonstrates how to create a form-filling agent using the AgentBay SDK. The agent can:
Upload an HTML form to the AgentBay environment.
Open the form in a browser using the AgentBay browser feature.
Fill in the form fields using natural language instructions.
Automatically submit the form.
Automated testing
This tutorial demonstrates how to create a testing agent using LangChain and the AgentBay SDK. The agent can:
Scan a Python project to identify modules that require testing.
Generate test cases using an LLM based on the project structure.
Execute tests in an isolated AgentBay cloud session.
Save the test results to a local log file.
Framework integration
Each tutorial is structured to support multiple agent frameworks. Currently, most examples include LangChain integration, with plans to extend support to other frameworks. The projects use a modular structure that separates core features from framework-specific integrations:
cookbook-name/
├── README.md # Documentation
├── .env # Environment variables
├── common/ # Common core features
│ └── src/ # Framework-agnostic code
└── framework-name/ # Framework integration (such as langchain)
├── data/ # Output data folder
├── src/ # Framework-specific code
└── requirements.txt # Dependencies (for Python)