Skip to main content
Reasoning (extended thinking) lets supported models spend additional compute on hidden scratch-pad reasoning before producing a final answer. The model works through the problem internally — planning, considering alternatives, checking its work — before writing the visible response. This typically improves accuracy on multi-step problems, logical reasoning, and complex coding tasks. The internal reasoning is not surfaced in result.Content. When streaming, you can observe thinking deltas via AgentEventTypeReasoningMessageContent events if you want to display the reasoning process to users.
Reasoning tokens incur additional cost on top of normal output tokens. Use BudgetTokens to cap how much thinking the model does per call, and check result.LLMUsage.ReasoningTokens to track spend.
Configure it per agent with WithLLMSampling and LLMReasoning. Fields are provider-agnostic — each LLM client maps them to its native API.

Configure

Field mapping

Gemini forbids setting both BudgetTokens and Effort (ThinkingLevel) together. If you set BudgetTokens, Effort is not sent as ThinkingLevel. Prefer BudgetTokens over Effort when targeting Gemini.
Anthropic extended thinking requires BudgetTokens ≥ 1024. The SDK clamps lower values to 1024 automatically.

Streaming

When the provider returns thinking deltas, streaming emits reasoning events: See Streaming for event handling patterns.

Token usage

Reasoning tokens appear in LLMUsage.ReasoningTokens when the provider reports them. They are included in the aggregate on AgentRunResult.LLMUsage.

Example

Reasoning

Extended thinking on supported models

LLM Providers

Provider clients and model selection

Streaming

Reasoning stream events