POST
/
api
/
v1
/
agents
import os
import syllable_sdk
from syllable_sdk import SyllableSDK


with SyllableSDK(
    api_key_header=os.getenv("SYLLABLESDK_API_KEY_HEADER", ""),
) as ss_client:

    res = ss_client.agents.create(request={
        "name": "Weather agent",
        "description": "Agent for answering questions about weather.",
        "label": "Information",
        "type": "ca_v1",
        "prompt_id": 1,
        "custom_message_id": 1,
        "language_group_id": 1,
        "timezone": "America/New_York",
        "prompt_tool_defaults": [
            {
                "tool_name": "get_weather",
                "default_values": [
                    {
                        "field_name": "temperature_unit",
                        "default_value": "fahrenheit",
                    },
                ],
            },
        ],
        "variables": {
            "vars.location_name": "Main Street Pizza",
        },
        "tool_headers": {
            "Authorization": "Basic sometoken",
        },
        "stt_provider": syllable_sdk.AgentSttProvider.GOOGLE_STT_V2,
        "wait_sound": syllable_sdk.AgentWaitSound.KEYBOARD_1,
    })

    # Handle response
    print(res)
{
  "name": "Weather agent",
  "description": "Agent for answering questions about weather.",
  "label": "Information",
  "type": "ca_v1",
  "prompt_id": 1,
  "custom_message_id": 1,
  "language_group_id": 1,
  "timezone": "America/New_York",
  "prompt_tool_defaults": {
    "default_values": [
      {
        "default_value": "fahrenheit",
        "field_name": "temperature_unit"
      }
    ],
    "tool_name": "get_weather"
  },
  "languages": [
    "en-US",
    "es-US"
  ],
  "variables": {
    "vars.location_name": "Main Street Pizza"
  },
  "tool_headers": {
    "Authorization": "Basic sometoken"
  },
  "agent_initiated": false,
  "stt_provider": "Google STT V1",
  "wait_sound": "No Sound",
  "id": 1,
  "updated_at": "2024-01-01T00:00:00Z",
  "last_updated_by": "user@email.com",
  "prompt": {
    "name": "Weather Agent Prompt",
    "description": "Prompt for a weather agent.",
    "type": "prompt_v1",
    "context": "You are a weather agent. Answer the user's questions about weather and nothing else.",
    "tools": "hangup",
    "llm_config": {
      "model": "gpt-4o",
      "provider": "openai",
      "version": "2024-08-06"
    },
    "id": 1,
    "edit_comments": "Updated prompt text to include requirement to not answer questions that aren't about weather.",
    "last_updated": "2024-01-01T12:00:00Z",
    "last_updated_by": "user@email.com",
    "agent_count": 5,
    "tools_full": [
      {
        "name": "Weather Fetcher",
        "definition": {
          "endpoint": {
            "argument_location": "query",
            "method": "get",
            "url": "https://api.open-meteo.com/v1/forecast"
          },
          "tool": {
            "function": {
              "description": "Get the weather for a city",
              "name": "get_weather",
              "parameters": {
                "properties": {
                  "latitude": {
                    "description": "Latitude of the city",
                    "type": "number"
                  },
                  "longitude": {
                    "description": "Longitude of the city",
                    "type": "number"
                  },
                  "current": {
                    "default": "temperature_2m,relative_humidity_2m,precipitation,rain,showers",
                    "description": "Information to retrieve from the open-meteo API, comma-separated",
                    "type": "string"
                  }
                },
                "required": [
                  "latitude",
                  "longitude",
                  "current"
                ],
                "type": "object"
              }
            },
            "type": "function"
          },
          "type": "endpoint"
        },
        "service_id": 1,
        "id": 1,
        "last_updated_comments": "Updated to use new API endpoint",
        "service_name": "<string>",
        "prompts_info": [
          {
            "id": 1,
            "name": "Test Prompt"
          }
        ],
        "agents_info": [
          {
            "id": 1,
            "name": "Test Agent"
          }
        ],
        "last_updated": "2023-11-07T05:31:56Z",
        "last_updated_by": "user@email.com"
      }
    ]
  },
  "custom_message": {
    "name": "Customer service greeting",
    "text": "Hello and thank you for calling customer service. How can I help you today?",
    "label": "Customer service",
    "rules": [
      {
        "date": "2025-01-01",
        "description": "Closed on New Year's Day",
        "invert": false,
        "text": "Hello, thank you for calling. Sorry, we're closed today.",
        "time_range_end": "17:00",
        "time_range_start": "09:00"
      },
      {
        "days_of_week": [
          "sa",
          "su"
        ],
        "description": "Closed on weekends",
        "invert": false,
        "text": "Hello, thank you for calling. Sorry, we're closed on weekends.",
        "time_range_end": "17:00",
        "time_range_start": "09:00"
      }
    ],
    "id": 1,
    "updated_at": "2024-01-01T00:00:00Z",
    "agent_count": 1,
    "last_updated_by": "user@email.com",
    "type": "greeting"
  },
  "channel_targets": [
    {
      "agent_id": 1,
      "channel_id": 1,
      "target": "+19995551234",
      "target_mode": "voice",
      "fallback_target": "+19995551235",
      "is_test": true,
      "id": 1,
      "channel_name": "+19995551234",
      "updated_at": "2024-01-01T00:00:00Z",
      "last_updated_by": "user@email.com",
      "agent": {}
    }
  ],
  "tools": [
    {
      "name": "Weather Fetcher",
      "definition": {
        "endpoint": {
          "argument_location": "query",
          "method": "get",
          "url": "https://api.open-meteo.com/v1/forecast"
        },
        "tool": {
          "function": {
            "description": "Get the weather for a city",
            "name": "get_weather",
            "parameters": {
              "properties": {
                "latitude": {
                  "description": "Latitude of the city",
                  "type": "number"
                },
                "longitude": {
                  "description": "Longitude of the city",
                  "type": "number"
                },
                "current": {
                  "default": "temperature_2m,relative_humidity_2m,precipitation,rain,showers",
                  "description": "Information to retrieve from the open-meteo API, comma-separated",
                  "type": "string"
                }
              },
              "required": [
                "latitude",
                "longitude",
                "current"
              ],
              "type": "object"
            }
          },
          "type": "function"
        },
        "type": "endpoint"
      },
      "service_id": 1,
      "id": 1,
      "last_updated_comments": "Updated to use new API endpoint",
      "service_name": "<string>",
      "prompts_info": [
        {
          "id": 1,
          "name": "Test Prompt"
        }
      ],
      "agents_info": [
        {
          "id": 1,
          "name": "Test Agent"
        }
      ],
      "last_updated": "2023-11-07T05:31:56Z",
      "last_updated_by": "user@email.com"
    }
  ],
  "language_group": {
    "name": "Call Center 1 Languages",
    "description": "Languages spoken by operators at Call Center 1",
    "language_configs": [
      {
        "dtmf_code": 1,
        "language_code": "en-US",
        "voice_display_name": "Alloy",
        "voice_provider": "OpenAI"
      },
      {
        "dtmf_code": 2,
        "language_code": "es-US",
        "voice_display_name": "Alejandro",
        "voice_provider": "Google"
      }
    ],
    "skip_current_language_in_message": true,
    "id": 1,
    "edit_comments": "Added Spanish support.",
    "agents_info": [
      {
        "id": 1,
        "name": "Test Agent"
      }
    ],
    "updated_at": "2024-01-01T00:00:00Z",
    "last_updated_by": "user@mail.com"
  }
}

Authorizations

Syllable-API-Key
string
header
required

Body

application/json

Request model to create an agent.

Response

200
application/json

Successful Response

Response model for agent operations. When a user interacts with the Syllable system, they do so by communicating with an agent. An agent is linked to a prompt, a custom message, and one or more channel targets to define its behavior and capabilities. For more information, see Console docs.