CuaReference

Cua CLI API Reference

Python API reference for the Cua command-line interface

v0.1.0pip install cua-cli

CUA CLI - Unified command-line interface for Computer-Use Agents.


main

Main entry point for CUA CLI.

def print_error(message: str) -> None

Print an error message to stderr.

create_parser

def create_parser() -> argparse.ArgumentParser

Create the main argument parser with all subcommands.

main

def main() -> int

Main entry point for the CLI.


auth

Authentication module for CUA CLI.


CredentialStore

SQLite-based credential store with WAL mode for concurrent access.

Constructor

CredentialStore(self, db_path: Path | None = None)

Attributes

NameTypeDescription
db_pathAny

Methods

CredentialStore.get

def get(self, key: str) -> Optional[str]

Get a value from the store.

Parameters:

NameTypeDescription
keyAnyThe key to look up

Returns: The value, or None if not found

CredentialStore.set

def set(self, key: str, value: str) -> None

Set a value in the store.

Parameters:

NameTypeDescription
keyAnyThe key to set
valueAnyThe value to store

CredentialStore.delete

def delete(self, key: str) -> bool

Delete a value from the store.

Parameters:

NameTypeDescription
keyAnyThe key to delete

Returns: True if the key was deleted, False if it didn't exist

CredentialStore.clear

def clear(self) -> None

Clear all stored credentials.

clear_credentials

def clear_credentials() -> None

Clear all stored credentials.

get_api_key

def get_api_key() -> Optional[str]

Get the stored API key.

First checks CUA_API_KEY environment variable, then falls back to stored credentials.

Returns: The API key, or None if not found

save_api_key

def save_api_key(api_key: str) -> None

Save an API key to the credential store.

Parameters:

NameTypeDescription
api_keyAnyThe API key to save

utils

Utility modules for CUA CLI.

run_async

def run_async(coro: Coroutine[Any, Any, T]) -> T

Run an async coroutine synchronously.

This is the standard pattern for CLI commands that need to call async code.

Parameters:

NameTypeDescription
coroAnyThe coroutine to run

Returns: The result of the coroutine

def print_error(message: str) -> None

Print an error message to stderr.

def print_info(message: str) -> None

Print an info message.

def print_json(data: Any) -> None

Print data as formatted JSON.

def print_success(message: str) -> None

Print a success message.

def print_table(data: list[dict[str, Any]], columns: list[tuple[str, str]] | None = None, title: str | None = None) -> None

Print data as a formatted table.

Parameters:

NameTypeDescription
dataAnyList of dictionaries to display
columnsAnyList of (key, header) tuples. If None, uses all keys from first item.
titleAnyOptional table title
def print_warning(message: str) -> None

Print a warning message.

Was this page helpful?