Agent SDK v0.7 API Reference
API reference for Agent SDK version 0.7
This is documentation for v0.7. View latest version.
v0.7.23
pip install cua-agent==0.7.23agent - Decorator-based Computer Use Agent with liteLLM integration
Classes
| Class | Description |
|---|---|
ComputerAgent | Main agent class that automatically selects the appropriate agent loop |
ComputerAgent
Main agent class that automatically selects the appropriate agent loop based on the model and executes tool calls.
Methods
ComputerAgent.run
async def run(self, messages: Messages, stream: bool = False, api_key: Optional[str] = None, api_base: Optional[str] = None, additional_generation_kwargs = {}) -> AsyncGenerator[Dict[str, Any], None]Run the agent with the given messages using Computer protocol handler pattern.
Args: messages: List of message dictionaries stream: Whether to stream the response api_key: Optional API key override for the model provider api_base: Optional API base URL override for the model provider **additional_generation_kwargs: Additional arguments passed to the model provider
Returns: AsyncGenerator that yields response chunks
ComputerAgent.predict_click
async def predict_click(self, instruction: str, image_b64: Optional[str] = None) -> Optional[Tuple[int, int]]Predict click coordinates based on image and instruction.
Args: instruction: Instruction for where to click image_b64: Base64 encoded image (optional, will take screenshot if not provided)
Returns: None or tuple with (x, y) coordinates
ComputerAgent.get_capabilities
def get_capabilities(self) -> List[AgentCapability]Get list of capabilities supported by the current agent config.
Returns: List of capability strings (e.g., ["step", "click"])
ComputerAgent.open
def open(self, port: Optional[int] = None)Start the playground server and open it in the browser.
This method starts a local HTTP server that exposes the /responses endpoint and automatically opens the Cua playground interface in the default browser.
Args: port: Port to run the server on. If None, finds an available port automatically.
Example: >>> agent = ComputerAgent(model="claude-sonnet-4") >>> agent.open() # Starts server and opens browser
Was this page helpful?