> ## Documentation Index
> Fetch the complete documentation index at: https://langchain-5e9cc07a-preview-opensw-1774858546-a100bff.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Models

Deep Agents work with any [LangChain chat model](/oss/python/langchain/models) that supports [tool calling](/oss/python/langchain/models#tool-calling).

## Pass a model string

The simplest way to specify a model is to pass a string to [`create_deep_agent`](https://reference.langchain.com/python/deepagents/graph/create_deep_agent). Use the `provider:model` format to select a specific provider:

```python theme={null}
agent = create_deep_agent(model="openai:gpt-5.3-codex")
```

Under the hood, this calls [`init_chat_model`](https://reference.langchain.com/python/langchain/chat_models/base/init_chat_model) with default parameters.

## Configure model parameters

To configure model-specific parameters, use [`init_chat_model`](https://reference.langchain.com/python/langchain/chat_models/base/init_chat_model) or instantiate a provider model class directly:

<CodeGroup>
  ```python init_chat_model theme={null}
  from langchain.chat_models import init_chat_model
  from deepagents import create_deep_agent

  model = init_chat_model(
      model="anthropic:claude-sonnet-4-6",
      thinking={"type": "enabled", "budget_tokens": 10000},  # [!code highlight]
  )
  agent = create_deep_agent(model=model)
  ```

  ```python Provider package theme={null}
  from langchain_anthropic import ChatAnthropic
  from deepagents import create_deep_agent

  model = ChatAnthropic(
      model="claude-sonnet-4-6",
      thinking={"type": "enabled", "budget_tokens": 10000},  # [!code highlight]
  )
  agent = create_deep_agent(model=model)
  ```
</CodeGroup>

<Note>
  Available parameters vary by provider. See the [chat model integrations](/oss/python/integrations/chat) page for provider-specific configuration options.
</Note>

## Select a model at runtime

If your application lets users choose a model (for example using a dropdown in the UI), use [middleware](/oss/python/langchain/middleware) to swap the model at runtime without rebuilding the agent.

Pass the user's model selection through [runtime context](/oss/python/langchain/agents#dynamic-model), then use a `wrap_model_call` middleware to override the model on each invocation using the [`@wrap_model_call`](https://reference.langchain.com/python/langchain/agents/middleware/types/wrap_model_call) decorator:

```python theme={null}
from dataclasses import dataclass
from langchain.chat_models import init_chat_model
from langchain.agents.middleware import wrap_model_call, ModelRequest, ModelResponse
from deepagents import create_deep_agent
from typing import Callable


@dataclass
class Context:
    model: str

@wrap_model_call
def configurable_model(
    request: ModelRequest,
    handler: Callable[[ModelRequest], ModelResponse],
) -> ModelResponse:
    model_name = request.runtime.context.model
    model = init_chat_model(model_name)
    return handler(request.override(model=model))

agent = create_deep_agent(
    model="anthropic:claude-sonnet-4-6",
    middleware=[configurable_model],
    context_schema=Context,
)

# Invoke with the user's model selection
result = agent.invoke(
    {"messages": [{"role": "user", "content": "Hello!"}]},
    context=Context(model="openai:gpt-4.1"),
)
```

<Tip>
  For more dynamic model patterns (foe example routing based on conversation complexity or cost optimization), see [Dynamic model](/oss/python/langchain/agents#dynamic-model) in the LangChain agents guide.
</Tip>

## Supported models

Deep Agents work with any chat model that supports [tool calling](/oss/python/langchain/models#tool-calling). See [chat model integrations](/oss/python/integrations/chat) for the full list of supported providers.

### Suggested models

These models perform well on the [Deep Agents eval suite](https://github.com/langchain-ai/deepagents/tree/main/libs/deepagents/tests/evals), which tests basic agent operations. Passing these evals is necessary but not sufficient for strong performance on longer, more complex tasks.

| Provider                                                  | Models                                                                                                                                   |
| --------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
| [Anthropic](/oss/python/integrations/providers/anthropic) | `claude-opus-4-6`, `claude-opus-4-5`, `claude-sonnet-4-6`, `claude-sonnet-4`, `claude-sonnet-4-5`, `claude-haiku-4-5`, `claude-opus-4-1` |
| [OpenAI](/oss/python/integrations/providers/openai)       | `gpt-5.4`, `gpt-4o`, `gpt-4.1`, `o4-mini`, `gpt-5.2-codex`, `gpt-4o-mini`, `o3`                                                          |
| [Google](/oss/python/integrations/providers/google)       | `gemini-3-flash-preview`, `gemini-3.1-pro-preview`                                                                                       |
| Open-weight                                               | `GLM-5`, `Kimi-K2.5`, `MiniMax-M2.5`, `qwen3.5-397B-A17B`, `devstral-2-123B`                                                             |

Open-weight models are available through providers like [Baseten](/oss/python/integrations/providers/baseten), [Fireworks](/oss/python/integrations/providers/fireworks) [OpenRouter](/oss/python/integrations/providers/openrouter), and [Ollama](/oss/python/integrations/providers/ollama).

## Learn more

* [Models in LangChain](/oss/python/langchain/models): chat model features including tool calling, structured output, and multimodality

***

<div className="source-links">
  <Callout icon="edit">
    [Edit this page on GitHub](https://github.com/langchain-ai/docs/edit/main/src/oss/deepagents/models.mdx) or [file an issue](https://github.com/langchain-ai/docs/issues/new/choose).
  </Callout>

  <Callout icon="terminal-2">
    [Connect these docs](/use-these-docs) to Claude, VSCode, and more via MCP for real-time answers.
  </Callout>
</div>
