When creating agents with Pipecat Cloud, your bot() entry point function receives different types of arguments depending on the session type. These classes represent the structure of those arguments.

SessionArguments

Base class for all session argument types, providing common properties.

from pipecatcloud.agent import SessionArguments

def bot(args: SessionArguments):
    print(f"Session ID: {args.session_id}")

Properties

session_id
Optional[str]

The unique identifier for the current session.

PipecatSessionArguments

Standard Pipecat Cloud agent session arguments, used for basic sessions.

from pipecatcloud.agent import PipecatSessionArguments

def bot(args: PipecatSessionArguments):
    print(f"Session ID: {args.session_id}")
    print(f"Custom data: {args.body}")

Properties

session_id
Optional[str]

The unique identifier for the current session.

body
Any

The custom data passed to the agent via the session parameters.

DailySessionArguments

Arguments for sessions that involve Daily WebRTC rooms for voice/video interaction.

from pipecatcloud.agent import DailySessionArguments

def bot(args: DailySessionArguments):
    print(f"Session ID: {args.session_id}")
    print(f"Daily room URL: {args.room_url}")
    print(f"Daily token: {args.token}")
    print(f"Custom data: {args.body}")

Properties

session_id
Optional[str]

The unique identifier for the current session.

room_url
str

The URL for the Daily room.

token
str

The authentication token for the Daily room.

body
Any

The custom data passed to the agent via the session parameters.

WebSocketSessionArguments

Arguments for sessions that use WebSocket connections for real-time communication.

from pipecatcloud.agent import WebSocketSessionArguments

async def bot(args: WebSocketSessionArguments):
    print(f"Session ID: {args.session_id}")
    await args.websocket.send_text("Hello from the agent!")

Properties

session_id
Optional[str]

The unique identifier for the current session.

websocket
WebSocket

The FastAPI WebSocket connection used to communicate with the client.