list_sessions has no includeProgrammatic filter, get_session_messages has no includeSystemMessages, and SessionMessage.type cannot be 'system'

Author: codyanthony736Created Sep 24, 2026Updated Sep 30, 2026

Summary

The TypeScript session helpers take includeProgrammatic on listSessions (sdk.d.ts:1055-1065) and includeSystemMessages on getSessionMessages (sdk.d.ts:828-851). The Python twins have neither: list_sessions(directory, limit, offset, include_worktrees) (_internal/sessions.py:680-690) and get_session_messages(session_id, directory, limit, offset). On the messages side, _is_visible_message admits only user and assistant entries (_internal/sessions.py:1023-1036) and SessionMessage.type is Literal["user", "assistant"] (types.py:1795), so system messages cannot be returned even if a flag existed.

Checked at v0.2.159 (bundled CLI 2.1.281); paths are under src/claude_agent_sdk/. TypeScript references are to @anthropic-ai/claude-agent-sdk 0.3.280, sdk.d.ts.

Repro

python
import inspect
from claude_agent_sdk._internal.sessions import list_sessions, get_session_messages
print(list(inspect.signature(list_sessions).parameters))        # ['directory', 'limit', 'offset', 'include_worktrees']
print(list(inspect.signature(get_session_messages).parameters))  # ['session_id', 'directory', 'limit', 'offset']

Expected

The two filters, and system as a SessionMessage.type member, matching the TypeScript helpers.

Source: anthropics/claude-agent-sdk-python