Files
computer/docs/content/docs/quickstart-devs.mdx
2025-07-31 18:18:56 +01:00

128 lines
2.8 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>
## Create Your First cua Container
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
</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