AgentSdkSessionProvider class final
Anthropic, reached indirectly through whichever transport was selected.
The one Agent SDK provider. An app's AI actions and its document agent use it as configured by default: plain completions, the app's own tools only, a busy session refused, the gate checked before any run. A backend that is itself an agent — the brain — configures the rest: Claude Code's own loop (agentLoop), conversations continued across requests (resume), busy sessions queued (whenBusy), the transport reached on demand (connectOnDemand) and runs attributed to this provider (attribution).
- Inheritance
-
- Object
- LlmProvider
- AgentSdkSessionProvider
Constructors
- AgentSdkSessionProvider({required AgentSdkTransportSelector selector, required AgentSdkSessionManager sessions, required String toolServerName, String id = 'anthropic', String? systemPrompt, String? model, bool agentToolsEnabled()?, Duration stallGap = defaultAiStallTimeout, AgentSdkAgentLoop? agentLoop, AgentSdkResumeStrategy? resume, AgentSdkWhenBusy whenBusy = AgentSdkWhenBusy.refuse, bool connectOnDemand = false, AgentSdkRunAttribution attribution = AgentSdkRunAttribution.transport})
-
const
Properties
- agentLoop → AgentSdkAgentLoop?
-
Claude Code's own agent loop for every request, or null for none
(plain completions and the request's own tools).
final
- agentToolsEnabled → bool Function()?
-
The agent-tools switch, read live — null for a build
that has no such setting, which is the switch on.
final
- attribution → AgentSdkRunAttribution
-
Whom a run is attributed to.
final
- capabilities → LlmCapabilities
-
The active transport's capabilities, or LlmCapabilities.none when
there is none — so a UI that reads capabilities before checking
availability still gets a correct "nothing is offered" answer.
no setteroverride
- connectOnDemand → bool
-
Whether a run with no active transport first tries to reach one.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- id → String
-
Stable identifier of this provider instance.
final
- isAvailable → bool
-
The availability gate, delegated to the selector. Free to read; see
AgentSdkTransportSelector.
no setteroverride
- model → String?
-
The model used when a request names none; null means the transport's
default.
final
- resume → AgentSdkResumeStrategy?
-
Which conversation a request continues, or null for a fresh one every
time.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- selector → AgentSdkTransportSelector
-
Owns the availability verdict and the active transport.
final
- sessions → AgentSdkSessionManager
-
The sessions every run is served from: the agent run in
chat, the actions indefault, a caller's own session by its id — each in its own isolate.final - stallGap → Duration
-
The liveness bound: the longest silence a completion may
contain before it is abandoned as
LlmErrorKind.timeout.
final
- systemPrompt → String?
-
An optional system prompt sent with every completion, in place of the
far end's own. Configuration, never document-derived.
final
- toolServerName → String
-
The in-process MCP server a request's tools are declared on; the model
sees each tool as
mcp__<toolServerName>__<tool>.final - trails → LlmTrails
-
The sessions' consolidated trails, for the trail view.
no setteroverride
-
The selector's retained explanation, so a disabled affordance can say why.
no setteroverride
- whenBusy → AgentSdkWhenBusy
-
What a run does when its session is busy.
final
Methods
-
complete(
LlmRequest request) → Future< LlmCallReport> -
The report of
request's run. Throws an LlmTransportException when the run failed, carrying the provider's sentence.inherited -
embed(
String text) → Future< List< double> > -
Anthropic exposes no embeddings API, so this provider never supports
embedding and semantic search degrades to lexical for as long as
no transport embeds. Throwing UnsupportedError is the port's contract for a
capability the provider does not have.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
run(
LlmRequest request) → Stream< LlmEvent> -
The run: served from the request's session, where the
transport's events are bounded by stallGap (see boundedAiRun) and
streamed back here. A busy session refuses or queues (whenBusy).
Cancelling the stream cancels the run. complete is derived from this.
override
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited