91e75e620b
CI: cua-driver distro-compat matrix / debian:12 (glibc 2.36) (push) Has been cancelled
CI: SPDX Headers / Check SPDX headers (warn-only) (push) Has been cancelled
CD: Docs MCP Server / build (linux/amd64) (push) Has been cancelled
CD: Docs MCP Server / build (linux/arm64) (push) Has been cancelled
CD: Docs MCP Server / merge (push) Has been cancelled
CI: cua-driver distro-compat matrix / Resolve release version (push) Has been cancelled
CI: cua-driver distro-compat matrix / fedora:41 (glibc 2.40) (push) Has been cancelled
CI: cua-driver distro-compat matrix / rockylinux:9 (glibc 2.34) (push) Has been cancelled
CI: cua-driver distro-compat matrix / ubuntu:22.04 (glibc 2.35) (push) Has been cancelled
CI: cua-driver distro-compat matrix / ubuntu:24.04 (glibc 2.39) (push) Has been cancelled
CI: cua-driver distro-compat matrix / Distro compat summary (push) Has been cancelled
CI: Rust Linux unit / Rust Linux unit and compile (push) Has been cancelled
CI: Rust Windows unit / Rust Windows unit and compile (push) Has been cancelled
CI: Nix Linux Rust source / Nix / compositor build (push) Has been cancelled
CI: Nix Linux Rust source / Nix / driver package (push) Has been cancelled
CI: Nix Linux Rust source / Nix / Rust unit tests (push) Has been cancelled
81 lines
2.6 KiB
Python
81 lines
2.6 KiB
Python
"""
|
|
Base protocol for async agent configurations
|
|
"""
|
|
|
|
from abc import abstractmethod
|
|
from typing import Any, Dict, List, Optional, Protocol, Tuple, Union
|
|
|
|
from ..types import AgentCapability
|
|
|
|
|
|
class AsyncAgentConfig(Protocol):
|
|
"""Protocol defining the interface for async agent configurations."""
|
|
|
|
@abstractmethod
|
|
async def predict_step(
|
|
self,
|
|
messages: List[Dict[str, Any]],
|
|
model: str,
|
|
tools: Optional[List[Dict[str, Any]]] = None,
|
|
max_retries: Optional[int] = None,
|
|
stream: bool = False,
|
|
computer_handler=None,
|
|
_on_api_start=None,
|
|
_on_api_end=None,
|
|
_on_usage=None,
|
|
_on_screenshot=None,
|
|
**generation_config,
|
|
) -> Dict[str, Any]:
|
|
"""
|
|
Predict the next step based on input items.
|
|
|
|
Args:
|
|
messages: Input items following Responses format (message, function_call, computer_call)
|
|
model: Model name to use
|
|
tools: Optional list of tool schemas
|
|
max_retries: Maximum number of retries for failed API calls
|
|
stream: Whether to stream responses
|
|
computer_handler: Computer handler instance
|
|
_on_api_start: Callback for API start
|
|
_on_api_end: Callback for API end
|
|
_on_usage: Callback for usage tracking
|
|
_on_screenshot: Callback for screenshot events
|
|
**generation_config: Additional arguments to pass to the model provider
|
|
- api_key: Optional API key for the provider
|
|
- api_base: Optional API base URL for the provider
|
|
|
|
Returns:
|
|
Dictionary with "output" (output items) and "usage" array
|
|
"""
|
|
...
|
|
|
|
@abstractmethod
|
|
async def predict_click(
|
|
self, model: str, image_b64: str, instruction: str, **generation_config
|
|
) -> Optional[Tuple[int, int]]:
|
|
"""
|
|
Predict click coordinates based on image and instruction.
|
|
|
|
Args:
|
|
model: Model name to use
|
|
image_b64: Base64 encoded image
|
|
instruction: Instruction for where to click
|
|
**generation_config: Additional arguments to pass to the model provider
|
|
- api_key: Optional API key for the provider
|
|
- api_base: Optional API base URL for the provider
|
|
|
|
Returns:
|
|
None or tuple with (x, y) coordinates
|
|
"""
|
|
...
|
|
|
|
@abstractmethod
|
|
def get_capabilities(self) -> List[AgentCapability]:
|
|
"""
|
|
Get list of capabilities supported by this agent config.
|
|
|
|
Returns:
|
|
List of capability strings (e.g., ["step", "click"])
|
|
"""
|
|
...
|