Skip to main content

AgentClient

Trait AgentClient 

Source
pub trait AgentClient {
    // Required methods
    fn detect(&self, kind: AgentKind) -> Result<Option<DetectedAgent>>;
    fn run(
        &self,
        kind: AgentKind,
        prompt: &str,
        dir: &Path,
        opts: &AgentOptions,
    ) -> Result<AgentRun>;

    // Provided method
    fn detect_all(&self) -> Vec<DetectedAgent> { ... }
}
Expand description

Detects and drives code-agent CLIs.

Required Methods§

Source

fn detect(&self, kind: AgentKind) -> Result<Option<DetectedAgent>>

Probes one agent on PATH. Returns Ok(None) if it is not installed, or Err if an installed binary fails to run.

Source

fn run( &self, kind: AgentKind, prompt: &str, dir: &Path, opts: &AgentOptions, ) -> Result<AgentRun>

Runs kind non-interactively on prompt in dir, in the agent’s JSON output mode, with the selected model and effort (opts), and returns the normalized result.

Provided Methods§

Source

fn detect_all(&self) -> Vec<DetectedAgent>

Probes every known agent on PATH, returning those found. Agents that are not installed are omitted (that is not an error).

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§