Configuring your number
Setting up our agent to function as a receptionist
Now that we have a number set up on Vocode, our agent is ready to start accepting calls. Vocode Agents have several different parameters we can use to control its behavior. We’re going to be setting up our receptionist by modifying:
- Voice -> this is the voice of our agent
- Prompt -> the prompt is the instruction we give our agent that controls its behavior
- Actions -> actions are things that the agent can do like end the conversation or make an API request to an external service (like a calendar booking software)
Setting up our receptionist
Voice
First, let’s create a new voice via ElevenLabs and grab the voice ID.
voice = vocode_client.voices.create_voice(
request={
"type": "voice_eleven_labs",
"voice_id": "06oPEcZqPWhZ2IeTcOJc",
"stability": ".2",
"similarity_boost": ".75",
"model_id": "eleven_turbo_v2",
"optimize_streaming_latency": "4",
}
)
voice_id = voice.id
For other voice options curated by Vocode, check out our page on Voices. Voice clones are also available on demand for enterprise accounts.
Prompt
The prompt is how our agent will know what instructions to follow on the call. We’re going to set up a prompt suitable for a receptionist agent and create a prompt object in the API:
PROMPT = """
sample prompt
"""
prompt = vocode_client.prompts.create_prompt(request={"content": PROMPT})
prompt_id = prompt.id
For more guidance on how prompts work check out our guide on Prompt Objects and Prompt Engineering.
Actions
Finally, for our receptionist to be complete, we’re going to want to give it the ability to actually do two things:
- End the conversation
- Make an API call to our calendar software to book calendar appointments.
Let’s set up both of these actions using the API:
# This action ends the conversation
end_conversation_action = vocode_client.actions.create_action(
request=ActionParamsRequest(type="action_end_conversation", config={})
)
# This action makes an API call to our calendar endpoint
calendar_action = vocode_client.actions.create_action(
request={
"type": "action_external",
"config": {
"name": "Meeting_Booking_Assistant",
"description": ("Book a meeting for a 30 minute or 1 hour call."),
"url": "http://example.com/booking",
"speak_on_send": True,
"speak_on_receive": True,
"input_schema": {
"type": "object",
"properties": {
"length": {
"type": "string",
"enum": ["30m", "1hr"],
},
"time": {
"type": "string",
"pattern": "^\d{2}:\d0[ap]m$",
},
},
},
},
},
)
For more information on how to set up actions, check out our Actions guide and our new beta feature External Actions which we are using here to make the calendar API call.
Updating our agent
Now that we’ve created our voice, prompt, and actions, we can run a query to update our agent as follows. We’ll
also add an initial_message
to our agent to greet people who call in.
We’ll have to first grab the agent_id
in order to make the agent/update
request. Here’s how we can grab it from our
phone number:
number = vocode_client.numbers.get(phone_number="1123456789")
agent_id = number.agent_id
print(agent_id)
Which should output a UUID for our agent.
ad1d802e-12ab-41c7-8726-14e119d6c92c
And now we can use the agent_id
in our update request as follows:
INITIAL_MESSAGE = "Hi, this is a Vocode scheduling agent, how can I help you?"
update_response = vocode_client.agents.update_agent(
id=agent_id,
request=AgentUpdateParams(
initial_message=INITIAL_MESSAGE,
prompt=prompt_id,
voice=voice_id,
actions=[end_conversation_action_id, external_action_id],
),
)
Now our agent is ready to be a receptionist! Check it out by giving it a call.