Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.
Rust agentai-agentapplecomputer-usecomputer-use-agentcontainerizationcuadesktop-automationhacktoberfestlumemacosmanusoperatorswiftvirtualizationvirtualization-frameworkwindowswindows-sandbox
Refactor Python quickstart examples to use asyncio
Luca Steingen383c13b695ab
diff --git a/docs/content/docs/get-started/quickstart.mdx b/docs/content/docs/get-started/quickstart.mdxindex 86874f225b..c81f611fb6 100644--- a/docs/content/docs/get-started/quickstart.mdx+++ b/docs/content/docs/get-started/quickstart.mdx@@ -147,6 +147,7 @@ Connect to your Cua computer and perform basic interactions, such as taking scre```pythonimport osfrom computer import Computer+ import asyncioos.environ["CUA_API_KEY"] = "sk_cua-api01_..."@@ -155,42 +156,101 @@ Connect to your Cua computer and perform basic interactions, such as taking screprovider_type="cloud",name="your-sandbox-name" # from CLI or website)- await computer.run() # Connect to the sandbox++ async def main():+ await computer.run() # Connect to the sandbox++ try:+ # Take a screenshot of the computer's current display+ screenshot = await computer.interface.screenshot()+ # Simulate a left-click at coordinates (100, 100)+ await computer.interface.left_click(100, 100)+ # Type "Hello!" into the active application+ await computer.interface.type_text("Hello!")+ finally:+ await computer.disconnect()++ asyncio.run(main())```</Tab><Tab value="Linux on Docker">```pythonfrom computer import Computer+ import asynciocomputer = Computer(os_type="linux",provider_type="docker",image="trycua/cua-xfce:latest" # or "trycua/cua-ubuntu:latest")- await computer.run() # Launch & connect to the sandbox++ async def main():+ await computer.run() # Launch & connect to the sandbox++ try:+ # Take a screenshot of the computer's current display+ screenshot = await computer.interface.screenshot()+ # Simulate a left-click at coordinates (100, 100)+ await computer.interface.left_click(100, 100)+ # Type "Hello!" into the active application+ await computer.interface.type_text("Hello!")+ finally:+ await computer.disconnect()++ asyncio.run(main())```</Tab><Tab value="macOS Sandbox">```pythonfrom computer import Computer+ import asynciocomputer = Computer(os_type="macos",provider_type="lume",name="macos-sequoia-cua:latest")- await computer.run() # Launch & connect to the sandbox++ async def main():+ await computer.run() # Launch & connect to the sandbox++ try:+ # Take a screenshot of the computer's current display+ screenshot = await computer.interface.screenshot()+ # Simulate a left-click at coordinates (100, 100)+ await computer.interface.left_click(100, 100)+ # Type "Hello!" into the active application+ await computer.interface.type_text("Hello!")+ finally:+ await computer.disconnect()++ asyncio.run(main())```</Tab><Tab value="Windows Sandbox">```pythonfrom computer import Computer+ import asynciocomputer = Computer(os_type="windows",provider_type="windows_sandbox")- await computer.run() # Launch & connect to the sandbox++ async def main():+ await computer.run() # Launch & connect to the sandbox++ try:+ # Take a screenshot of the computer's current display+ screenshot = await computer.interface.screenshot()+ # Simulate a left-click at coordinates (100, 100)+ await computer.interface.left_click(100, 100)+ # Type "Hello!" into the active application+ await computer.interface.type_text("Hello!")+ finally:+ await computer.disconnect()++ asyncio.run(main())```</Tab><Tab value="Your host desktop">@@ -203,26 +263,28 @@ Connect to your Cua computer and perform basic interactions, such as taking screThen, use the `Computer` object to connect:```pythonfrom computer import Computer+ import asynciocomputer = Computer(use_host_computer_server=True)- await computer.run() # Connect to the host desktop++ async def main():+ await computer.run() # Connect to the host desktop++ try:+ # Take a screenshot of the computer's current display+ screenshot = await computer.interface.screenshot()+ # Simulate a left-click at coordinates (100, 100)+ await computer.interface.left_click(100, 100)+ # Type "Hello!" into the active application+ await computer.interface.type_text("Hello!")+ finally:+ await computer.disconnect()++ asyncio.run(main())```</Tab></Tabs>- Once connected, you can perform interactions:- ```python- try:- # Take a screenshot of the computer's current display- screenshot = await computer.interface.screenshot()- # Simulate a left-click at coordinates (100, 100)- await computer.interface.left_click(100, 100)- # Type "Hello!" into the active application- await computer.interface.type_text("Hello!")- finally:- await computer.close()- ```-</Tab><Tab value="TypeScript"><Callout type="warn" title="TypeScript SDK Deprecated">@@ -316,7 +378,7 @@ Connect to your Cua computer and perform basic interactions, such as taking scre// Type "Hello!" into the active applicationawait computer.interface.typeText("Hello!");} finally {- await computer.close();+ await computer.disconnect();}```@@ -349,22 +411,38 @@ Choose how you want to access vision-language models for your agent:**Use the agent with CUA models:**```pythonimport os+ import asyncio+ from computer import Computerfrom agent import ComputerAgentos.environ["CUA_API_KEY"] = "sk_cua-api01_..."- agent = ComputerAgent(- model="cua/anthropic/claude-sonnet-4.5", # CUA-routed model- tools=[computer],- max_trajectory_budget=5.0+ computer = Computer(+ os_type="linux", # or "windows" or "macos"+ provider_type="cloud",+ name="your-sandbox-name" # from CLI or website)- messages = [{"role": "user", "content": "Take a screenshot and tell me what you see"}]+ async def main():+ await computer.run() # Connect to the sandbox- async for result in agent.run(messages):- for item in result["output"]:- if item["type"] == "message":- print(item["content"][0]["text"])+ try:+ agent = ComputerAgent(+ model="cua/anthropic/claude-sonnet-4.5", # CUA-routed model+ 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"])+ finally:+ await computer.disconnect()++ asyncio.run(main())```**Available CUA models:**@@ -386,6 +464,8 @@ Choose how you want to access vision-language models for your agent:**Use the agent with your provider:**```pythonimport os+ import asyncio+ from computer import Computerfrom agent import ComputerAgent# Set your provider API key@@ -393,18 +473,32 @@ Choose how you want to access vision-language models for your agent:# ORos.environ["OPENAI_API_KEY"] = "sk-..." # For OpenAI- agent = ComputerAgent(- model="anthropic/claude-sonnet-4-5-20250929", # Direct provider model- tools=[computer],- max_trajectory_budget=5.0+ computer = Computer(+ os_type="linux", # or "windows" or "macos"+ provider_type="docker",+ image="trycua/cua-xfce:latest" # or "trycua/cua-ubuntu:latest")- messages = [{"role": "user", "content": "Take a screenshot and tell me what you see"}]+ async def main():+ await computer.run() # Launch & connect to the sandbox++ try:+ agent = ComputerAgent(+ model="anthropic/claude-sonnet-4-5-20250929", # Direct provider model+ 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"])+ finally:+ await computer.disconnect()- async for result in agent.run(messages):- for item in result["output"]:- if item["type"] == "message":- print(item["content"][0]["text"])+ asyncio.run(main())```**Supported providers:**