Files
computer/docs/content/docs/quickstart-devs.mdx
2025-08-26 12:19:43 +02:00

184 lines
4.1 KiB
Plaintext

---
title: Quickstart (for Developers)
description: Get started with cua in 5 steps
icon: Rocket
---
import { Step, Steps } from 'fumadocs-ui/components/steps';
import { Tab, Tabs } from 'fumadocs-ui/components/tabs';
Get up and running with cua in 5 simple steps.
<Steps>
<Step>
## Introduction
cua combines Computer (interface) + Agent (AI) for automating desktop apps. Computer handles clicks/typing, Agent provides the intelligence.
</Step>
<Step>
## Set Up Your Computer Environment
Choose how you want to run your cua computer. **Cloud containers are recommended** for the easiest setup:
<Tabs items={['☁️ Cloud (Recommended)', 'Lume (macOS Only)', 'Windows Sandbox (Windows Only)', 'Docker (Cross-Platform)']}>
<Tab value="☁️ Cloud (Recommended)">
**Easiest & safest way to get started**
1. Go to [trycua.com/signin](https://www.trycua.com/signin)
2. Navigate to **Dashboard > Containers > Create Instance**
3. Create a **Medium, Ubuntu 22** container
4. Note your container name and API key
Your cloud container will be automatically configured and ready to use.
</Tab>
<Tab value="Lume (macOS Only)">
1. Install lume cli
```bash
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/trycua/cua/main/libs/lume/scripts/install.sh)"
```
2. Start a local cua container
```bash
lume run macos-sequoia-cua:latest
```
</Tab>
<Tab value="Windows Sandbox (Windows Only)">
1. Enable Windows Sandbox (requires Windows 10 Pro/Enterprise or Windows 11)
2. Install pywinsandbox dependency
```bash
pip install -U git+git://github.com/karkason/pywinsandbox.git
```
3. Windows Sandbox will be automatically configured when you run the CLI
</Tab>
<Tab value="Docker (Cross-Platform)">
1. Install Docker Desktop or Docker Engine
2. Pull the CUA Ubuntu container
```bash
docker pull --platform=linux/amd64 trycua/cua-ubuntu:latest
```
</Tab>
</Tabs>
</Step>
<Step>
## Install cua
<Tabs items={['Python', 'TypeScript']}>
<Tab value="Python">
```bash
pip install "cua-agent[all]" cua-computer
```
</Tab>
<Tab value="TypeScript">
```bash
npm install @trycua/computer
```
</Tab>
</Tabs>
</Step>
<Step>
## Using Computer
<Tabs items={['Python', 'TypeScript']}>
<Tab value="Python">
```python
from computer import Computer
async with Computer(
os_type="linux",
provider_type="cloud",
name="your-container-name",
api_key="your-api-key"
) as computer:
# Take screenshot
screenshot = await computer.interface.screenshot()
# Click and type
await computer.interface.left_click(100, 100)
await computer.interface.type("Hello!")
```
</Tab>
<Tab value="TypeScript">
```typescript
import { Computer, OSType } from '@trycua/computer';
const computer = new Computer({
osType: OSType.LINUX,
name: "your-container-name",
apiKey: "your-api-key"
});
await computer.run();
try {
// Take screenshot
const screenshot = await computer.interface.screenshot();
// Click and type
await computer.interface.leftClick(100, 100);
await computer.interface.typeText("Hello!");
} finally {
await computer.close();
}
```
</Tab>
</Tabs>
</Step>
<Step>
## Using Agent
```python
from agent import ComputerAgent
agent = ComputerAgent(
model="anthropic/claude-3-5-sonnet-20241022",
tools=[computer],
max_trajectory_budget=5.0
)
messages = [{"role": "user", "content": "Take a screenshot and tell me what you see"}]
async for result in agent.run(messages):
for item in result["output"]:
if item["type"] == "message":
print(item["content"][0]["text"])
```
</Step>
</Steps>
## Next Steps
{/* - Explore the [SDK documentation](/sdk) for advanced features */}
- Learn about [trajectory tracking](/agent-sdk/callbacks/trajectories) and [callbacks](/agent-sdk/callbacks/agent-lifecycle)
- Join our [Discord community](https://discord.com/invite/mVnXXpdE85) for support