Skip to content

Add onAgentToolRequest callback for webhook tool call notifications #20

@AdnanKhan45

Description

@AdnanKhan45

The ElevenLabs WebSocket protocol sends agent_tool_request events when the agent initiates a webhook/server tool call. The Android SDK already handles this event (fixed in elevenlabs-android PR #34, released in v0.7.1).

The Flutter SDK does not parse agent_tool_request events. The onDebug callback does not emit them either, suggesting they are dropped during WebSocket message parsing.

Impact: When the agent calls a webhook tool (e.g., fetching data from a backend), the Flutter client cannot distinguish between "agent is waiting for user to speak" and "agent is executing a tool call." Both appear as ConversationMode.listening with silence. This makes it impossible to show a loading/thinking indicator during tool execution.

Expected: Add onAgentToolRequest callback to ConversationCallbacks, matching the Android SDK's behavior:

ConversationCallbacks(
  onAgentToolRequest: ({required String toolName, required String toolCallId}) {
    // Tool call started — show thinking indicator
  },
  onAgentToolResponse: (AgentToolResponse response) {
    // Tool call completed — hide thinking indicator (already exists)
  },
)

Environment:

Package: elevenlabs_agents (Flutter)
Tested on iOS
The agent_tool_request event is confirmed to be part of the WebSocket protocol (handled by Android SDK since v0.7.1)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions