Skip to navigation

Post-Call Analytics

Configure AI summaries and disposition metrics for automated call insights.
View as Markdown

After each call, the platform automatically generates analytics. You can configure what data to extract.

On an Enterprise organization with Zero Data Retention enabled, postCallAnalytics is not retained after the analytics-completed webhook is delivered. Consume it from the webhook rather than reading it back later.

What Gets Generated

Every completed call includes postCallAnalytics:

FieldDescription
summaryAI-generated call summary
dispositionMetricsExtracted data points you configure

Accessing Post-Call Data

from smallestai.atoms.helpers import CallAnalytics
call = CallAnalytics() # reads SMALLEST_API_KEY from the environment
# Get call details
details = call.get_call("CALL-1768842587790-69eb58")
data = details["data"]
# Access analytics
analytics = data.get("postCallAnalytics", {})
print(f"Summary: {analytics.get('summary')}")
for metric in analytics.get("dispositionMetrics", []):
print(f" {metric['identifier']}: {metric['value']}")
print(f" Confidence: {metric['confidence']}")
print(f" Reasoning: {metric['reasoning']}")

Example Output

Summary: The call involved an agent reaching out to discuss AI products.
The user expressed interest and provided their name.
user_interested: yes
Confidence: 1
Reasoning: The user explicitly stated 'I am interested'.
user_name: John
Confidence: 1
Reasoning: The user provided their name directly.

Configuring Disposition Metrics

Use set_post_call_config() to define what data to extract:

from smallestai.atoms.helpers import CallAnalytics
call = CallAnalytics()
call.set_post_call_config(
agent_id="696e655577e1d88ff54b4fbf",
summary_prompt="Summarize this sales call briefly.",
disposition_metrics=[
{
"identifier": "user_interested",
"dispositionMetricPrompt": "Was the user interested? yes, no, or unclear",
"dispositionMetricType": "ENUM",
"choices": ["yes", "no", "unclear"]
},
{
"identifier": "user_name",
"dispositionMetricPrompt": "What is the user's name? Return 'unknown' if not mentioned.",
"dispositionMetricType": "STRING"
}
]
)

Disposition Metric Types

TypeDescriptionRequires choices
STRINGFree text (names, notes)No
BOOLEANYes/No valuesNo
INTEGERNumeric values (ratings)No
ENUMSelection from predefined listYes
DATETIMEDate/time valuesNo

Metric Configuration Schema

Each disposition metric requires:

FieldRequiredDescription
identifierYesUnique ID (e.g., customer_status)
dispositionMetricPromptYesQuestion to extract this data
dispositionMetricTypeYesSTRING, BOOLEAN, INTEGER, ENUM, DATETIME
choicesFor ENUMList of allowed values

Getting Current Configuration

config = call.get_post_call_config("696e655577e1d88ff54b4fbf")
print("Configured metrics:")
for metric in config["data"].get("dispositionMetrics", []):
print(f" {metric['identifier']}: {metric['dispositionMetricType']}")

Complete Example: Sales Call Analytics

import time
from smallestai import SmallestAI
from smallestai.atoms.helpers import Audience, Campaign, CallAnalytics
client = SmallestAI()
call = CallAnalytics()
audience = Audience()
campaign = Campaign()
# 1. Create agent
agent = client.atoms.agents.create_agent(
name=f"Sales Agent {int(time.time())}",
global_prompt="You are a sales agent. Ask if interested and get their name.",
description="Testing disposition metrics"
)
agent_id = agent.data
# 2. Configure disposition metrics
call.set_post_call_config(
agent_id=agent_id,
summary_prompt="Summarize this sales call briefly.",
disposition_metrics=[
{
"identifier": "user_interested",
"dispositionMetricPrompt": "Was the user interested? yes, no, or unclear",
"dispositionMetricType": "ENUM",
"choices": ["yes", "no", "unclear"]
},
{
"identifier": "user_name",
"dispositionMetricPrompt": "What is the user's name? Return 'unknown' if not mentioned.",
"dispositionMetricType": "STRING"
}
]
)
# 3. Create audience and campaign
phones = client.atoms.phone_numbers.list()
phone_id = phones.data[0].id
aud = audience.create(
name=f"Test Audience {int(time.time())}",
phone_numbers=["+916366821717"],
names=[("Test", "User")]
)
audience_id = aud["data"]["_id"]
camp = campaign.create(
name=f"Analytics Test {int(time.time())}",
agent_id=agent_id,
audience_id=audience_id,
phone_ids=[phone_id]
)
campaign_id = camp["data"]["_id"]
# 4. Start campaign
campaign.start(campaign_id)
print("Call in progress...")
# 5. Wait for completion
time.sleep(60)
# 6. Get call with analytics
calls = call.get_calls(agent_id=agent_id, limit=1)
call_id = calls["data"]["logs"][0]["callId"]
details = call.get_call(call_id)
data = details["data"]
# 7. Display results
print(f"\nCall Status: {data['status']}")
print(f"Duration: {data['duration']}s")
print("\nTranscript:")
for line in data.get("transcript", []):
print(f" [{line['role'].upper()}]: {line['content']}")
analytics = data.get("postCallAnalytics", {})
if analytics:
print(f"\nSummary: {analytics.get('summary')}")
print("\nDisposition Metrics:")
for m in analytics.get("dispositionMetrics", []):
print(f" {m['identifier']}: {m['value']}")
print(f" Confidence: {m['confidence']}")
print(f" Reasoning: {m['reasoning']}")
# 8. Cleanup
campaign.delete(campaign_id)
audience.delete(audience_id)
client.atoms.agents.archive_agent(agent_id)

SDK Reference

MethodDescription
call.get_post_call_config(agent_id)Get agent’s analytics config
call.set_post_call_config(agent_id, ...)Configure summary and disposition metrics
call.get_call(call_id)Get call details with analytics
call.get_calls(agent_id=..., limit=...)List calls with optional filters

Tips

Disposition metrics are extracted after the call ends, typically within 10-30 seconds. The AI analyzes the transcript based on your configured prompts.

Be specific and direct. Instead of “What happened?”, use:

  • “Did the customer agree to schedule a follow-up? Answer yes or no.”
  • “What is the customer’s email? Return ‘not provided’ if not mentioned.”

Yes. New calls use the updated config. Existing calls keep their original analytics.

The metric will have an empty or null value. Specify fallback behavior in your prompts, like “Return ‘unknown’ if not mentioned.”