The Cloud Sandbox Built for AI Agents
AgentBay provides on-demand cloud sandboxes for AI agents β isolated environments with browser, desktop, mobile, and code execution capabilities. Create a sandbox in seconds, let your agent do its work, and tear it down when done. No infrastructure to manage.
With SDKs for Python, TypeScript, Golang, and Java, AgentBay gives your agents a full cloud environment through a simple API: execute commands, browse the web, automate desktop apps, test mobile UIs, or run code β all in secure, disposable sandboxes.
Before using the SDK, you need to:
- Register an Alibaba Cloud account: https://aliyun.com
- Get APIKEY credentials: AgentBay Console
- Set environment variable:
- For Linux/MacOS:
export AGENTBAY_API_KEY=your_api_key_here - For Windows:
setx AGENTBAY_API_KEY your_api_key_here
- For Linux/MacOS:
| Language | Install Command | Documentation |
|---|---|---|
| Python | pip install wuying-agentbay-sdk |
Python Docs |
| TypeScript | npm install wuying-agentbay-sdk |
TypeScript Docs |
| Golang | go get github.com/aliyun/wuying-agentbay-sdk/golang/pkg/agentbay |
Golang Docs |
| Java | See Maven snippet below | Java Docs |
Java Maven dependency
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>agentbay-sdk</artifactId>
<version>0.19.0</version>
</dependency>from agentbay import AgentBay, CreateSessionParams
agent_bay = AgentBay()
# Create a cloud sandbox (options: "code_latest", "browser_latest", "desktop_latest")
session = agent_bay.create(CreateSessionParams(image_id="code_latest")).session
# Execute code in the sandbox
result = session.code.run_code("print('Hello AgentBay')", "python")
if result.success:
print(result.result) # Hello AgentBay
agent_bay.delete(session)import { AgentBay } from 'wuying-agentbay-sdk';
const agentBay = new AgentBay();
// Create a cloud sandbox
const session = (await agentBay.create({ imageId: "code_latest" })).session;
// Execute code in the sandbox
const result = await session.code.runCode("print('Hello AgentBay')", "python");
if (result.success) {
console.log(result.result); // Hello AgentBay
}
await agentBay.delete(session);import "github.com/aliyun/wuying-agentbay-sdk/golang/pkg/agentbay"
client, _ := agentbay.NewAgentBay("", nil)
// Create a cloud sandbox
result, _ := client.Create(agentbay.NewCreateSessionParams().WithImageId("code_latest"))
session := result.Session
// Execute code in the sandbox
res, _ := session.Code.RunCode("print('Hello AgentBay')", "python")
fmt.Println(res.Output) // Hello AgentBay
client.Delete(session, false)import com.aliyun.agentbay.*;
AgentBay agentBay = new AgentBay();
// Create a cloud sandbox
CreateSessionParams params = new CreateSessionParams().setImageId("code_latest");
Session session = agentBay.create(params).getSession();
// Execute code in the sandbox
CodeExecutionResult result = session.getCode().runCode("print('Hello AgentBay')", "python");
if (result.isSuccess()) {
System.out.println(result.getResult()); // Hello AgentBay
}
agentBay.delete(session, false);New to AgentBay? Start with the Quick Start Tutorial β you'll be up and running in 5 minutes.
| Resource | Description |
|---|---|
| Quick Start Tutorial | Get started in 5 minutes |
| Core Concepts | Understand sessions, environments, and sandboxes |
| Feature Guides | In-depth guides for each capability |
| API Reference | Complete API docs (Python Β· TypeScript Β· Golang Β· Java) |
| Cookbook | Real-world examples and recipes |
- Session Lifecycle β Create, manage, and delete cloud sandboxes on demand
- Environment Configuration β Configure regions, endpoints, and sandbox images
- Session Monitoring β Monitor status and health
- Command Execution β Run shell commands in cloud sandboxes
- File Operations β Upload, download, and manage files
- Context & Data Persistence β Save and retrieve data across sessions
- Git Operations β Clone, commit, and manage repositories remotely
If you're using AI coding assistants (Claude, Cursor, GitHub Copilot, etc.) to develop with AgentBay SDK, use these files as context:
- llms.txt β Concise overview (~14k tokens, ~55 KB)
- llms-full.txt β Full SDK source, API docs, and examples (~211k tokens, ~827 KB)
Welcome to visit our product website and join our community!
- π AgentBay International Website: https://www.alibabacloud.com/product/agentbay
- π¨π³ AgentBay China Website (Chinese): https://www.aliyun.com/product/agentbay
- π¬ Discord Community: Join on Discord
- πΌ DingTalk Group: Click to join
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.



