swarm / companies/lantern/seed/src/agent.rs

raw file 696 bytes
//! Agent loop (seed stub). The loop: prompt an OpenAI-compatible model with
//! the page state + available tools, parse its strict tool-call JSON, dispatch
//! to the Browser, repeat — until `done` or budget. Team writes this for real.

use crate::browser::Browser;

pub const LLM_URL: &str = "http://localhost:8085/v1/chat/completions";

#[derive(Debug)]
pub enum AgentError {
    Model(String),
    Parse(String),
    Browser(crate::browser::BrowserError),
    Budget,
}

/// Seed stub: full LLM integration is backlog T3.
pub fn run_task(_browser: &mut dyn Browser, task: &str) -> Result<String, AgentError> {
    Ok(format!("(seed stub — agent loop not wired yet; task was: {task})"))
}