Skip to main content

AgentAdapter

Trait AgentAdapter 

Source
pub trait AgentAdapter {
    // Required methods
    fn agent(&self) -> Agent;
    fn program(&self) -> &str;
    fn mcp_entries(&self, workdir: &Workdir) -> Result<Vec<McpEntry>, String>;
    fn register_mcp(
        &self,
        name: &str,
        url: &str,
        client_id: &str,
        scope: McpScope,
        workdir: &Workdir,
    ) -> FixAction;
    fn remove_mcp(&self, entry: &McpEntry, workdir: &Workdir) -> FixAction;

    // Provided methods
    fn launch(&self, args: &[String]) -> Command { ... }
    fn launch_via_gateway(
        &self,
        args: &[String],
        gateway: &GatewayLaunch,
        env: &dyn Fn(&str) -> Option<String>,
    ) -> Result<Command, String> { ... }
    fn env_script(
        &self,
        gateway: &GatewayLaunch,
        project: &str,
    ) -> Result<String, String> { ... }
}

Required Methods§

Source

fn agent(&self) -> Agent

Source

fn program(&self) -> &str

The executable visdom runs for this agent.

Source

fn mcp_entries(&self, workdir: &Workdir) -> Result<Vec<McpEntry>, String>

Every MCP server the agent would load when started in workdir. An unreadable or malformed file is an error that names it.

Source

fn register_mcp( &self, name: &str, url: &str, client_id: &str, scope: McpScope, workdir: &Workdir, ) -> FixAction

The command that registers an HTTP MCP server with a fixed OAuth client in scope, for an agent started in workdir. An agent with a single configuration ignores the scope.

Source

fn remove_mcp(&self, entry: &McpEntry, workdir: &Workdir) -> FixAction

The command that removes entry.

Provided Methods§

Source

fn launch(&self, args: &[String]) -> Command

The command that starts the agent with args.

Source

fn launch_via_gateway( &self, args: &[String], gateway: &GatewayLaunch, env: &dyn Fn(&str) -> Option<String>, ) -> Result<Command, String>

The command that starts the agent with args and its LLM traffic going through the AI Gateway. env reads the current environment. Err when the caller’s own args would take the session elsewhere.

Source

fn env_script( &self, gateway: &GatewayLaunch, project: &str, ) -> Result<String, String>

Shell commands that send this agent, started from that shell without visdom, through the AI Gateway (visdom env).

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§