ClaudeAgentSDK.Transport behaviour (claude_agent_sdk v0.6.9)
View SourceBehaviour describing the transport layer used to communicate with the Claude CLI.
A transport is responsible for starting and supervising the underlying connection, forwarding JSON control/data frames to the CLI, broadcasting replies to subscribers, and shutting down cleanly when the client stops.
Implementations should be OTP-friendly processes (typically a GenServer)
that encapsulate any state required to maintain the connection.
Summary
Types
Binary payload encoded as newline-terminated JSON.
Transport-specific options propagated from Client.start_link/1.
Opaque transport reference returned from start_link/1.
Callbacks
Closes the transport and releases any external resources.
Sends a JSON payload to the CLI.
Starts the transport process and establishes the CLI connection.
Returns the current connection status for observability/health checks.
Subscribes the given process to receive inbound messages.
Types
Callbacks
@callback close(t()) :: :ok
Closes the transport and releases any external resources.
Sends a JSON payload to the CLI.
Starts the transport process and establishes the CLI connection.
@callback status(t()) :: :connected | :disconnected | :error
Returns the current connection status for observability/health checks.
Subscribes the given process to receive inbound messages.