Module livekit.agents.beta.tools
Sub-modules
livekit.agents.beta.tools.end_calllivekit.agents.beta.tools.send_dtmf
Functions
async def send_dtmf_events(events: list[DtmfEvent]) ‑> str-
Expand source code
@function_tool async def send_dtmf_events( events: list[DtmfEvent], ) -> str: """ Send a list of DTMF events to the telephony provider. Call when: - User wants to send DTMF events """ job_ctx = get_job_context() for event in events: try: code = dtmf_event_to_code(event) await job_ctx.room.local_participant.publish_dtmf(code=code, digit=event.value) await asyncio.sleep(DEFAULT_DTMF_PUBLISH_DELAY) except Exception as e: return f"Failed to send DTMF event: {event.value}. Error: {str(e)}" return f"Successfully sent DTMF events: {', '.join(events)}"Send a list of DTMF events to the telephony provider.
Call when: - User wants to send DTMF events
Classes
class EndCallTool-
Expand source code
class EndCallTool(Toolset): @function_tool(name="end_call") async def _end_call(self, ctx: RunContext) -> None: """ Ends the current call and disconnects immediately. Call when: - The user clearly indicates they are done (e.g., “that’s all, bye”). - The agent determines the conversation is complete and should end. Do not call when: - The user asks to pause, hold, or transfer. - Intent is unclear. This is the final action the agent can take. Once called, no further interaction is possible with the user. """ logger.debug("end_call tool called") ctx.session.shutdown() @property def tools(self) -> list[Tool]: return [self._end_call]Helper class that provides a standard way to create an ABC using inheritance.
Ancestors
- livekit.agents.llm.tool_context.Toolset
- abc.ABC
Instance variables
prop tools : list[livekit.agents.llm.tool_context.Tool]-
Expand source code
@property def tools(self) -> list[Tool]: return [self._end_call]Tools exposed by the toolset.