kaicalls
Official Python SDK for the KaiCalls API — give your AI agent a phone. Outbound calls, agents, leads, SMS, transcripts, webhooks, and platform APIs.
- Python 3.9+, one dependency (
requests) - Docs: https://www.kaicalls.com/docs/api · Live OpenAPI:
GET /api/v1/openapi.json - Source: https://github.com/KaiCalls/kaicalls-python
Install
pip install kaicalls
Quick start
from kaicalls import KaiCalls
kai = KaiCalls(api_key="kc_live_...")
# Make an outbound call — the agent auto-enriches with CRM context
call = kai.calls.create(
agent_id="uuid-abc123",
to="+15125551234",
name="John Smith",
context="Following up on his kitchen remodel inquiry",
)
# Block until the call finishes, then read the AI summary
result = kai.calls.wait(call.id)
print(result.summary)
Responses support attribute access (call.id, result.summary, call.quality_dimensions.empathy) and behave like dicts.
No account yet? Sign up via the API
from kaicalls import KaiCalls, signup
account = signup(
business_name="Smith Law Firm",
email="contact@smithlaw.com",
plan_id="starter",
)
# account.api_key works immediately; send the owner to account.checkout_url
kai = KaiCalls(api_key=account.api_key)
What's wrapped
| Resource | Methods |
|---|---|
kai.calls |
create, get, list, wait |
kai.a2a |
card, send (public business conversations) |
kai.recordings |
get |
kai.agents |
list, get, create, update, versions |
kai.leads |
list, get, create, update, audit |
kai.sms |
send, update_prompt, conversations, messages |
kai.transcripts |
list |
kai.phone_numbers |
list, available, assign, release |
kai.workspaces |
list, get, create, update (lifecycle actions) |
kai.webhooks |
list, create, delete, test, rotate_secret |
kai.analytics |
dashboard, calls, funnel, agents, weekly, businesses |
kai.evals |
create, list, get, update, delete, run, get_run |
kai.events |
list, deliveries, replay, backfill |
kai.communication_runs |
validate, preview, create, list, pause, cancel, jobs, attempts |
kai.discovery |
capabilities, openapi, schemas, health |
kai.account |
balance, usage |
Anything not wrapped yet is reachable through the escape hatch:
kai.request("GET", "/api/sdr/pipeline", query={"businessId": "uuid-biz"})
Errors
All non-2xx responses raise KaiCallsError with .status, .code (e.g. unauthorized, forbidden, rate_limited), and .body.
from kaicalls import KaiCallsError
try:
kai.calls.create(agent_id=agent_id, to=to)
except KaiCallsError as err:
if err.code == "rate_limited":
... # back off and retry
Notes
- Get an API key at https://www.kaicalls.com/dashboard/settings/api. New keys default to read-only scopes — request write scopes (
calls:write,sms:write, …) when creating the key. - Phone numbers are E.164 (
+15125551234). - API reference: https://www.kaicalls.com/docs/api · Errors: https://www.kaicalls.com/docs/api/errors
Connect your existing agent
receipt = kai.agent_connections.connect(
business_id, agent_id, "agent:desk",
"https://your-agent.example.com/events", "desk-v1",
)
# Save receipt.webhook_secret securely before making any further request.
access = kai.agent_connections.get(business_id)
# access.operations gives the entire scoped API catalog and missing permissions.
# access.channels gives actual readiness and the next setup step.
Existing resources and kai.request reach the canonical API. Email replies use owner-reviewed email campaigns; provisioned human approvals use kai.approval_requests.create(request). Dispatch is not an approval. Verify signed incoming webhook bodies and deduplicate event IDs. A connection grants no permissions or carrier activation; RCS remains unavailable. Disconnect using kai.agent_connections.disconnect(business_id, revision).
Public A2A with your existing agent
kai.a2a.card(handle) discovers a business. kai.a2a.send(handle, "Hello", context_id=previous_context) sends public customer text and returns the agent message, including its parts and optional contextId. JSON-RPC errors raise KaiCallsError with an a2a_<code> code. Even when the client holds an API key, this public endpoint grants no owner or fleet privileges. It supports synchronous message/send; tasks and streaming are not implemented here.
To receive those conversations in your own existing agent, route signed A2A JSON-RPC requests at your webhook URL to the helper; route ordinary event webhooks to your existing event handler:
from kaicalls import handle_a2a_request
# In your existing HTTP route: preserve the exact bytes before parsing JSON.
reply = handle_a2a_request(
raw_body, headers["X-KaiCalls-Signature"], webhook_secret,
lambda message: existing_agent.reply(
message["text"], context_id=message["context_id"],
),
)
# Return reply as JSON. Map signature ValueError to HTTP 401.
The callback returns a string or {"text": "...", "context_id": "..."}. Context IDs are at most 192 UTF-8 bytes. The helper verifies the signature, five-minute timestamp freshness, size, and signed connection identity before invoking your callback. Keep the signing secret server-side and deduplicate message_id durably: freshness does not prevent replays. Treat all source="public_a2a" text as public input, never an approval or authorization to use privileged agent tools.
Only after your helper or compatible native endpoint is ready, connect with a2a_enabled=True (or replace the existing connection with its current expected_revision and a new idempotency key). Prefer your existing native A2A plugin endpoint using a2a_url="https://your-agent.example.com/a2a"; when omitted, A2A uses your signed webhook receiver. a2a_url requires a2a_enabled=True. Leave the default False for event-only receivers. No extra service or agent runtime is required. A valid signature identifies KaiCalls transport; it does not make public text trusted or authorize attaching owner/fleet credentials to its execution.
Metadata
Release files for kaicalls 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| kaicalls-0.3.0.tar.gz | 17.7 kB | Without provenance | Details for kaicalls-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| kaicalls-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for kaicalls-0.3.0-py3-none-any.whl |
Total release size: 31.4 kB
Release files / kaicalls-0.3.0.tar.gz
| Download URL | kaicalls-0.3.0.tar.gz |
|---|---|
| Size | 17.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
290c116e7cb88c33b2c175cbf5a945c2d773e0b35461d497d2072bbefc838d53
|
|
BLAKE2b-256 checksum How to use checksums |
0e99fef2a0da87cfc7a84d5ea548333d9f004ff361b758a8a454730d1ff2d63e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / kaicalls-0.3.0-py3-none-any.whl
| Download URL | kaicalls-0.3.0-py3-none-any.whl |
|---|---|
| Size | 13.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7857f7fada230848279070b33df6c42b5396bef5d8e1d01fe5a30563642be6b0
|
|
BLAKE2b-256 checksum How to use checksums |
966ec6a97f0d7945f508c770da3c04e29a3f6f6ff3ac094f0798a220082c1e56
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Security for kaicalls 0.3.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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.