Models that expose their reasoning (OpenAI gpt-5 and o-series, Anthropic extended thinking, Mistral Magistral, Google Gemini 2.5, DeepSeek-R1, local models served by Ollama or vLLM) all surface it the same way in Gwenflow: as ThinkingContent parts, read with response.thinking, and as thinking events on a stream.

Turning it on

Each provider has its own switch:
DeepSeek, Mistral reasoning models and servers started with a reasoning parser return their reasoning without any option.

Reading it

On an agent, AgentResponse.reasoning_content gathers the reasoning of every model call of the run, and a stream yields it as AgentEventThinking events:

Inline <think> tags

Local models such as Qwen3, DeepSeek-R1 distills or Gemma 3 often write their reasoning inline as <think>...</think>. ChatOllama extracts these blocks into thinking parts automatically; for another OpenAI-compatible server, set extract_think_tags=True on ChatOpenAI.

Thinking and tools

With Anthropic extended thinking, the reasoning blocks of a turn that called tools must be sent back verbatim, signature included, on the next request. The agent does this for you: the thinking parts are kept on the assistant message (Message.thinking_parts) and replayed. Other providers ignore them.

A separate reasoning model

Agent(reasoning_model=...) asks a second model to work through the task first. Its conclusions are added to the history as an assistant message before the main model takes over, its usage is counted in the run, and its own reasoning (when the model exposes it) is reported in reasoning_content: