Class: ClaudeAgentSDK::Transport

Inherits:
Object
  • Object
show all
Defined in:
lib/claude_agent_sdk/transport.rb

Overview

Abstract transport for Claude communication

WARNING: This internal API is exposed for custom transport implementations (e.g., remote Claude Code connections). The Claude Code team may change or remove this abstract class in any future release. Custom implementations must be updated to match interface changes.

Direct Known Subclasses

SubprocessCLITransport

Instance Method Summary collapse

Instance Method Details

#closeObject

Close the transport connection and clean up resources

Raises:

  • (NotImplementedError)


29
30
31
# File 'lib/claude_agent_sdk/transport.rb', line 29

def close
  raise NotImplementedError, 'Subclasses must implement #close'
end

#connectObject

Connect the transport and prepare for communication

Raises:

  • (NotImplementedError)


12
13
14
# File 'lib/claude_agent_sdk/transport.rb', line 12

def connect
  raise NotImplementedError, 'Subclasses must implement #connect'
end

#end_inputObject

End the input stream (close stdin for process transports)

Raises:

  • (NotImplementedError)


40
41
42
# File 'lib/claude_agent_sdk/transport.rb', line 40

def end_input
  raise NotImplementedError, 'Subclasses must implement #end_input'
end

#read_messagesEnumerator

Read and parse messages from the transport

Returns:

  • (Enumerator)

    Async enumerator of parsed JSON messages

Raises:

  • (NotImplementedError)


24
25
26
# File 'lib/claude_agent_sdk/transport.rb', line 24

def read_messages
  raise NotImplementedError, 'Subclasses must implement #read_messages'
end

#ready?Boolean

Check if transport is ready for communication

Returns:

  • (Boolean)

    True if transport is ready to send/receive messages

Raises:

  • (NotImplementedError)


35
36
37
# File 'lib/claude_agent_sdk/transport.rb', line 35

def ready?
  raise NotImplementedError, 'Subclasses must implement #ready?'
end

#write(data) ⇒ Object

Write raw data to the transport

Parameters:

  • data (String)

    Raw string data to write (typically JSON + newline)

Raises:

  • (NotImplementedError)


18
19
20
# File 'lib/claude_agent_sdk/transport.rb', line 18

def write(data)
  raise NotImplementedError, 'Subclasses must implement #write'
end