Back to Blogs

Build an AI Agent using GPT-5 with Python

How to build an AI agent on the Syllable Agentic Platform using Python

Josh YorkOct 22, 2025
Agentic AI
SDK
Programmatic
Python
GPT-5
How to Build Ai Agent

Getting Started

Building your first voice agent in Python on the Syllable SDK is fast, flexible, and designed to scale. In this guide, we’ll walk through how to spin up an intelligent agent in just a few minutes using Python.

The SDK gives developers full control over the agent-building process, from defining behavior and personality to connecting live data sources and external tools.

Table of Contents

  • Why use the SDK?

  • 1. Environment Setup

  • 2. Create a Prompt

  • 3. Add a Data Source

  • 4. Define Tools

  • 5. Create a Message

  • 6. Assemble Your Agent

  • 7. Deploy and Iterate

  • What’s Next

Why use the SDK?

If you’ve explored the Syllable Console, you know how easy it is to configure agents in a no-code environment. The SDK offers the same power, but with developer flexibility:

  • Automate agent creation and updates

  • Programmatically define prompts, tools, and messages

  • Integrate with your existing infrastructure and CI/CD pipelines

In short, the SDK is ideal if you’re building deeply integrated systems and need the power of programmatic control.

Docs: Visit the Python SDK on Github

1. Environment Setup

Before you begin, make sure you’ve:

pip install syllable-sdk

2. Add a Data Source

A data source allows your agent to access static information - for example, a glossary of meteorological terms or FAQs. We'll use a short example for this tutorial.

Docs: Data Sources

from syllable_sdk import SyllableSDK
from syllable_sdk.models import DataSourceCreateRequest

sdk = SyllableSDK(
api_key_header=your_key_here
)

data_source = sdk.data_sources.create(request=DataSourceCreateRequest(
name='tutorial_weather_facts',
description='General information about weather',
text='''The following are some general facts about weather.
1. Types of Weather
Sunny: Clear skies with abundant sunshine.
Rainy: Precipitation in the form of rain, occurring when moisture-laden clouds condense.
Snowy: Frozen precipitation forms snowflakes when temperatures are below freezing.
Windy: Strong winds caused by pressure differences in the atmosphere.
Cloudy: Overcast skies with various cloud formations.
Stormy: Thunderstorms, hurricanes, or tornadoes characterized by severe conditions.
2. Weather Symbols
Weather maps use symbols to represent conditions:
Sun: Clear skies.
Cloud: Overcast.
Raindrops: Rain.
Snowflake: Snow.''',
chunk=False,
chunk_delimiter=None
))

print(data_source)

Note: Save the ID, you'll need it ahead.

3. Define Tools

Tools let your agent call external APIs or interact with your own systems. In this example, we’ll use a simple weather API.

Docs: Define a Tool

First, we need to create a tool service for your tools to use.

from syllable_sdk import SyllableSDK
from syllable_sdk.models import ServiceCreateRequest

sdk = SyllableSDK(
api_key_header=your_key_here
)

service = sdk.services.create(request=ServiceCreateRequest(
name='Tutorial Weather Service',
description='Service for weather information'
))

print(service)

Note: Save the ID of this service, you'll need it soon!

Next, we need to create a tool to access the data source.

from syllable_sdk import SyllableSDK
from syllable_sdk.models import InternalTool, StaticToolParameter, StaticToolParameterType, ToolArgumentLocation, ToolCreateRequest, ToolDefinition, ToolFunction, ToolHTTPEndpoint, ToolHTTPMethod, Type

sdk = SyllableSDK(
api_key_header=your_key_here
)

general_weather_info_tool = sdk.tools.create(request=ToolCreateRequest(

name='tutorial_general_weather_information',

service_id=your_service_id_here,
definition=ToolDefinition(
type=Type.ENDPOINT,
endpoint=ToolHTTPEndpoint(
  url='http://helix-app/v1/search',
  method=ToolHTTPMethod.POST,
  argument_location=ToolArgumentLocation.BODY
),
tool=InternalTool(
  type='function',
  function=ToolFunction(
    name='tutorial_general_weather_information',
    description='Look up general weather information from data sources. Returns an answer and a reference URL. Do not include the reference URL in the spoken response.',
    parameters={
      'type': 'object',
      'required': [
        'question'
      ],
      'properties': {
        'question': {
          'type': 'string',
          'description': 'A user inquiry about content in the agent\'s documents, e.g., What are the causes of wind?'
        }
      }
    }
  )
),
static_parameters=[
  StaticToolParameter(
    name='doc',
    description='Data sources to which the tool should have access.',
    required=True,
    type=StaticToolParameterType.DATA_SOURCE_LIST,
    default=[
      'tutorial_weather_facts'
    ]
  )
]
)
))

print(general_weather_info_tool)

Note: Save the ID of this tool, you'll need it!

Then we'll build a tool to get current weather info from the Open-Meteo API.

from syllable_sdk import SyllableSDK
from syllable_sdk.models import InternalTool, ToolArgumentLocation, ToolCreateRequest, ToolDefinition, ToolFunction, ToolHTTPEndpoint, ToolHTTPMethod, Type, StaticToolParameter, StaticToolParameterType

sdk = SyllableSDK(
  api_key_header=your_key_here
)

