Call2Me
SDKsPython
🐍

Python SDK

Official Call2Me client library for Python

call2mev1.0.0GitHub

Installation

Terminal
pip install call2me

Quick Start

Initialize Clientpython
from call2me import Call2Me

# Initialize with API key
client = Call2Me(api_key="sk_call2me_...")

Features

Type Safe

Full type definitions for all APIs

Async Support

Native async/await support

Auto Retry

Built-in retry with exponential backoff

Error Handling

Detailed error messages and types

Streaming

Real-time event streaming support

Pagination

Automatic pagination helpers

All Examples

Initialize Client

from call2me import Call2Me

# Initialize with API key
client = Call2Me(api_key="sk_call2me_...")

Create Agent

agent = client.agents.create(
    agent_name="Support Agent",
    voice_id="elevenlabs-selin",
    language="tr-TR",
    response_engine={
        "type": "call2me-llm",
        "system_prompt": "Sen yardımsever bir asistansın.",
        "llm_provider": "openai",
        "llm_model": "gpt-4-turbo"
    },
    begin_message="Merhaba, size nasıl yardımcı olabilirim?"
)

print(f"Agent created: {agent.agent_id}")

Make Outbound Call

call = client.calls.create(
    agent_id=agent.agent_id,
    to_number="+905551234567",
    dynamic_variables={
        "customer_name": "Ahmet",
        "order_id": "ORD-2024-001"
    }
)

# Wait for call to complete
call = client.calls.wait(call.call_id)
print(f"Call duration: {call.duration_ms}ms")
print(f"Transcript: {call.transcript}")

Knowledge Base

# Create knowledge base
kb = client.knowledge_base.create(
    knowledge_base_name="Product FAQ",
    knowledge_base_texts=[
        {"title": "İade Politikası", "text": "14 gün içinde iade..."}
    ]
)

# Upload documents
kb = client.knowledge_base.upload(
    knowledge_base_name="Docs",
    files=["manual.pdf", "faq.docx"]
)

# Query
results = client.knowledge_base.query(
    kb_id=kb.knowledge_base_id,
    query="İade süresi ne kadar?",
    top_k=3
)

Ready to Build?

Follow our guides to build your first voice agent.