Skip to navigation
AgentsPrefabs

PersonalAssistantAgent

View as MarkdownOpen in Claude

PersonalAssistantAgent answers the phone for one person, built on ServiceAgent. It asks who is calling and what it’s about, then rings the person. The caller hears ringing. When the person answers, they hear a whisper (“Bo is calling about the contract. Press 1 to take the call.”) and press the accept key to take it, and the calls are joined. When the joined call ends, the caller’s call ends too.

If the person doesn’t answer or doesn’t take the call, the assistant carries on with the caller and offers a message or a time on the calendar, from messages and appointments. In a chat, nobody is put through.

from signalwire.prefabs import PersonalAssistantAgent

Parameters

name
strDefaults to assistant

The agent’s name.

role
strRequired

Keyword-only, as are all the parameters below. Who the agent is and how it sounds.

owner
strRequired

The person’s name, as the assistant says it.

reach
strRequired

Where the person’s calls go: a phone number in E.164 form, or a SIP address.

available
Callable[[CallContext], bool] | NoneDefaults to None

available(call) returns whether the person is taking calls now. May be async. When it returns false, the call isn’t put through. None means always.

messages
Messages | NoneDefaults to None

A Messages pack, to take a message when the person doesn’t take the call.

appointments
Appointments | NoneDefaults to None

An Appointments pack, for the person’s calendar.

knowledge
InfoBotKnowledge | NoneDefaults to None

An InfoBotKnowledge to answer questions from.

caller_id
str | NoneDefaults to None

The number the put-through call comes from. None shows the caller’s own number to the person.

ring_seconds
intDefaults to 20

How long to ring the person.

answer_seconds
intDefaults to 15

How long the person has, once they answer, to press the accept key.

whisper_voice
str | NoneDefaults to None

The voice of the whisper. The platform’s default when None.

whisper_language
str | NoneDefaults to None

The whisper’s language code, such as "en-US". The platform’s default when None.

accept_key
strDefaults to 1

The keypad key the person presses to take the call: one of 0-9, *, or #. Anything else raises ValueError. Any other key, or none, ends the person’s leg.

tool
strDefaults to put_through

The put-through tool’s name.

assistant_wording
Mapping[str, str] | NoneDefaults to None

Replacements for the assistant’s own words, keyed like PersonalAssistantAgent.WORDING. See wording.

**kwargs
Any

ServiceAgent’s arguments: every Operations keyword argument and every AgentBase argument.

Example

from signalwire.operations import Messages
from signalwire.prefabs import PersonalAssistantAgent
assistant = PersonalAssistantAgent(
role="You answer Ann Lee's phone. You are friendly and brief.",
owner="Ann",
reach="+15550100002",
messages=Messages(save=lambda call, message: print(message)),
)
if __name__ == "__main__":
assistant.run()