# AgentBay SDK: cloud sandboxes for AI agents, in Python, TypeScript, Go and Java

> The wuying-agentbay-sdk wraps Alibaba Cloud's AgentBay service in four language SDKs. It gives an agent a disposable browser, desktop, mobile or code environment, but it needs an Alibaba Cloud account and an API key before the first line of code runs.

**agentbay-ai/wuying-agentbay-sdk** — The Cloud Sandbox Built for AI Agents

- Repository: https://github.com/agentbay-ai/wuying-agentbay-sdk
- Website: https://www.aliyun.com/product/agentbay
- Stars: 1,144 · Forks: 60
- Language: Python
- License: Apache-2.0
- Published: 2026-09-10 · Updated: 2026-09-10 · Language: en
- Canonical page: https://hysenlabs.com/projects/agentbay-ai-wuying-agentbay-sdk

## What AgentBay gives an agent that a local container does not

The core problem is that an agent which only writes text cannot do much of the work people want from it. Clicking through a web form, driving a legacy desktop application, or testing a mobile UI all need a real graphical environment. Standing that environment up yourself means provisioning machines, images and cleanup jobs, and then doing it again for every concurrent agent. AgentBay sells that as a service: the README describes on-demand cloud sandboxes with browser, desktop, mobile and code execution capabilities, created in seconds and torn down when the agent is finished. The intended user is a team building agents that need to act, not just answer. The repository ships clients for Python, TypeScript, Golang and Java, so the same service is reachable from whichever stack the agent is already written in. The README also links an arXiv paper, which suggests the project is tied to published work rather than being a pure product wrapper, though the README itself does not summarise what that paper covers.

## Sessions, image IDs and the four capability surfaces

The unit of work is a session. You call create with a CreateSessionParams object carrying an image_id, and you get back a session handle that exposes the capability surfaces. The README lists three image options: code_latest, browser_latest and desktop_latest. That choice is the main architectural decision a caller makes, because it determines which environment the agent lands in. Code execution then goes through a run_code call that takes a source string and a language name, and returns an object with a success flag and a result payload. Cleanup is an explicit delete call on the session. The README does not describe what happens to a session if the process crashes before delete runs, and it does not document an automatic expiry window. That is the gap to close before running this at volume: the lifecycle is caller-managed in every example shown, and the documentation does not state a server-side fallback.

## Installing the SDK and running your first sandbox

The README lists prerequisites before any code: register an Alibaba Cloud account, get APIKEY credentials from the AgentBay console, and export the key as an environment variable. On Linux or macOS the README gives this command, and on Windows it gives setx with the same variable name.

```bash
export AGENTBAY_API_KEY=your_api_key_here
```

Installation is per language. For Python the package name on PyPI is wuying-agentbay-sdk, which is not the same as the import name used in the code samples.

```bash
pip install wuying-agentbay-sdk
```

The README's Python quick start constructs an AgentBay client with no arguments, which implies the key is read from the environment, creates a session with image_id set to code_latest, runs a one-line Python program, and deletes the session. The expected output is the string printed by the sandbox, shown in the README as Hello AgentBay.

```python
from agentbay import AgentBay, CreateSessionParams

agent_bay = AgentBay()
session = agent_bay.create(CreateSessionParams(image_id="code_latest")).session
result = session.code.run_code("print('Hello AgentBay')", "python")
if result.success:
    print(result.result)
agent_bay.delete(session)
```

The TypeScript, Golang and Java samples follow the same shape with different casing: create, runCode or RunCode, then delete. Java is installed through a Maven dependency on com.aliyun:agentbay-sdk, and the README pins that snippet at version 0.20.0 while the latest release tag in the repository is v0.22.0.

## The account dependency is the real adoption cost

Every code path starts with a credential from the AgentBay console, which sits behind an Alibaba Cloud account. There is no self-hosted mode described in the README and no local emulator. That means the SDK is not a library you can evaluate offline: the first meaningful test requires registration, a console visit and a live key. For a team already on Alibaba Cloud this is close to free. For a team on another cloud, it introduces a second vendor, a second billing relationship and a second set of regional and compliance questions that the README does not address. The README also does not document rate limits, per-account session quotas, or pricing. Those are the numbers that decide whether an agent fleet is viable, and they live in the console rather than in the repository. Treat the SDK as the easy half of the decision.

## When a plain container is the better answer

