> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dashsquad.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Extended thinking

> Enable deeper reasoning by allowing the model to think internally before responding.

Extended thinking lets an agent reason through complex problems before responding. Enable it for agents that need to do more than answer questions — agents that plan, analyze, or solve.

## Enabling extended thinking

Enable extended thinking when you deploy or edit an agent in Desktop — set a thinking token budget alongside the agent's model and max tokens. Behind the scenes, the agent's saved configuration looks like this:

```json theme={null}
{
  "model": "anthropic/claude-sonnet-4-20250514",
  "systemPrompt": "You are a software engineering assistant.",
  "tools": ["bash", "read"],
  "maxTokens": 16000,
  "thinking": {
    "budgetTokens": 10000
  }
}
```

## Configuration

| Field                   | Type     | Description                                             |
| ----------------------- | -------- | ------------------------------------------------------- |
| `thinking.budgetTokens` | `number` | Maximum tokens the model can use for internal reasoning |

### Constraints

<Warning>
  * `budgetTokens` must be **>= 1024**
  * `budgetTokens` must be **\< maxTokens** — the thinking budget is drawn from the total token budget
  * When thinking is enabled, `temperature` is automatically omitted from the API request (Anthropic's API requires this)
</Warning>

## How it works

<Steps>
  <Step title="Request">
    The agent sends the request with `thinking: { type: "enabled", budget_tokens: N }`
  </Step>

  <Step title="Thinking">
    Claude generates thinking blocks internally
  </Step>

  <Step title="Streaming">
    Thinking blocks are included in the streamed response as `thinking_delta` events
  </Step>

  <Step title="Response">
    The final response contains both thinking blocks and the visible text response
  </Step>

  <Step title="Persistence">
    Thinking blocks are preserved in the session for context continuity across rounds
  </Step>
</Steps>

### In Desktop

During the thinking phase, a thinking indicator shows the model is reasoning. Once thinking completes, the visible response streams as normal. Thinking blocks can be expanded to see the model's internal reasoning.

### In Telegram

Thinking happens server-side. The user only sees the final text response.

## Content blocks

When thinking is enabled, assistant messages contain `ContentBlock[]` instead of a plain string. The block types include:

| Block               | Description                                                                        |
| ------------------- | ---------------------------------------------------------------------------------- |
| `thinking`          | The model's internal reasoning (with a cryptographic `signature` for verification) |
| `redacted_thinking` | Thinking content that was redacted by the API (opaque `data` field)                |
| `text`              | The visible response text                                                          |
| `tool_use`          | Tool calls (thinking can precede tool use)                                         |

These blocks are preserved in session JSONL entries so that thinking context carries across multi-turn conversations.

## When to use it

<Tabs>
  <Tab title="Good candidates">
    * Complex coding tasks (debugging, architecture decisions)
    * Multi-step reasoning problems
    * Tasks requiring careful analysis before action
  </Tab>

  <Tab title="Skip extended thinking">
    * Simple Q\&A or factual lookups
    * Short responses where reasoning overhead isn't worth the latency
    * High-throughput use cases where speed matters more than depth
  </Tab>
</Tabs>

## Budget tuning

The `budgetTokens` value controls how much reasoning the model can do. Higher budgets allow deeper thinking but increase latency and cost.

| Budget      | Use case                         |
| ----------- | -------------------------------- |
| 1024–4000   | Light reasoning, quick analysis  |
| 4000–10000  | Moderate complexity, code review |
| 10000–30000 | Deep analysis, complex debugging |

<Tip>
  The model may use fewer tokens than the budget — it stops thinking when it has enough context to respond. The budget is a ceiling, not a target.
</Tip>
