[BUG] Bedrock subagent requests ignore user configuration (model, effort, thinking, beta headers)

Resolved 💬 2 comments Opened Mar 19, 2026 by KevinZhao Closed Apr 16, 2026

Summary

When using Claude Code with AWS Bedrock, user-configured environment variables and settings are correctly applied to main thread requests but not propagated to subagent requests. Subagents use hardcoded defaults, forcing users to run a local proxy to patch every subagent request.

Affected Configurations

Evidence captured via local intercepting proxy comparing main thread (Opus) vs subagent (Sonnet) requests in the same session:

1. Model ID — subagent sends stale model ID

Main thread sends the user-configured model. Subagent sends claude-sonnet-4-5 (old ID), requiring proxy to remap:

# Proxy log — subagent needs model remap:
model remap: claude-sonnet-4-5 -> global.anthropic.claude-sonnet-4-6

ANTHROPIC_DEFAULT_SONNET_MODEL=global.anthropic.claude-sonnet-4-6-v1[1m] is set but ignored by subagents.

2. Thinking config — subagent uses fixed budget instead of adaptive

Main thread correctly uses adaptive thinking. Subagent sends a fixed budget_tokens: 8192:

# Main thread (correct):
[#38] model=opus-4-6-v1 | thinking: already adaptive+max

# Subagent (wrong):
[#40] model=sonnet-4-6 | thinking: thinking->adaptive (was map[budget_tokens:8192 type:enabled])

Sonnet 4.6 supports adaptive thinking, but CC hardcodes a fixed 8192 budget for subagents.

3. Effort level — subagent sends no effort

CLAUDE_CODE_EFFORT_LEVEL=max is set. Main thread sends effort: max. Subagent sends no effort field:

# Main thread (correct):
thinking: already adaptive+max

# Subagent (wrong):
effort->max (was )    ← proxy had to inject "max", CC sent empty

4. 1M context beta header — subagent missing

Main thread includes the context-1m-2025-08-07 beta header. Subagent does not — proxy has to inject it:

# Subagent:
beta+=context-1m-2025-08-07    ← proxy had to add this

5. Prompt cache TTL — subagent uses 5m instead of 1h

Already reported in #36243. ENABLE_PROMPT_CACHING_1H_BEDROCK=1 applies to main thread but not subagents:

# Main thread:  cache: 1bp(tools,1h,pre=3,native=3)   ← CC sends 1h natively
# Subagent:     cache: 2bp(tools+msgs,1h,pre=2,upg=2)  ← CC sends 5m, proxy upgrades

Side-by-side Summary

| Configuration | Env Var / Setting | Main Thread | Subagent |
|---|---|---|---|
| Model ID | ANTHROPIC_DEFAULT_SONNET_MODEL | Correct | Ignored (sends claude-sonnet-4-5) |
| Thinking | (adaptive for 4.6 models) | adaptive | budget_tokens: 8192 |
| Effort | CLAUDE_CODE_EFFORT_LEVEL=max | max | Empty |
| 1M beta | ANTHROPIC_MODEL=...[1m] | Included | Missing |
| Cache TTL | ENABLE_PROMPT_CACHING_1H_BEDROCK=1 | 1h | 5m |

Expected Behavior

Subagent requests should inherit the same user-configured model, thinking mode, effort level, beta headers, and cache TTL as the main thread. If intentional differences are needed (e.g., subagents use Sonnet while main thread uses Opus), the overridden values should still respect user configuration for that model (e.g., use the user-configured Sonnet model ID, not a hardcoded stale one).

Workaround

Currently the only workaround is running a local intercepting proxy that rewrites every subagent request. This adds latency, operational complexity, and is fragile across CC version updates.

Environment

  • Claude Code: v2.1.79 (Homebrew, macOS arm64)
  • Provider: AWS Bedrock (ap-northeast-1)
  • Models: Opus 4.6 (main), Sonnet 4.6 (subagent)
  • All relevant env vars set in ~/.claude/settings.json env block

Related Issues

  • #36243 — ENABLE_PROMPT_CACHING_1H_BEDROCK not applied to subagents (cache TTL subset)
  • #29966 — Agent SDK subagents have prompt caching disabled by default
  • #2603 — Feature request for 1h cache support
  • #32102 — SDK consumers cannot control prompt cache segmentation

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