Skip to main content

ComputerActuator

Trait ComputerActuator 

Source
pub trait ComputerActuator: Send + Sync {
    // Required methods
    fn display_size(&self) -> Option<(u32, u32)>;
    fn perform<'life0, 'async_trait>(
        &'life0 self,
        action: ComputerAction,
    ) -> Pin<Box<dyn Future<Output = Result<ActuationOutput, AdkError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             Self: 'async_trait;

    // Provided method
    fn supports(&self, kind: ComputerActionKind) -> bool { ... }
}
Expand description

Core traits and types.

Always available regardless of feature flags. Includes:

  • Agent - The fundamental trait for all agents
  • Tool / Toolset - For extending agents with capabilities
  • Session / State - For managing conversation context
  • Event - For streaming agent responses
  • AdkError / Result - Unified error handling An environment that performs ComputerActions: a virtual desktop, a remote desktop session, or a browser viewport.

Implementations act on whatever they are connected to, so give an agent one only through tools that run on the governed path, and only in an isolated environment with no credentials it does not need.

§Example

use adk_core::{ActuationOutput, ComputerAction, ComputerActionKind, ComputerActuator, Result};
use async_trait::async_trait;

/// An actuator that records actions and performs none.
struct Recorder(std::sync::Mutex<Vec<ComputerAction>>);

#[async_trait]
impl ComputerActuator for Recorder {
    fn display_size(&self) -> Option<(u32, u32)> {
        Some((1280, 800))
    }

    fn supports(&self, kind: ComputerActionKind) -> bool {
        kind != ComputerActionKind::Zoom
    }

    async fn perform(&self, action: ComputerAction) -> Result<ActuationOutput> {
        self.0.lock().unwrap().push(action);
        Ok(ActuationOutput::Done)
    }
}

Required Methods§

Source

fn display_size(&self) -> Option<(u32, u32)>

The size of the screenshots the actuator returns, when it is known before the first one: the coordinate space of every action.

Source

fn perform<'life0, 'async_trait>( &'life0 self, action: ComputerAction, ) -> Pin<Box<dyn Future<Output = Result<ActuationOutput, AdkError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Performs one action.

§Errors

Returns an error when the action cannot be performed: a coordinate outside the display, an unknown key name, or a failure of the environment.

Provided Methods§

Source

fn supports(&self, kind: ComputerActionKind) -> bool

Whether the actuator can perform actions of kind. Tools withhold the rest from the model. Every kind but ComputerActionKind::Zoom by default.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§