End conversation tool
Configure end_conversation to let an Assistant hang up when the caller is done. You can set a closing message and instructions for when to use the tool.
What is the end conversation tool?
The end_conversation System Tool ends the current call.
When configured, the Assistant can decide when to end the conversation based on context, such as when the user explicitly asks to hang up or when the conversation reaches a natural conclusion.
Use descriptionOverride to tell the Assistant when to end the call and closingMessage to set what it says before disconnecting.
When the Assistant ends calls
The Assistant can use end_conversation when:
- The caller asks to hang up or says goodbye.
- All questions have been answered.
- The call's task is complete.
- The caller confirms they need no further help.
The exact triggering behaviour depends on your Assistant's system prompt and instructions.
Setting up the end conversation tool
The API paths below are relative to https://newprd.reecall.io/data_next.
Step 1: fetch the tool definition
Retrieve the end_conversation Tool Definition ID:
Code
Use the id from the response as definitionId when creating the Tool:
Code
Step 2: create the tool
Create a Tool instance with your configuration and link it to an Assistant with assistantId:
Code
Configuration reference
Tool fields
| Field | Type | Required | Description |
|---|---|---|---|
descriptionOverride | string | No | Custom description shown to the LLM, overriding the default |
Use descriptionOverride to specify the conditions under which the Assistant should end the call.
Configuration object
| Field | Type | Required | Description |
|---|---|---|---|
closingMessage | string | No | Message the Assistant speaks before ending the call |
Note
If closingMessage is omitted, the tool ends the call without speaking a closing message.
Behaviour
The Channel determines how the call disconnects.
SIP Channel
For SIP connections, the Assistant shuts down its session and deletes the LiveKit room. LiveKit tears down the SIP participant and the associated phone call.
| Step | Action |
|---|---|
| 1 | If closingMessage is configured, Assistant speaks it via RTP |
| 2 | If message was spoken, system waits for the audio to finish playing |
| 3 | Assistant shuts down the session and deletes the room |
| 4 | LiveKit disconnects the SIP participant and ends the call |
WebRTC Channel
For WebRTC connections, the Assistant notifies your client via RPC before ending the conversation. The Assistant waits up to 5 seconds for the RPC response, then shuts down the session even if the notification fails or the client does not acknowledge it. Handle EndCall to perform your application cleanup.
| Step | Action |
|---|---|
| 1 | If closingMessage is configured, Assistant speaks it |
| 2 | If message was spoken, system waits for the audio to finish playing |
| 3 | Assistant sends EndCall RPC request to your WebRTC client |
| 4 | Conversation terminates after the response, timeout, or RPC failure |