vercel/ai · error · Error
Deep Agents reasoning requires ChatAnthropic
Error message
Deep Agents reasoning requires ChatAnthropic
What it means
The deepagents bridge's model middleware only supports Anthropic models. When a turn carries thinking/effort settings (but no explicit model string), the bridge resolves the request's model and requires it to be a LangChain `ChatAnthropic` instance; anything else (e.g. an OpenAI or other LangChain chat model) is rejected. Deep Agents reasoning here is wired exclusively through the Anthropic client, so other providers cannot be used for reasoning.
Source
Thrown at packages/harness-deepagents/src/bridge/index.ts:116
const configuredModel = buildModel({
rawModel: activeModel,
thinking: activeThinking,
effort: activeEffort,
});
if (!configuredModel) throw new Error('Deep Agents model is missing');
return handler({ ...request, model: configuredModel });
}
let model = request.model;
if (
'_getModelInstance' in model &&
typeof model._getModelInstance === 'function'
) {
model = await model._getModelInstance();
}
if (!(model instanceof ChatAnthropic)) {
throw new Error('Deep Agents reasoning requires ChatAnthropic');
}
const configuredModel = buildModel({
rawModel: model.model,
thinking: activeThinking,
effort: activeEffort,
});
if (!configuredModel) throw new Error('Deep Agents model is missing');
return handler({ ...request, model: configuredModel });
},
});
}
const args = parseArgs(argv.slice(2));
const workdir = args.workdir;
const bridgeStateDir = args.bridgeStateDir;
if (!workdir || !bridgeStateDir) {View on GitHub (pinned to 69428b1f8b)
Solutions
- Use a `ChatAnthropic` model (from `@langchain/anthropic`) for the Deep Agents agent when thinking/effort is enabled.
- Set the model explicitly via the harness `model` option (a model slug string) so the bridge builds a `ChatAnthropic` itself via `buildModel`.
- Remove `thinking`/`effort` from the request if you must use a non-Anthropic model, so the middleware passes through without the instanceof check.
- Point `ANTHROPIC_BASE_URL` at a gateway if you need a non-Anthropic backend behind an Anthropic-compatible API.
Example fix
// before
new ChatOpenAI({ model: 'gpt-4o' }) // with thinking enabled
// after
import { ChatAnthropic } from '@langchain/anthropic';
new ChatAnthropic({ model: 'claude-sonnet-4-5', thinking: { type: 'enabled', budget_tokens: 1024 } }) Defensive patterns
Strategy: validation
Validate before calling
import { ChatAnthropic } from '@langchain/anthropic';
if (thinkingEnabled && !(resolvedModel instanceof ChatAnthropic)) {
throw new Error('Deep Agents reasoning requires ChatAnthropic');
} Type guard
function isChatAnthropic(m: unknown): m is ChatAnthropic {
return m instanceof ChatAnthropic;
} Try / catch
try {
await runTurn(start);
} catch (error) {
if (error instanceof Error && error.message.includes('requires ChatAnthropic')) {
// switch model to ChatAnthropic or drop thinking/effort and retry
}
throw error;
} Prevention
- Always use ChatAnthropic models with the deepagents harness
- Only enable thinking/effort with Anthropic models
- Pin the model via the harness `model` string option so the bridge constructs ChatAnthropic itself
When it happens
Trigger: Calling a harness turn with `thinking` or `effort` set while the resolved request model is not a `ChatAnthropic` instance (e.g. `ChatOpenAI`, or a lazy model whose `_getModelInstance()` yields a non-Anthropic client).
Common situations: Configuring the harness/agent with a non-Anthropic LangChain chat model while enabling extended thinking or effort; switching providers after the model middleware was added; passing a wrapped model object that delegates to a non-Anthropic client.
Related errors
- AWS SigV4 authentication requires AWS credentials. Please pr
- AWS SigV4 authentication requires both AWS_ACCESS_KEY_ID and
- ${error.message}
- Anthropic Message Batches do not support per-request betas (
AI-assisted analysis of vercel/ai@69428b1f8b (2026-08-30).
Data as JSON: /api/errors/0da5d93d25658b6d.
Report an issue: GitHub.