Voice Tools

End Call

Configure how and when your voice agent ends a call — trigger conditions, farewell messages, and post-call actions.

End Call

The End Call tool lets your voice agent programmatically hang up a call based on conversation context. Instead of waiting for the caller to disconnect, your agent can end the call gracefully after resolving the issue, completing a booking, or when the conversation reaches a natural conclusion.

When to Use

  • The caller's issue is resolved and they say "goodbye" or "thank you"
  • The agent has completed its task (e.g., appointment booked, order status provided)
  • The caller is unresponsive or silent for too long
  • The conversation reaches a predefined time limit
  • The caller is abusive or violating usage policies

Configuration

Via the Dashboard

  1. Open your agent and scroll to Voice Settings.
  2. Enable End Call.
  3. Configure the options:
SettingDescriptionDefault
Farewell messageWhat the agent says before hanging up"Thank you for calling. Goodbye!"
Silence timeoutSeconds of silence before auto-ending30 seconds
Max call durationMaximum call length before auto-endingNone (unlimited)
Post-call webhookURL to notify after the call endsNone
  1. Click Save.

Via the API

curl -X PATCH https://api.thinnest.ai/agents/agent_abc123 \
  -H "Authorization: Bearer $THINNESTAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "voice_tools": {
      "end_call": {
        "enabled": true,
        "farewell_message": "Thanks for calling Acme Corp! Have a great day.",
        "silence_timeout_seconds": 30,
        "max_duration_seconds": 600,
        "post_call_webhook": "https://your-app.com/webhooks/call-ended"
      }
    }
  }'

System Prompt Guidance

Add instructions to your agent's system prompt to control when it should end calls:

When the caller's issue is resolved and they confirm they don't need anything else,
say a brief goodbye and end the call. If the caller says "goodbye", "that's all",
or "thanks, bye", end the call immediately after a brief farewell.

Do not end the call if the caller still has questions or seems uncertain.

Post-Call Webhook

When a call ends, thinnestAI sends a webhook to your configured URL with the call summary:

{
  "event": "call.ended",
  "call_id": "call_xyz789",
  "agent_id": "agent_abc123",
  "duration_seconds": 145,
  "end_reason": "agent_ended",
  "transcript_url": "https://api.thinnest.ai/calls/call_xyz789/transcript",
  "recording_url": "https://api.thinnest.ai/calls/call_xyz789/recording"
}

The end_reason field indicates why the call ended:

ReasonDescription
agent_endedAgent triggered End Call
caller_hangupCaller disconnected
silence_timeoutNo speech detected for the configured timeout
max_durationCall reached the maximum duration limit
errorTechnical error during the call

On this page