Files
lume/libs/python/computer
f-trycua 73c0f3e52e Add automatic CUA_API_KEY environment variable support for Computer and CloudProvider
Previously, users had to explicitly read the CUA_API_KEY environment variable
and pass it to the Computer/CloudProvider constructor. This change makes the
API key parameter optional and automatically reads from the CUA_API_KEY
environment variable if not provided.

Changes:
- CloudProvider.__init__: Made api_key parameter optional, reads from CUA_API_KEY env var
- Computer.__init__: Added fallback to CUA_API_KEY env var for api_key parameter
- Updated documentation examples to show simplified usage without explicit api_key
- Updated cloud_api_examples.py to demonstrate the new simpler pattern

This provides a cleaner API while maintaining backward compatibility with
explicit api_key parameter passing.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-19 19:35:32 +01:00
..
2025-11-11 22:25:19 +00:00
2025-11-11 22:25:19 +00:00

Shows my svg

Python macOS Discord PyPI

cua-computer is a Computer-Use Interface (CUI) framework powering Cua for interacting with local macOS and Linux sandboxes, PyAutoGUI-compatible, and pluggable with any AI agent systems (Cua, Langchain, CrewAI, AutoGen). Computer relies on Lume for creating and managing sandbox environments.

Get started with Computer

from computer import Computer

computer = Computer(os_type="macos", display="1024x768", memory="8GB", cpu="4")
try:
    await computer.run()

    screenshot = await computer.interface.screenshot()
    with open("screenshot.png", "wb") as f:
        f.write(screenshot)

    await computer.interface.move_cursor(100, 100)
    await computer.interface.left_click()
    await computer.interface.right_click(300, 300)
    await computer.interface.double_click(400, 400)

    await computer.interface.type_text("Hello, World!")
    await computer.interface.press_key("enter")

    await computer.interface.set_clipboard("Test clipboard")
    content = await computer.interface.copy_to_clipboard()
    print(f"Clipboard content: {content}")
finally:
    await computer.stop()

Install

To install the Computer-Use Interface (CUI):

pip install "cua-computer[all]"

The cua-computer PyPi package pulls automatically the latest executable version of Lume through pylume.

Run

Refer to this notebook for a step-by-step guide on how to use the Computer-Use Interface (CUI):

Docs