Cua (Computer Use) Agent is a Python library designed for AI-driven computer interaction, allowing large language models to perceive and act upon a graphical user interface. It focuses on enabling agents to understand screen content and execute actions like clicking, typing, and dragging programmatically. The current version is 0.7.38, and it is under active, rapid development with frequent releases.
pip install cua-agentVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to initialize the Cua Agent with a configuration, including your OpenAI API key, and run a simple task. Remember to install platform-specific dependencies (e.g., `[mac]` or `[win]`) and ensure your OpenAI API key is available via environment variable or direct configuration.
Ensure you install with the correct extra: `pip install "cua-agent[mac]"` for macOS or `pip install "cua-agent[win]"` for Windows.
Set your `OPENAI_API_KEY` environment variable or pass `openai_api_key` directly to `CuaConfig` during initialization.
Design tasks robustly, consider screen stability, and be prepared for potential failures. Debugging often involves examining screenshots the agent 'sees' and refining prompts.
Monitor resource usage during development. Optimize task design to minimize unnecessary interactions or repeated screen captures where possible. Be mindful of LLM API costs.