Getting Started

1

Install the SDK

pip install orgo
2

Set up your environment

Add your API key to your environment variables:

# In your terminal
export ORGO_API_KEY=your_api_key

# Or in a '.env' file
ORGO_API_KEY=your_api_key

Don’t have an API key? Create an account to get one.

3

Connect to a computer

Create a connection to a virtual computer:

from orgo import Computer

# Start a new computer
computer = Computer()  # Uses 'ORGO_API_KEY' environment variable

# Or connect to an existing one
computer = Computer(project_id="existing_id")
4

Perform actions

Control the computer with simple commands:

# Mouse actions
computer.left_click(100, 200)
computer.right_click(300, 400)
computer.double_click(500, 300)

# Keyboard input
computer.type("Hello world")
computer.key("Enter")

# Take a screenshot
screenshot = computer.screenshot()

# Manage computer state
computer.stop()    # Stop the computer
computer.start()   # Start it again
computer.restart() # Restart the computer

Computers automatically stop during inactivity, so manual lifecycle management is optional. The stop() and start() methods are provided for flexibility when you need explicit control.

5

Use natural language with Claude

To use the prompt() method with Claude, first install the Anthropic SDK:

pip install anthropic

Then set your Anthropic API key and use natural language to control the computer:

# Set the Anthropic API key as an environment variable
import os
os.environ["ANTHROPIC_API_KEY"] = "your_anthropic_api_key"

# Or set it in your .env file:
# ANTHROPIC_API_KEY=your_anthropic_api_key

# Control computer with natural language
computer.prompt("Open Firefox and search for 'Anthropic Claude'")

The prompt() method handles all the agent loop interactions with Claude automatically. Make sure you have the anthropic package installed and your ANTHROPIC_API_KEY environment variable set.

Complete Example

Here’s a full example of using Orgo with Anthropic Claude:

import os
from orgo import Computer

# Set API keys in environment variables
os.environ["ORGO_API_KEY"] = "your_orgo_api_key"
os.environ["ANTHROPIC_API_KEY"] = "your_anthropic_api_key"

# Initialize computer
computer = Computer()

try:
    # Define a callback to track progress (optional)
    def progress_callback(event_type, event_data):
        if event_type == "text":
            print(f"Claude: {event_data}")
        elif event_type == "tool_use":
            print(f"Action: {event_data['action']}")
        elif event_type == "error":
            print(f"Error: {event_data}")
    
    # Let Claude control the computer
    messages = computer.prompt(
        "Open Firefox, go to anthropic.com, and take a screenshot of the homepage",
        callback=progress_callback,  # Optional
        model="claude-sonnet-4-20250514",  # Optional, this is the default
        thinking_enabled=True,  # Optional, shows Claude's reasoning (Claude 3.7+)
        max_iterations=10  # Optional, default is 20
    )
    
    print("Task complete!")
    
    # You can access the conversation history in the returned messages
    for msg in messages:
        if msg["role"] == "assistant":
            for content_block in msg["content"]:
                if content_block.type == "thinking":
                    print(f"Claude's thinking: {content_block.thinking}")
finally:
    # Clean up
    computer.destroy()

Remember to call destroy() when finished to free up your project slot. The free tier allows 1 concurrent desktop.

Manual Agent Loop

If you need more control over the agent loop or want to create a custom implementation, you can use the lower-level APIs:

import os
import anthropic
from orgo import Computer

# Set up API keys
os.environ["ORGO_API_KEY"] = "your_orgo_api_key"
api_key = "your_anthropic_api_key"

# Initialize components
computer = Computer()
client = anthropic.Anthropic(api_key=api_key)

try:
    # Initial request
    messages = [{"role": "user", "content": "Open Firefox and go to anthropic.com"}]
    
    # Define the computer tool
    tools = [
        {
            "type": "computer_20250124",
            "name": "computer", 
            "display_width_px": 1024,
            "display_height_px": 768,
            "display_number": 1
        }
    ]
    
    # Start the conversation
    response = client.beta.messages.create(
        model="claude-sonnet-4-20250514",
        messages=messages,
        tools=tools,
        betas=["computer-use-2025-01-24"],
        max_tokens=4096
    )
    
    # Add Claude's response to the conversation
    messages.append({"role": "assistant", "content": response.content})
    
    # Loop until Claude doesn't request any more tools
    while True:
        # Check if Claude used any tools
        tool_results = []
        
        for block in response.content:
            if block.type == "tool_use":
                # Get the tool parameters
                action = block.input.get("action")
                
                # Execute the tool action
                result = None
                if action == "screenshot":
                    response_data = computer.screenshot_base64()
                    result = {
                        "type": "image",
                        "source": {
                            "type": "base64",
                            "media_type": "image/jpeg",
                            "data": response_data
                        }
                    }
                elif action == "left_click":
                    x, y = block.input.get("coordinate", [0, 0])
                    computer.left_click(x, y)
                    result = {"type": "text", "text": f"Left click at ({x}, {y}) successful"}
                elif action == "type":
                    text = block.input.get("text", "")
                    computer.type(text)
                    result = {"type": "text", "text": f"Typed: {text}"}
                
                # Format the result for Claude
                tool_results.append({
                    "type": "tool_result",
                    "tool_use_id": block.id,
                    "content": [result] if result else [{"type": "text", "text": "Action completed"}]
                })
        
        # If no tools were used, Claude is done
        if not tool_results:
            break
            
        # Send tool results back to Claude
        messages.append({"role": "user", "content": tool_results})
        
        # Get Claude's next response
        response = client.beta.messages.create(
            model="claude-sonnet-4-20250514",
            messages=messages,
            tools=tools,
            betas=["computer-use-2025-01-24"],
            max_tokens=4096
        )
        
        # Add Claude's response to the conversation
        messages.append({"role": "assistant", "content": response.content})
    
    print("Task complete!")
    
finally:
    # Clean up
    computer.destroy()

Next Steps