Post-Call Analytics

View as MarkdownOpen in Claude

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

What Gets Generated

Every completed call includes postCallAnalytics:

FieldDescription
summaryAI-generated call summary
dispositionMetricsExtracted data points you configure

Accessing Post-Call Data

1from smallestai.atoms.call import Call
2
3call = Call()
4
5# Get call details
6details = call.get_call("CALL-1768842587790-69eb58")
7data = details["data"]
8
9# Access analytics
10analytics = data.get("postCallAnalytics", {})
11
12print(f"Summary: {analytics.get('summary')}")
13
14for metric in analytics.get("dispositionMetrics", []):
15 print(f" {metric['identifier']}: {metric['value']}")
16 print(f" Confidence: {metric['confidence']}")
17 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:

1from smallestai.atoms.call import Call
2
3call = Call()
4
5call.set_post_call_config(
6 agent_id="696e655577e1d88ff54b4fbf",
7 summary_prompt="Summarize this sales call briefly.",
8 disposition_metrics=[
9 {
10 "identifier": "user_interested",
11 "dispositionMetricPrompt": "Was the user interested? yes, no, or unclear",
12 "dispositionValues": {"type": "ENUM"},
13 "choices": ["yes", "no", "unclear"]
14 },
15 {
16 "identifier": "user_name",
17 "dispositionMetricPrompt": "What is the user's name? Return 'unknown' if not mentioned.",
18 "dispositionValues": {"type": "STRING"}
19 }
20 ]
21)

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
dispositionValues.typeYesSTRING, BOOLEAN, INTEGER, ENUM, DATETIME
choicesFor ENUMList of allowed values

Getting Current Configuration

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

Complete Example: Sales Call Analytics

1import time
2from smallestai.atoms import AtomsClient
3from smallestai.atoms.call import Call
4from smallestai.atoms.audience import Audience
5from smallestai.atoms.campaign import Campaign
6
7client = AtomsClient()
8call = Call()
9audience = Audience()
10campaign = Campaign()
11
12# 1. Create agent
13agent = client.new_agent(
14 name=f"Sales Agent {int(time.time())}",
15 prompt="You are a sales agent. Ask if interested and get their name.",
16 description="Testing disposition metrics"
17)
18agent_id = agent.data
19
20# 2. Configure disposition metrics
21call.set_post_call_config(
22 agent_id=agent_id,
23 summary_prompt="Summarize this sales call briefly.",
24 disposition_metrics=[
25 {
26 "identifier": "user_interested",
27 "dispositionMetricPrompt": "Was the user interested? yes, no, or unclear",
28 "dispositionValues": {"type": "ENUM"},
29 "choices": ["yes", "no", "unclear"]
30 },
31 {
32 "identifier": "user_name",
33 "dispositionMetricPrompt": "What is the user's name? Return 'unknown' if not mentioned.",
34 "dispositionValues": {"type": "STRING"}
35 }
36 ]
37)
38
39# 3. Create audience and campaign
40phones = client.get_phone_numbers()
41phone_id = phones["data"][0]["_id"]
42
43aud = audience.create(
44 name=f"Test Audience {int(time.time())}",
45 phone_numbers=["+916366821717"],
46 names=[("Test", "User")]
47)
48audience_id = aud["data"]["_id"]
49
50camp = campaign.create(
51 name=f"Analytics Test {int(time.time())}",
52 agent_id=agent_id,
53 audience_id=audience_id,
54 phone_ids=[phone_id]
55)
56campaign_id = camp["data"]["_id"]
57
58# 4. Start campaign
59campaign.start(campaign_id)
60print("Call in progress...")
61
62# 5. Wait for completion
63time.sleep(60)
64
65# 6. Get call with analytics
66calls = call.get_calls(agent_id=agent_id, limit=1)
67call_id = calls["data"]["logs"][0]["callId"]
68
69details = call.get_call(call_id)
70data = details["data"]
71
72# 7. Display results
73print(f"\nCall Status: {data['status']}")
74print(f"Duration: {data['duration']}s")
75
76print("\nTranscript:")
77for line in data.get("transcript", []):
78 print(f" [{line['role'].upper()}]: {line['content']}")
79
80analytics = data.get("postCallAnalytics", {})
81if analytics:
82 print(f"\nSummary: {analytics.get('summary')}")
83 print("\nDisposition Metrics:")
84 for m in analytics.get("dispositionMetrics", []):
85 print(f" {m['identifier']}: {m['value']}")
86 print(f" Confidence: {m['confidence']}")
87 print(f" Reasoning: {m['reasoning']}")
88
89# 8. Cleanup
90campaign.delete(campaign_id)
91audience.delete(audience_id)
92client.delete_agent(id=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.”