LlmClient
Category: Core
Source: llm_client.dart
Abstract LLM client interface — wraps any provider (Anthropic, OpenAI, …).
Status: part of the proposed core data model — see docs/plans/2026-04-29-harness-layers.md. Originally lived in agent/agent_core.dart; relocated so strategies (LLM clients, providers) can implement this contract without crossing the harness boundary.
Classes
abstract LlmClient
Abstract LLM client — wraps any provider (Anthropic, OpenAI, etc.).
Implementations stream [LlmChunk]s for a given conversation and optional tool definitions.
Methods
Stream<LlmChunk> stream(List<Message> messages, {List<Tool>? tools})
Streams a response for the given [messages].
If [tools] are provided the model may emit [ToolCallComplete] chunks.
ToolsNotSupportedException
Thrown by an [LlmClient] when the underlying model rejects a request for trying to use tool calling on a model that doesn't support it.
Today Ollama is the only provider that exposes models lacking tool calling — its /api/chat endpoint returns 400 {"error":"<model> does not support tools"} on the first turn that includes a tools array. OllamaClient recognises that exact shape and rethrows this typed exception. Other adapters may grow the same throw if they ever expose tool-less models.
AgentCore catches this, sets its [Tool] filter to reject everything, emits a one-time notice, and retries the turn in chat-only mode — the user keeps their session rather than crashing on turn one.
Constructor
const ToolsNotSupportedException(this.modelId)Properties
| Property | Type | Description |
|---|---|---|
modelId | String | The API id of the model that rejected tools — e.g. qwen2.5:7b. |