[DOCS] [Python Agent SDK] Missing `compaction_control` parameter in `ClaudeAgentOptions` vs Documentation
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
PreCompactHookInputtype definition exists insrc/claude_agent_sdk/types.py, suggesting the feature hooks are implemented. ClaudeAgentOptionsdefines fields likemax_thinking_tokensandfork_session, but is missingcompaction_control.
This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