Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion src/claude_agent_sdk/_internal/client.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
"""Internal client implementation."""

import logging
from collections.abc import AsyncIterable, AsyncIterator
from dataclasses import asdict, replace
from typing import Any

from .._errors import MessageParseError
from ..types import (
ClaudeAgentOptions,
HookEvent,
Expand All @@ -15,6 +17,8 @@
from .transport import Transport
from .transport.subprocess_cli import SubprocessCLITransport

logger = logging.getLogger(__name__)


class InternalClient:
"""Internal client implementation."""
Expand Down Expand Up @@ -138,7 +142,15 @@ async def process_query(

# Yield parsed messages
async for data in query.receive_messages():
yield parse_message(data)
try:
yield parse_message(data)
except MessageParseError as e:
logger.warning(
"Skipping unknown message type: %s. "
"This may be due to a newer CLI version. "
"Consider upgrading the SDK.",
e,
)

finally:
await query.close()