Skip to main content

BESS AI Python SDK

Official Python SDK for the BESS AI Voice Platform.

Installation

pip install bessai

Quick Start

from bessai import BessAI

client = BessAI(api_key="bess_sk_live_a1b2c3d4...")

# Create an agent
agent = client.agents.create(
    name="Customer Support",
    llm_provider="openai",
    llm_model="gpt-4o",
    system_prompt="You are a helpful customer support agent.",
    voice_provider="elevenlabs",
    voice_id="21m00Tcm4TlvDq8ikWAM",
    language="en-US",
)

# Make a phone call
call = client.calls.create_phone_call(
    agent_id=agent.id,
    from_number="+14157774444",
    to_number="+12137774445",
    metadata={"customer_id": "cust_123"},
)

print(call.id)
print(call.status)

Async Usage

from bessai import AsyncBessAI

async def main():
    async with AsyncBessAI(api_key="bess_sk_live_...") as client:
        agents = await client.agents.list()
        for agent in agents:
            print(agent.name)

Configuration

# From environment variable
import os
os.environ["BESSAI_API_KEY"] = "bess_sk_live_..."
client = BessAI()  # Reads from BESSAI_API_KEY

# Custom base URL (self-hosted)
client = BessAI(
    api_key="bess_sk_live_...",
    base_url="https://your-instance.example.com",
    timeout=60.0,
    max_retries=5,
)

Resources

Resource Methods
client.agents create, list, get, update, delete, publish, list_versions
client.calls create_phone_call, create_web_call, list, get, end, delete
client.phone_numbers create, list, get, update, delete
client.batch_calls create, list, get, get_status, get_items, start, pause, resume, cancel, delete
client.workflows generate, list, get, update, delete, deploy, execute, test
client.analytics get_summary, get_latency, get_calls_by_day
client.knowledge_bases create, list, get, delete, upload_document, delete_document
client.api_keys create, list, get, update, delete, rotate, get_usage

Error Handling

from bessai import BessAI, AuthenticationError, RateLimitError, NotFoundError

client = BessAI(api_key="bess_sk_live_...")

try:
    agent = client.agents.get("invalid-id")
except AuthenticationError:
    print("Invalid API key")
except RateLimitError as e:
    print(f"Rate limited. Retry after {e.retry_after}s")
except NotFoundError:
    print("Agent not found")

API Key Management

# Create a scoped API key
key = client.api_keys.create(
    name="CI/CD Pipeline",
    scopes=["agents:read", "calls:write"],
    expires_in_days=90,
    rate_limit_tier="professional",
)
print(key.key)  # Only shown once!

# Rotate a key with 24h grace period
new_key = client.api_keys.rotate(key.id, grace_period_hours=24)

Requirements

  • Python >= 3.8
  • httpx >= 0.24.0
  • pydantic >= 2.0.0
  • websockets >= 11.0

License

MIT

Metadata

Release files for bessai 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bessai 0.2.0
File Size Uploaded Provenance Actions
bessai-0.2.0.tar.gz 37.5 kB With provenance Details for bessai-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for bessai 0.2.0
File Interpreter ABI Platform Actions
bessai-0.2.0-py3-none-any.whl Python 3 none any Details for bessai-0.2.0-py3-none-any.whl

Total release size: 88.7 kB

Release files / bessai-0.2.0.tar.gz

Download URL bessai-0.2.0.tar.gz
Size 37.5 kB
Tags Source
SHA-256 checksum
How to use checksums
2d20d7efc48da863ee89af25c9b6b439ed9324a693953887dc9b7916a14dad52
BLAKE2b-256 checksum
How to use checksums
14dab23454638192f71e48a7d97c0276a97c8945c1d342c8a1baecda8f9da1ba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 21, 2026.

Transparency log

Release files / bessai-0.2.0-py3-none-any.whl

Download URL bessai-0.2.0-py3-none-any.whl
Size 51.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6307831e6fe4e8cec5fd8e502102e02e975d7255080fa1ad7190b3e844cdcb8f
BLAKE2b-256 checksum
How to use checksums
34aadf2ad3379af198c8ae560c5fb88e6662530a3e61bf3d6d7950e33e4881f0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 21, 2026.

Transparency log

Security for bessai 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for bessai-0.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 21, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page