[DOCS] [Python Agent SDK] Missing `compaction_control` parameter in `ClaudeAgentOptions` vs Documentation

Resolved 💬 5 comments Opened Jan 21, 2026 by coygeek Closed Mar 3, 2026

Documentation Type

Unclear/confusing documentation

Documentation Location

docs.claude.com/en/docs/build-with-claude/context-editing src/claude_agent_sdk/types.py

Section/Topic

Client-side compaction (SDK) / ClaudeAgentOptions definition

Current Documentation

The Context Editing documentation states:

"Compaction is available in the Python and TypeScript SDKs when using the tool_runner method."

It provides the following Python example for configuring compaction:

compaction_control={
    "enabled": True,
    "context_token_threshold": 100000
}

What's Wrong or Missing?

The Python Agent SDK (claude-agent-sdk) appears to support compaction conceptually (as evidenced by the presence of PreCompactHookInput in types.py), but the ClaudeAgentOptions dataclass in src/claude_agent_sdk/types.py completely lacks the compaction_control field.

Users attempting to configure an agent with compaction using ClaudeSDKClient or query() have no typed parameter to pass this configuration, causing a discrepancy between the feature's availability in the ecosystem and its implementation in the Agent SDK's configuration object.

Suggested Improvement

Update ClaudeAgentOptions in src/claude_agent_sdk/types.py to include the compaction_control field, matching the capability described in the documentation.

Alternatively, if this feature is not yet supported in the Agent SDK wrapper, the documentation should explicitly clarify that compaction_control is currently only available when using the low-level anthropic client's tool_runner, not the claude_agent_sdk query function.

Impact

High - Prevents users from using a feature

Additional Context

  • The PreCompactHookInput type definition exists in src/claude_agent_sdk/types.py, suggesting the feature hooks are implemented.
  • ClaudeAgentOptions defines fields like max_thinking_tokens and fork_session, but is missing compaction_control.

View original on GitHub ↗

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