Skip to main content

steeldb/agent/
provider.rs

1//! The provider abstraction: any chat model with tool-use, behind one async trait. Bedrock (Claude)
2//! and Paddock (local Qwen) both implement it; the agent loop is provider-agnostic.
3
4use crate::agent::types::{Msg, ToolSpec, Turn};
5use async_trait::async_trait;
6
7#[async_trait]
8pub trait LlmProvider: Send + Sync {
9    /// One turn: given the system prompt, conversation, and available tools, return the model's reply
10    /// (assistant text and/or tool calls).
11    async fn chat(&self, system: &str, msgs: &[Msg], tools: &[ToolSpec]) -> Result<Turn, String>;
12    fn name(&self) -> &str;
13
14    /// Whether this provider produces trustworthy natural-language *synthesis* of tool results. Large
15    /// models (Bedrock, big OpenAI-compatible) do; small on-device tool-callers (Needle, the native
16    /// 1.7B) do NOT — for those the agent renders a deterministic template from the program result
17    /// instead of trusting the model to phrase the numbers. Default `true`.
18    fn synthesizes(&self) -> bool {
19        true
20    }
21}