The Pipecat Cloud Python SDK provides a programmatic interface for managing and interacting with your agents. It allows you to start and manage agent sessions, handle different session types, and respond to various error conditions.

Installation

Install the SDK using pip:

pip install pipecatcloud

Key Components

The SDK contains several main components:

Quick Start

Here’s a simple example to get started:

from pipecatcloud.exception import AgentStartError
from pipecatcloud.session import Session, SessionParams

async def main():
    try:
        # Create a session with a voice-enabled agent
        session = Session(
            agent_name="my-agent",
            api_key="pk_your_api_key",
            params=SessionParams(use_daily=True)
        )

        # Start the session
        response = await session.start()

        # Get the Daily room URL with token
        daily_url = f"{response['dailyRoom']}?t={response['dailyToken']}"
        print(f"Join your agent at: {daily_url}")

    except AgentStartError as e:
        print(f"Error starting agent: {e}")

For more detailed examples and use cases, see the Examples section.