Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

agent-takeover

БесплатноБез исполняемых скриптовНе проверен

How to perform a live agent takeover of the Clawfinger voice gateway — dial, inject greetings, handle turns, release, and observe handback. Covers timing…

modbenderот modbender★ 21 звезда на GitHub

Об этом скилле

Agent Takeover — Full Lifecycle Guide

How an external agent (OpenClaw plugin, custom script, or any WebSocket client) takes control of a live phone call, handles conversation turns directly, and hands back to the local LLM.

Architecture Overview

Caller  <-->  Phone App  <-->  Gateway /api/turn  <-->  Local LLM
                                      |
                                      +-- (takeover) --> Agent WS

Normal flow: phone sends audio to /api/turn, gateway runs ASR → LLM → TTS, returns audio.

Takeover flow: after takeover, gateway sends turn.request to the agent WebSocket instead of calling the local LLM. The agent replies with text, gateway runs TTS, returns audio to phone.

Endpoints Used

WebSocket (primary — full bidirectional control)

WS /api/agent/ws — No authentication required on the WebSocket itself. Connects, receives all bus events, and sends commands.

Send (agent → gateway) Fields Description
dial number Dial outbound call via ADB
inject text, session_id Queue TTS message for next turn poll
takeover session_id Take over LLM for this session
release session_id Hand back to local LLM
hangup session_id (optional) Force hang up call + end session
get_call_state session_id Query conversation history and state
end_session session_id Mark session ended without phone hangup
inject_context session_id, context Push knowledge into LLM context
clear_context session_id Remove injected knowledge
ping — Heartbeat
Receive (gateway → agent) Fields Description
dial.ack ok, detail Dial result
takeover.ack ok, session_id Takeover confirmed
release.ack ok, session_id Release confirmed
hangup.ack ok, detail, session_id Hangup result
turn.request session_id, transcript, request_id Takeover only — caller spoke, agent must reply
turn.started session_id Turn processing began
turn.transcript transcript ASR result
turn.reply reply LLM/agent reply text
turn.complete metrics, transcript, reply, model Turn finished
session.ended session_id Session ended (stale sweep, hangup, or explicit end)

REST (alternative — no persistent connection needed)

Method Path Purpose
POST /api/call/dial {"number": "+49..."} — dial via ADB
POST /api/call/hangup {"session_id": "..."} — force hangup
POST /api/call/inject {"text": "...", "session_id": "..."} — inject TTS
GET /api/agent/sessions List active session IDs
GET /api/agent/call/{sid} Full call state (history, instructions, takeover)
POST /api/agent/context/{sid} {"context": "..."} — inject knowledge

REST cannot do takeover. Takeover requires the WebSocket for real-time turn.request / reply exchange. REST is fine for dial, inject, hangup, and observation.

Takeover Turn Protocol

During takeover, the gateway replaces the local LLM with the agent for response generation:

Phone → /api/turn (audio) → Gateway ASR → transcript
                                              ↓
                           Gateway sends to Agent WS:
                           {"type": "turn.request",
                            "session_id": "abc123",
                            "transcript": "what caller said",
                            "request_id": "unique-id"}
                                              ↓
                           Agent replies on same WS:
                           {"reply": "agent's response",
                            "request_id": "unique-id"}
                                              ↓
                           Gateway TTS → audio → Phone

Critical: request_id correlation

The agent must echo back the request_id from the turn.request. Without it, the gateway cannot match the reply to the pending turn and the request times out.

// Gateway sends:
{"type": "turn.request", "session_id": "abc", "transcript": "hello", "request_id": "a1b2c3"}

// Agent must reply:
{"reply": "Hi there!", "request_id": "a1b2c3"}

No type field needed in the reply — just reply + request_id.

Timeout and fallback

If the agent doesn't reply within the timeout (default 60s, configurable via agent_takeover_timeout in config), the gateway falls back to the local LLM for that single turn. The takeover remains active — the next turn will try the agent again.

Timing Model

Understanding timing is critical for a smooth takeover experience.

Phone polling cadence

The phone app polls /api/turn i

Полный SKILL.md на GitHub

Установить agent-takeover в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл agent-takeover?

How to perform a live agent takeover of the Clawfinger voice gateway — dial, inject greetings, handle turns, release, and observe handback. Covers timing, endpoints, the WebSocket protocol, and includes a human-guided test case.

Как установить скилл agent-takeover?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл agent-takeover запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить agent-takeover с