Session
The Session class manages multi-turn conversations with Claude. It matches the official Claude Agent SDK V2 interface.Creating Sessions
Sessions are created via the client. Connection happens automatically on firstsend().
Methods
send()
Send a message to Claude. Returns a Promise that resolves when the message is sent. Usestream() to receive the response.
Supports both text-only messages and multimodal content (text + images + documents).
Text Message
With Image
With Document (PDF)
Multiple Attachments
stream()
Stream the response after sending a message. Returns an async generator that yields SDK messages.SDKMessage Types
Example
receive()
Alias forstream() for V2 compatibility.