The obvious alternative for code execution is a local container: Docker with a Python image, driven by the Docker SDK or a subprocess call. The difference in approach is where isolation lives. A container shares your host kernel and your machine's resources, starts in well under a second, and costs nothing per run, but it cannot give an agent a real browser with a display, a desktop application, or a mobile device. AgentBay's model is the opposite trade: a remote environment with graphical surfaces and no local resource cost, paid for with network latency, an API key and a vendor relationship. If your agent only runs scripts and reads files, the container wins on every axis except setup convenience. The remote sandbox earns its place when the task needs a screen, a device profile, or parallel environments that would not fit on one machine. The README's four capability tiles map exactly onto that boundary.

## Maintenance, releases and the licence

The repository is not archived, and the last push was on 2026-06-08, roughly three months before this writing. Releases have moved steadily: v0.21.0 in May 2026, v0.22.0 in June 2026, with a parallel golang/v0.21.0 tag published the same day as the main v0.21.0. That parallel tagging is worth noting if you consume the Go module, because the Go client appears to version on its own track. The version numbers are all 0.x, so the API can change between minors and you should read CHANGELOG.md before upgrading rather than assuming compatibility. The Java snippet in the README lags the latest tag, which is a small sign that one language binding moves slower than the others. The licence is Apache-2.0, a permissive licence that allows commercial use and modification, but the SDK is a client for a paid hosted service: the licence governs the code you install, not the sandbox you consume, and the terms for the service itself come from Alibaba Cloud. Nothing here is legal advice; check the service terms separately from the repository licence.

## What to check before committing to the SDK

Three things are worth confirming early. First, whether the client in your language picks up AGENTBAY_API_KEY automatically. The Python, TypeScript and Java samples in the README all construct the client with no arguments, while the Golang sample passes an empty string and a nil as the first two arguments, which suggests the Go binding resolves credentials differently. Second, which image_id matches your workload. Picking code_latest when the agent needs a browser is a silent mismatch that only shows up at runtime. Third, whether session cleanup is guaranteed in your control flow. Every README example deletes the session explicitly, and the documentation does not describe a timeout that would clean up an orphaned session for you, so a crashed worker may leave a session running. Wrap create and delete so the delete path runs even when the agent's own logic throws.

## Conclusion

Adopt AgentBay if your agents need a full desktop, mobile or browser environment and you already run on Alibaba Cloud, or you are willing to register there for the API key. Do not adopt it for a pure Linux command sandbox, where a local container is cheaper and has no vendor dependency, and do not adopt it if you need the sandbox to run on your own hardware. Before writing production code, verify three things: whether the SDK reads AGENTBAY_API_KEY from the process environment in your target language, which image_id your workload needs among code_latest, browser_latest and desktop_latest, and whether your account has quota for the session count you plan. The README's five-minute quick start is the fastest way to confirm all three.

## FAQ

### Is Alibaba Cloud, the account behind AgentBay, legitimate?

The AgentBay SDK requires an Alibaba Cloud account and APIKEY credentials from the AgentBay console before any session can be created, so the account is a hard prerequisite of using the SDK. The README links aliyun.com for registration.

### What are the top 3 AI agents?

The README does not compare or rank AI agents. It describes AgentBay as infrastructure that gives agents browser, desktop, mobile and code execution capabilities in cloud sandboxes, and leaves the agent framework choice to the caller.

### What are the 7 types of AI agents?

The README does not list agent types or taxonomies. It documents the sandbox capabilities an agent can call: browser use, computer use, mobile use and code space, each with its own guide under docs/guides.

### What companies use Alibaba Cloud?

The README does not name customer companies. It only states that an Alibaba Cloud account is required to obtain the APIKEY credentials that the AgentBay SDK uses.

## Sources

- [agentbay-ai/wuying-agentbay-sdk on GitHub](https://github.com/agentbay-ai/wuying-agentbay-sdk)
- [License: Apache-2.0](https://github.com/agentbay-ai/wuying-agentbay-sdk/blob/main/LICENSE)
- [Project website](https://www.aliyun.com/product/agentbay)
- [README](https://github.com/agentbay-ai/wuying-agentbay-sdk/blob/main/README.md)
- [Releases](https://github.com/agentbay-ai/wuying-agentbay-sdk/releases)

---

Hysen Labs editorial analysis, written from the project's own repository and release notes. Cite the canonical page: https://hysenlabs.com/projects/agentbay-ai-wuying-agentbay-sdk
