Our last step is to create an agent. You can use the sample code below to do this.

from syllable_sdk import AgentCreate, AgentSttProvider, AgentWaitSound, SyllableSDK

sdk = SyllableSDK(
api_key_header='your_key_here'
)

agent = sdk.agents.create(request=AgentCreate(
# The name of the agent is used to reference it elsewhere in the system, so
# you should pick something easily identifiable.
name='Weather Agent',
# The description is displayed for extra context on the agent list screen in
# the Syllable Console.
description='An agent that can answer questions about the weather',
# The type of the agent. Should just be hardcoded to `ca_v1` for now.
type='ca_v1',
# If you lost the ID of the prompt you created earlier, you can use the
# prompts.list function to find it.
prompt_id=your_prompt_id_here,
# If you lost the ID of the message you created earlier, you can use the
# custom_messages.list function to find it.
custom_message_id=your_message_id_here,
timezone='America/Los_Angeles',
sttProvider=AgentSttProvider.GOOGLE_STT_V2,
wait_sound=AgentWaitSound.KEYBOARD_1,
# You can use the tool_headers field to set headers that should be used for
# the agent's tool calls. You can skip this for the tutorial.
tool_headers=None,
# You can use the variables field to set agent-level session variables (see
# https://docs.syllable.ai/workspaces/Agents#session-configuration for how to
# do this in Console). You can skip this for the tutorial.
variables={}
))

print(agent)

The best way to test your new agent is in the Syllable Console. Click “Agents” in the left navbar, find and click on your agent, and then use the test conversation window as described here.

This concludes the tutorial! If you want to explore more of Syllable’s functionality with your new agent, you could try:

  • Creating a voice channel target for your agent so you can call a phone number to speak to it
  • Updating your message to use time-based rules to display different greetings in the morning and afternoon
  • Creating a language group, linking it to your agent, and adding the corresponding DTMF menu to the message to enable it to use different languages and voices

📚 Documentation References