Anthropic Academy Courses My Profile Sign Out

Что такое мышление?

Некоторые задачи требуют больше, чем быстрый ответ. Claude может проработать проблему перед тем, как ответить — эта функция называется *extended thinking* (расширенное мышление). В этом уроке мы разберёмся, что такое мышление, как его включить и когда оно действительно помогает.

Вот какую проблему мы пытаемся избежать. Если задать модели многоэтапный вопрос и получить немедленный ответ, она может уверенно ошибиться:

Что такое *extended thinking*?

*Extended thinking* позволяет Claude рассуждать шаг за шагом перед тем, как дать окончательный ответ. Когда эта функция включена, Claude генерирует внутренние токены рассуждений — их часто называют *цепочкой мыслей* — а затем предоставляет ответ. Само рассуждение не скрыто: его можно увидеть в ответе вместе с финальным текстом.

Адаптивное мышление в Opus 4.7

В версии Opus 4.7 мышление стало адаптивным. Вам не нужно выбирать бюджет токенов. Просто включите его, и Claude сам решит, когда и сколько думать.

Чтобы контролировать, насколько сильно Claude будет думать, используйте параметр `effort`. Одно важное замечание: он указывается внутри `output_config`, а не рядом с блоком мышления. Доступные уровни:

  • low
  • medium
  • high (по умолчанию)
  • xhigh (extra high)
  • max

Когда использовать (а когда пропустить)

*Extended thinking* помогает в случаях:

  • Математические задачи и многоэтапная логика
  • Отладка кода
  • Анализ нормативных документов
  • Любые задачи, связанные с компромиссами или сравнением вариантов

Пропустите его для простой классификации, извлечения данных или шаблонных ответов. Для таких задач он только добавляет задержку и стоимость без реального улучшения результатов.

Мыслительный процесс в действии

Давайте посмотрим, как это работает. Вот цикл агента с одним инструментом для прогноза погоды, и мы попросим Claude спланировать поездку из Сан-Франциско с двумя остановками, учитывая погоду и время в пути. Это реальный компромисс — именно тот тип вопросов, где мышление оправдывает себя.

```python

import anthropic

client = anthropic.Anthropic()

weather_tool = {

"name": "get_weather",

"description": "Get the current weather for a city.",

"input_schema": {

"type": "object",

"properties": {

},

"required": ["city"],

},

}

response = client.messages.create(

model="claude-opus-4-7",

max_tokens=16000,

tools=[weather_tool],

messages=[

{

"role": "user",

"content": "Plan a road trip out of San Francisco with two stops, "

"weighing weather and drive time.",

}

],

)

```

При запуске этого кода вывод будет интереснее обычного. Вы увидите блоки мышления, где Claude прорабатывает компромиссы, затем вызовы инструментов для проверки погоды в каждом городе и, наконец, текстовый блок с рекомендацией.

Само рассуждение видно — в этом и есть весь смысл.

Почему это важно в продакшене

В производственном приложении это разница между агентом, который находит проблемы по одной, и агентом, который связывает их воедино. Возьмём приложение для проверки соответствия: включение адаптивного мышления в автоматическом режиме позволяет агенту рассуждать между разделами отчёта — например, обнаруживать, что спецификация ветровой нагрузки в разделе 3 противоречит спецификации материала в другом месте документа.

Итоги

  • *Extended thinking* даёт Claude возможность рассуждать перед ответом, и само рассуждение видно в ответе.
  • Настройте глубину с помощью параметра `effort` внутри `output_config`: low, medium, high (по умолчанию), xhigh или max.
  • Используйте его для сложных задач с компромиссами. Пропустите для простых — там он только добавляет задержку и токены.

Some tasks need more than a quick answer. Claude can work through a problem before responding — a feature called extended thinking. In this lesson, we'll look at what thinking is, how to turn it on, and when it actually helps.

Here's the failure mode we're trying to avoid. Ask a model a multi-step question and have it answer immediately, and it can confidently get it wrong:

Diagram of an app sending a multi-step apples question to a model, which immediately replies with the wrong answer: you'd have 6.5 apples

What is extended thinking?

Extended thinking lets Claude reason step by step before producing a final response. When it's enabled, Claude generates internal reasoning tokens — often called a chain of thought — and then delivers the answer. The reasoning isn't hidden: you can see it in the response alongside the final text.

Adaptive thinking on Opus 4.7

With Opus 4.7, thinking is adaptive. You don't pick a token budget. You just turn it on, and Claude decides dynamically when to think and how much.

To control how much Claude thinks, use the effort parameter. One gotcha: it goes inside output_config, not next to the thinking block. The levels are:

  • low
  • medium
  • high (the default)
  • xhigh (extra high)
  • max

When to use it (and when to skip it)

Extended thinking helps with:

  • Math and multi-step logic
  • Code debugging
  • Regulatory analysis
  • Anything that involves trade-offs or comparing options
Slide showing extended thinking use cases: math, multi-step logic, code debugging, regulatory analysis, and complex comparisons

Skip it for simple classification, extraction, or boilerplate. For those tasks it just adds latency and cost without actually improving the results.

Thinking in action

Let's see it work. Here's an agent loop with one weather tool, and we'll ask Claude to plan a road trip out of San Francisco — two stops, weighing weather and drive time. That's a real trade-off, the kind of question where thinking earns its keep.

import anthropic

client = anthropic.Anthropic()

weather_tool = {
    "name": "get_weather",
    "description": "Get the current weather for a city.",
    "input_schema": {
        "type": "object",
        "properties": {
            "city": {"type": "string", "description": "City name"}
        },
        "required": ["city"],
    },
}

response = client.messages.create(
    model="claude-opus-4-7",
    max_tokens=16000,
    thinking={"type": "adaptive"},
    output_config={"effort": "high"},  # low | medium | high | xhigh | max
    tools=[weather_tool],
    messages=[
        {
            "role": "user",
            "content": "Plan a road trip out of San Francisco with two stops, "
                       "weighing weather and drive time.",
        }
    ],
)

When you run this, the output is more interesting than usual. You'll see thinking blocks where Claude works through the trade-offs, followed by tool calls to check each city, and finally a text block with the actual recommendation.

The reasoning is visible — that's the whole point.

Why this matters in production

In a production app, this is the difference between an agent that finds problems one at a time and an agent that connects them. Take a compliance review app: toggling adaptive thinking on the auto-review call lets the agent reason across report sections — catching things like a wind load spec in section three that conflicts with the material spec elsewhere in the document.

Compliance review app UI with a Thorough review checkbox enabled, running an auto-review that cross-references findings between report sections

Recap

  • Extended thinking gives Claude room to reason before it answers, and the reasoning is visible in the response.
  • With Opus 4.7, turn it on with thinking: {"type": "adaptive"} — no token budget needed; Claude decides when and how much to think.
  • Dial the depth with the effort parameter inside output_config: low, medium, high (default), xhigh, or max.
  • Use it for hard, trade-off-heavy problems. Skip it for simple ones — there it just costs latency and tokens.