#end_call system tool not being called. I'm using react sdk. the agent has been created in the platf

1 messages · Page 1 of 1 (latest)

foggy pebbleBOT
#
AI-generated Answer for krlmt8

Here’s how to get end_call working with a React SDK conversation when the agent is created in the dashboard:

  1. Confirm the system tool is enabled on the agent
  • Dashboard-created agents include the End Call system tool by default. If it was removed, re‑add it under System tools. For agents created via API/SDK you must add it explicitly. (elevenlabs.io)
  • If you configure agents via API, don’t use the deprecated prompt.tools. System tools must be listed by name in prompt.built_in_tools. (elevenlabs.io)
  1. Give the LLM clear instructions to call end_call
  • Add a line in the agent’s system prompt (or the tool description) telling it exactly when to end (e.g., on “goodbye,” task completion, or user request). The docs include example prompts. (elevenlabs.io)
  1. Verify the client reaction in your React app
  • When end_call runs, the session ends; handle this via the React SDK’s onDisconnect callback to update UI/cleanup. Also use onMessage/onStatusChange for debugging. (elevenlabs.io)
  1. Validate that end_call was invoked
  • Check Call history to see completed conversations and debug failures. (help.elevenlabs.io)
  • Optionally enable Post‑call webhooks (post_call_transcription or post_call_audio) to receive a payload after the call ends. (elevenlabs.io)
  1. If you need to test termination independently of LLM behavior
  • Open a monitoring session and send the control command { "command_type": "end_call" } to confirm your client properly handles termination. (elevenlabs.io)

Common causes when end_call isn’t triggered

  • The End Call tool is missing/disabled for the agent (re‑enable it). (elevenlabs.io)
  • The agent prompt never instructs the LLM to end. Add explicit end conditions. (elevenlabs.io)
  • You configured tools with the deprecated prompt.tools instead of prompt.built_in_tools for system tools. (elevenlabs.io)

Minimal React check

  • Start the session with startSession({ agentId, connectionType: 'webrtc' | 'websocket' }) and implement onDisconnect to confirm the SDK sees the server‑side termination. (elevenlabs.io)

If you’ve confirmed

low violet
#

in the analysis section i see that agent call correctly the end call tool. in react the ondisconnect inst't trigger properly