Instalación
Requisitos
Python 3.8+
Soporta operaciones sincrónicas y asincrónicas
Obtener Tu Clave API
Para usar el SDK, necesitarás una clave API desde tu panel de control de itellicoAI :
Navega a Desarrolladores desde la barra lateral
Haz clic en Claves API
Haz clic en Crear Clave API
Copia la clave generada para usarla con el SDK
Almacena tu clave API de forma segura usando variables de entorno. Nunca la subas al control de versiones.
Inicio Rápido
from itellicoai import Itellicoai
# Initialize client
client = Itellicoai(
api_key = "your-api-key"
)
# Create an agent
agent = client.agents.create(
account_id = "your-account-id" ,
name = "Customer Support Agent" ,
model = {
"provider" : "openai" ,
"model" : "gpt-4o-mini"
},
voice = {
"provider" : "elevenlabs" ,
"voice_id" : "EXAVITQu4vr4xnSDxMaL"
},
transcriber = {
"provider" : "deepgram" ,
"model" : "nova-2:general" ,
"language" : "en-US"
},
initial_message = {
"mode" : "fixed_message" ,
"message" : "Hello! How can I assist you today?" ,
"delay_ms" : 1000
},
max_duration_seconds = 1800 ,
tags = [ "support" , "customer-service" ]
)
print ( f "Created agent: { agent.id } " )
Soporte Async
import asyncio
from itellicoai import AsyncItellicoAI
async def main ():
client = AsyncItellicoAI( api_key = "your-api-key" )
# List agents asynchronously
agents = await client.agents.list()
for agent in agents:
print ( f "Agent: { agent.name } " )
asyncio.run(main())
Operaciones del SDK
Listar Agentes from itellicoai import Itellicoai
client = Itellicoai(
api_key = "My API Key" ,
)
agents = client.agents.list(
account_id = "account_id" ,
)
print (agents.count)
Obtener Agente from itellicoai import Itellicoai
client = Itellicoai(
api_key = "My API Key" ,
)
agent_response = client.agents.retrieve(
agent_id = "agent_id" ,
account_id = "account_id" ,
)
print (agent_response.id)
Actualizar Agente from itellicoai import Itellicoai
client = Itellicoai(
api_key = "My API Key" ,
)
agent_response = client.agents.update(
agent_id = "agent_id" ,
account_id = "account_id" ,
)
print (agent_response.id)
Archivar Agente from itellicoai import Itellicoai
client = Itellicoai(
api_key = "My API Key" ,
)
client.agents.archive(
agent_id = "agent_id" ,
account_id = "account_id" ,
)
Listar Conversaciones from itellicoai import Itellicoai
client = Itellicoai( api_key = "My API Key" )
conversations = client.accounts.list_conversations(
account_id = "account_id"
)
for conv in conversations.items:
print ( f "Conversation ID: { conv.conversation_id } " )
print ( f "Contact: { conv.contact_number } " )
print ( f "Duration: { conv.duration_seconds } s" )
print ( f "Status: { conv.status } " )
Listar Números de Teléfono from itellicoai import Itellicoai
client = Itellicoai(
api_key = "My API Key" ,
)
phone_numbers = client.accounts.phone_numbers.list(
account_id = "account_id" ,
)
print (phone_numbers.count)
Crear Número de Teléfono from itellicoai import Itellicoai
client = Itellicoai(
api_key = "My API Key" ,
)
phone_number = client.accounts.phone_numbers.create(
account_id = "account_id" ,
sip_trunk_id = "sip_trunk_id" ,
)
print (phone_number.id)
Obtener Número de Teléfono from itellicoai import Itellicoai
client = Itellicoai(
api_key = "My API Key" ,
)
phone_number = client.accounts.phone_numbers.retrieve(
phone_number_id = "phone_number_id" ,
account_id = "account_id" ,
)
print (phone_number.id)
Actualizar Número de Teléfono from itellicoai import Itellicoai
client = Itellicoai(
api_key = "My API Key" ,
)
phone_number = client.accounts.phone_numbers.update(
phone_number_id = "phone_number_id" ,
account_id = "account_id" ,
)
print (phone_number.id)
Eliminar Número de Teléfono from itellicoai import Itellicoai
client = Itellicoai(
api_key = "My API Key" ,
)
client.accounts.phone_numbers.delete(
phone_number_id = "phone_number_id" ,
account_id = "account_id" ,
)
Listar Modelos from itellicoai import Itellicoai
client = Itellicoai(
api_key = "My API Key" ,
)
response = client.accounts.providers.list_models(
account_id = "account_id" ,
)
print (response)
Listar Transcriptores from itellicoai import Itellicoai
client = Itellicoai(
api_key = "My API Key" ,
)
response = client.accounts.providers.list_transcribers(
account_id = "account_id" ,
)
print (response)
Listar Voces from itellicoai import Itellicoai
client = Itellicoai(
api_key = "My API Key" ,
)
response = client.accounts.providers.list_voices(
account_id = "account_id" ,
provider = "provider" ,
)
print (response)
Listar Trunks SIP from itellicoai import Itellicoai
client = Itellicoai(
api_key = "My API Key" ,
)
sip_trunks = client.accounts.sip_trunks.list(
account_id = "account_id" ,
)
print (sip_trunks.count)
Crear Trunk SIP from itellicoai import Itellicoai
client = Itellicoai(
api_key = "My API Key" ,
)
sip_trunk = client.accounts.sip_trunks.create(
account_id = "account_id" ,
)
print (sip_trunk.id)
Obtener Trunk SIP from itellicoai import Itellicoai
client = Itellicoai(
api_key = "My API Key" ,
)
sip_trunk = client.accounts.sip_trunks.retrieve(
sip_trunk_id = "sip_trunk_id" ,
account_id = "account_id" ,
)
print (sip_trunk.id)
Actualizar Trunk SIP from itellicoai import Itellicoai
client = Itellicoai(
api_key = "My API Key" ,
)
sip_trunk = client.accounts.sip_trunks.update(
sip_trunk_id = "sip_trunk_id" ,
account_id = "account_id" ,
)
print (sip_trunk.id)
Eliminar Trunk SIP from itellicoai import Itellicoai
client = Itellicoai(
api_key = "My API Key" ,
)
client.accounts.sip_trunks.delete(
sip_trunk_id = "sip_trunk_id" ,
account_id = "account_id" ,
)
Obtener Análisis de Uso response = client.accounts.analytics.get_usage(
account_id = "account_id" ,
)
print (response.meta)
Listar Subcuentas subaccounts = client.accounts.subaccounts.list(
account_id = "account_id" ,
)
print (subaccounts.count)
Crear Subcuenta account = client.accounts.subaccounts.create(
account_id = "account_id" ,
name = "name" ,
)
print (account.id)
Obtener Subcuenta account = client.accounts.subaccounts.retrieve(
subaccount_id = "subaccount_id" ,
account_id = "account_id" ,
)
print (account.id)
Actualizar Subcuenta account = client.accounts.subaccounts.update(
subaccount_id = "subaccount_id" ,
account_id = "account_id" ,
)
print (account.id)
Manejo de Errores
from itellicoai import ItellicoAI
from itellicoai.exceptions import (
AuthenticationError,
NotFoundError,
RateLimitError,
APIError
)
client = ItellicoAI( api_key = "your-api-key" )
try :
agent = client.agents.retrieve( "agent_123abc" )
except AuthenticationError:
print ( "Invalid API key" )
except NotFoundError:
print ( "Agent not found" )
except RateLimitError:
print ( "Rate limit exceeded" )
except APIError as e:
print ( f "API error: { e.message } " )
Variables de Entorno
import os
from itellicoai import ItellicoAI
# API key automatically loaded from ITELLICO_API_KEY env var
client = ItellicoAI()
# Or set explicitly
client = ItellicoAI( api_key = os.getenv( "ITELLICO_API_KEY" ))
Recursos