anthropics / anthropics/claude-agent-sdk-typescript
SDK 0.2.68+ silently overrides effort default from "high" to "medium" for Sonnet 4.6, breaking agentic workflows
- Lingua principale
- Shell
- Stelle
- 1.8k
- Fork
- 226
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
## Description
Starting in `@anthropic-ai/claude-agent-sdk@0.2.68` (embedding Claude Code 2.1.68), a new feature flag (`tengu_turtle_carbon`, defaulting to `true`) causes `output_config: { effort: "medium" }` to be silently injected into all API requests for effort-capable models (Sonnet 4.6, Opus 4.6, etc.), even when the SDK consumer has **not** set any effort level.
This contradicts the [official Anthropic documentation](https://platform.claude.com/docs/en/build-with-claude/effort) which states:
> "Sonnet 4.6 defaults to `high` effort."
>
> "Setting `effort` to `"high"` produces exactly the same behavior as omitting the `effort` parameter entirely."
The silent `medium` default is a breaking change for agentic workflows that rely on multi-turn tool use. With `effort: "medium"`, the model skips tool use entirely and returns minimal single-turn responses.
## Reproduction
1. Install `@anthropic-ai/claude-agent-sdk@0.2.68` (or `0.2.69`)
2. Create an agent using `model: "claude-sonnet-4-6"` with `allowedTools` including file reading tools (Read, Grep, Glob)
3. Give it a prompt that requires multi-turn tool use (e.g., analyzing a code change across multiple files)
4. Observe: agent completes in **1 turn** with minimal output (e.g., 9 output tokens), **no tool use**
5. Downgrade to `@0.2.66` and repeat — agent correctly uses tools across **3–6 turns**
6. Alternatively, keep `@0.2.68` but pass `effort: "high"` in SDK `QueryOptions` — agent behavior is restored
## Evidence
All tests used the same prompt, model (`claude-sonnet-4-6` via Bedrock), and configuration — only the SDK version and effort setting changed:
| SDK Version | `effort` set? | Turns | Output Tokens | Tool Use | Result |
|---|---|---|---|---|---|
| 0.2.66 | No (API default: high) | 3–6 | 682–1284 | Grep, Read | Correct, detailed review |
| 0.2.68 | No (SDK injects: medium) | 1 | 9 | None | Simplified response |
| 0.2.69 | No (SDK injects: medium) | 1 | 9 | None | Simplified response |
| **0.2.68** | **Yes (`effort: "high"`)** | **5** | **1013** | **Grep, Read** | **Correct, detailed review** |
## Root Cause
In the bundled `cli.js`, the model-specific default effort function was changed between 0.2.66 and 0.2.68:
**0.2.66** — only applies `"medium"` to Opus 4.6 for Pro subscribers:
```javascript
// Deminified from cli.js
function getDefaultEffort(model) {
if (isProSubscriber() && model.includes("opus-4-6"))
return "medium";
return undefined; // No effort sent → API default (high)
}
```
**0.2.68** — applies `"medium"` to **all effort-capable models** via a new feature flag:
```javascript
// Deminified from cli.js
function getDefaultEffort(model) {
if (model.includes("opus-4-6")) {
if (someCondition() || isProSubscriber()) return "medium";
if (featureEnabled() && (isMaxSubscriber() || isTeamSubscriber())) return "medium";
}
// NEW: applies to ALL effort-capable models when flag is true
if (getFeatureFlag("tengu_turtle_carbon", true) && supportsEffort(model))
return "medium";
return undefined;
}
```
Since `supportsEffort("claude-sonnet-4-6")` returns `true`, and the feature flag defaults to `true`, every SDK request now gets `output_config: { effort: "medium" }` — overriding the documented API default of `"high"`.
## Impact
- **Breaks agentic workflows**: Multi-turn tool use collapses to single-turn minimal output
- **Contradicts official docs**: The [effort documentation](https://platform.claude.com/docs/en/build-with-claude/effort) states the default is `"high"`, and recommends `"high"` for "complex reasoning, nuanced analysis, difficult coding problems, or any task where quality is the top priority"
- **Invisible to SDK consumers**: No option was changed, no deprecation warning, no changelog entry
- **Affects all effort-capable models**: Not just Opus 4.6 — Sonnet 4.6 and any future models that support effort
## Workarounds
- Pass `effort: "high"` explicitly in SDK `QueryOptions`
- Set `CLAUDE_CODE_EFFORT_LEVEL=high` environment variable
- Pin to `@anthropic-ai/claude-agent-sdk@0.2.66`
## Expected Behavior
When the SDK consumer does not explicitly set an effort level, no `effort` parameter should be added to API requests — preserving the documented API default (`"high"`). If the SDK intends to change the default, this should be:
1. Documented in the changelog as a breaking change
2. Configurable/opt-out via SDK options
3. Consistent with the official API documentation
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Valutazione
Questa issue non è ancora stata valutata.