Expand description
Ollama model adapter for the agentkit agent loop.
This crate provides OllamaAdapter and OllamaConfig for connecting
the agent loop to a local Ollama instance via its
OpenAI-compatible chat completions endpoint. It is built on the generic
agentkit_adapter_completions crate.
No API key is required — Ollama runs locally and does not authenticate requests by default.
§Quick start
ⓘ
use agentkit_loop::{Agent, SessionConfig};
use agentkit_provider_ollama::{OllamaAdapter, OllamaConfig};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Ollama must be running locally (e.g. `ollama serve`).
let config = OllamaConfig::new("llama3.1:8b");
let adapter = OllamaAdapter::new(config)?;
let agent = Agent::builder()
.model(adapter)
.build()?;
let mut driver = agent
.start(SessionConfig::new("demo"))
.await?;
Ok(())
}Structs§
- Ollama
Adapter - Model adapter that connects the agentkit agent loop to a local Ollama instance.
- Ollama
Config - Configuration for connecting to a local Ollama instance.
- Ollama
Provider - The Ollama provider, implementing
CompletionsProvider. - Ollama
Request Config - Request parameters serialized into the Ollama request body.
Enums§
- Ollama
Error - Errors produced by the Ollama adapter.
Type Aliases§
- Ollama
Session - An active session with a local Ollama instance.
- Ollama
Turn - A completed turn from a local Ollama instance.