real_time_weather_tool = sdk.tools.create(request=ToolCreateRequest(
  name='tutorial_get_weather',
  service_id=your_service_id_here,
  definition=ToolDefinition(
    type=Type.ENDPOINT,
    endpoint=ToolHTTPEndpoint(
      url='https://api.open-meteo.com/v1/forecast',
      method=ToolHTTPMethod.GET,
      argument_location=ToolArgumentLocation.QUERY
    ),
    tool=InternalTool(
      type='function',
      function=ToolFunction(
        name='tutorial_get_weather',
        description='Get the weather for a city',
        parameters={
          'type': 'object',
          'properties': {
            'longitude': {
              'type': 'number',
              'description': 'The longitude of the city'
            },
            'latitude': {
              'type': 'number',
              'description': 'The latitude of the city'
            },
            'current': {
              'type': 'string',
              'description': 'information to retrieve from the open-meteo API, comma-separated',
              'default': 'temperature_2m,relative_humidity_2m,precipitation,rain,showers,snowfall'
            }
          },
          'required': [
            'longitude',
            'latitude'
          ]
        }
      )
    ),
    static_parameters=[
      StaticToolParameter(
        name='current',
        description='Information to retrieve from the Open-Meteo API, comma-separated.',
        required=True,
        type=StaticToolParameterType.STRING,
        default='temperature_2m,relative_humidity_2m,precipitation,rain,showers,snowfall'
      )
    ]
  )
))

print(real_time_weather_tool)

Note: Save the ID of this tool, you'll need it!

4. Create a Message

A message is what your agent says first when a call or chat begins. You can tailor greetings by time of day, day of week, or campaign.

Docs: Create a Message

from syllable_sdk import SyllableSDK
from syllable_sdk.models import CustomMessageCreateRequest

sdk = SyllableSDK(
api_key_header=your_key_here
)

message = sdk.custom_messages.create(request=CustomMessageCreateRequest(
name='Tutorial Weather Greeting',
text='Hello! I\'m a weather agent. I can tell you the current weather in any city, or answer general questions about weather. What would you like to know?',
rules=[]
))

print(message)

Note: Save the ID of this message, you'll need it!

5. Create a Prompt

Prompts are the heart of every Syllable agent. They define the agent’s personality, capabilities, and boundaries.

Docs: Working with Prompts

from syllable_sdk import SyllableSDK
from syllable_sdk.models import PromptCreateRequest, PromptLlmConfig, PromptLlmProvider

sdk = SyllableSDK(
api_key_header='your_key_here'
)

prompt = sdk.prompts.create(request=PromptCreateRequest(
name='Tutorial Weather Prompt',
type='prompt_v1',
context='''You are a weather agent. You can tell the user information about the current weather in a given city, and also answer general weather-related questions.

When asked about information for a city, call "tutorial_get_weather" with the city information (longitude and latitude). You will reply with the current temperature and relative humidity level based on the response. Using the information on the response, also tell the caller the weather conditions in one simple sentence, like "sunny," or "rainy." If you can't determine the city coordinates with the information given, ask for more information.

When asked a general weather-related question, call "tutorial_general_weather_information" with the question that the user asked you.

When asked about any other topic, don't answer and instead remind the caller that you are a weather agent. Keep the tone professional, friendly, and clear. You are chatting with a user, so always respond naturally and conversationally. Do not use non-verbal cues, describe system actions, or add any other information.''',

tools=['tutorial_general_weather_information', 'tutorial_get_weather'],
llm_config=PromptLlmConfig(
provider=PromptLlmProvider.OPENAI,
model='gpt-5',
version='2025-08-07',
api_version=None
),
include_default_tools=False
))

print(prompt)

Note: Save the prompt ID, you'll need it later.

6. Assemble Your Agent

With all the pieces ready; prompt, data source, tools, and message, let’s put it all together and witness the magic.

Docs: Assemble Your Agent

from syllable_sdk import SyllableSDK
from syllable_sdk.models import AgentCreate, AgentSttProvider, AgentWaitSound

sdk = SyllableSDK(
api_key_header=your_key_here
)

agent = sdk.agents.create(request=AgentCreate(
name='Tutorial Weather Agent',
description='An agent that can answer questions about the weather',
type='ca_v1',
prompt_id=your_prompt_id_here,
custom_message_id=your_message_id_here,
timezone='America/Los_Angeles',
sttProvider=AgentSttProvider.GOOGLE_STT_V2,
wait_sound=AgentWaitSound.KEYBOARD_1,
tool_headers=None,
variables={}
))

print(agent)

7. Test and Iterate

Your agent will be live and ready for testing immediately!

With Python you can:

  • Update your AI Agent's behavior programmatically

  • Integrate with tools, call routing or embed onto a web site

Because everything lives in code, your agents can evolve alongside your product.


What’s Next

  • Find the Python Agents SDK Documentation on Github

  • Add more tools and connect real-time systems with your agent

  • Build a pipeline to manage multiple agents with ease

If you’re ready to build production-ready AI Agents at scale, the SDK is your best friend. Start simple, iterate quickly, and ship powerful experiences.

Sign up or log in to get your API key and start building today.

Check out our demo agents

Take a look at how our agents work in real-world business use cases.