Skip to main content
The session management classes allow you to start and interact with agent sessions.

Session

The Session class is the primary way to start and interact with agent sessions.

Constructor Parameters

string
required
Name of the deployed agent to interact with. A ValueError is raised if it is empty.
string
required
Public API key for authentication.
SessionParams
Optional parameters to configure the session.

Methods

async
Starts a new session with the specified agent.ReturnsA dictionary containing session information. If use_daily is True, includes dailyRoom URL and dailyToken.RaisesAgentStartError: If the session fails to start due to missing API key, agent not found, agent not ready, or capacity limits.

SessionParams

The SessionParams class allows you to configure a session.

Parameters

Dict[str, Any]
default:"None"
Optional dictionary of data to pass to the agent. Must be JSON-serializable.
boolean
default:"False"
If True, creates a Daily WebRTC room for the session, enabling voice interaction.
Dict[str, Any]
default:"None"
Optional dictionary of properties to configure the Daily room. Only used when use_daily=True.See Daily API documentation for available properties.

SmallWebRTCSessionManager

Coordinates the wait between a Pipecat Cloud session starting and a SmallWebRTCTransport connection arriving. A room-less SmallWebRTC bot is activated over HTTP before the WebRTC connection exists, so the entry point has to wait for it rather than proceed immediately.

Constructor Parameters

int
default:"120"
How long wait_for_webrtc() waits before giving up.

Methods

async
Waits for the WebRTC connection.RaisesTimeoutError if no connection arrives within timeout_seconds. RuntimeError if a wait is already in progress — one manager handles one wait at a time.
bool
Releases a pending wait, cancelling its timeout. Returns True if there was a wait to complete, False otherwise.
bool
Cancels the timeout without completing the wait. Returns True if there was a timeout to cancel, False otherwise.