bland-hair-8538
11/05/2025, 9:02 PMtall-airline-16756
11/05/2025, 9:02 PMtall-airline-16756
11/05/2025, 9:03 PMNone (no content). This ends the tool without prompting the LLM for a reply, so no TTS is attempted after the transfer. See tool behavior.
• If you’re handing off to a different agent (e.g., a transfer/cleanup agent), return that agent instance from the tool to transfer control explicitly. See workflows/hand-offs.
• For cold transfers that end the caller’s LiveKit session, performing the transfer will naturally stop the agent once complete. See transfers.
• If the tool performs irreversible actions, call run_ctx.disallow_interruptions() at the start to prevent mid-tool interruptions. See tool behavior.
Want a quick code snippet (Python/Node) showing disallow_interruptions(), the transfer call, and returning None?
Sources: Tool definition and use | LiveKit docs | Workflows | LiveKit Docs | Transferring calls | LiveKit Docs | Agents telephony integration | LiveKit Docsbland-hair-8538
11/05/2025, 9:04 PMtall-airline-16756
11/05/2025, 9:10 PMfrom livekit.agents import function_tool, RunContext
from livekit.api import TransferSIPParticipantRequest
@function_tool(name="transfer_call", description="Transfer the current caller to a phone number or SIP URI")
async def transfer_call(run_ctx: RunContext, transfer_to: str) -> None:
# Prevent mid-tool interruptions (irreversible external action)
run_ctx.disallow_interruptions()
# Build and perform the SIP transfer
req = TransferSIPParticipantRequest(
participant_identity=run_ctx.session.participant_identity,
room_name=run_ctx.session.room_name,
transfer_to=transfer_to, # e.g., "tel:+15105550100" or "sip:+15105550100@sip.example.com"
)
await run_ctx.session.ctx.api.sip.transfer_sip_participant(req)
# Complete silently so the LLM won't produce a follow-up reply
return None
References: Tool behavior, SIP APIs
Want this adapted to your transfer method (e.g., cold vs. warm transfer or specific SIP provider)?
Sources: Tool definition and use | LiveKit docs | SIP APIs | LiveKit Docs