https://retellai.com/?utm_source=discord&utm_medium=seo logo
What's the relationship of the main prompt to the ...
# ❓・ai-evy-support
f
@AI Evy What's the relationship of the main prompt to the state prompts in a multi prompt agent
a
Thanks for tagging me @FullThrottleFu. I'll look through relevant sources and get back to you shortly.
### Answer In a multi-prompt agent, you have: 1. *General Prompt (
general_prompt
) *
– This is the main/overarching prompt that applies across the entire agent. [(1) ]() 2. *State Prompts (
state_prompt
) *
– Each state has its own focused prompt with specific instructions for that conversation phase. [(2) ]() , [(1) ]() How they relate: - States help reduce prompt length and tool choices when the call can be broken into distinct stages. - Each state includes a focused prompt specific to that conversation phase, along with state-specific functions and transition logic (edges) . [(2) ]() - If states are not set, the agent only uses the general prompt and general tools (essentially one state) . [(1) ]() Key behavior: - State-specific prompts override the general prompt when active, but they work hand in hand. [(3) ]() - General functions (like
end_call
) are best kept in the main prompt for reuse across states, while state functions are limited to that specific state. [(4) ]() Example structure from the API:
Copy code
json
"general_prompt": "You are ...",
"states": [
  {
    "name": "information_collection",
    "state_prompt": "You will follow the steps below to collect information..."
  }
]
[(1) ]()
​ To learn more, see the sources I considered: [[1] Update Retell LLM](https://docs.retellai.com/api-references/update-retell-llm) [[2] Single/Multi Prompt Agent Overview](https://docs.retellai.com/build/single-multi-prompt/prompt-overview) [[3] Multi-Prompt Agent State Transition - LLM Prompt Mechanics](https://discord.com/channels/1186424376300679209/1395545946066129039) [[4] Discord message from @_superwhale on 2025-01-24](https://discord.com/channels/1186424376300679209/1294891368505937952/1332171997744205925) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
f
Can you give me a use case because I tried to build one that I figured the states would be the different operations of booking calendar appointments like check book cancel and reschedule
@AI Evy Can you give me a use case because I tried to build one that I figured the states would be the different operations of booking calendar appointments like check book cancel and reschedule
a
Thanks for the follow-up, @FullThrottleFu. I'll get back to you soon.
### Answer Your approach of using states for different calendar operations (check, book, cancel, reschedule) is a valid design pattern. Here's a documented use case that illustrates the multi-state structure: Lead Qualification → Appointment Scheduling Example: [(1) ]() - *State 1: Lead Qualification (information_collection) * - Gather customer information - Validate requirements - No appointment booking functions available yet - *State 2: Appointment Scheduling (appointment_booking) * - Only accessible after qualification is complete - Booking functions enabled - Context from qualification available This structure is shown in the API examples: [(2) ]()
Copy code
json
"states": [
  {
    "name": "information_collection",
    "state_prompt": "You will follow the steps below to collect information...",
    "edges": [
      {
        "destination_state_name": "appointment_booking",
        "description": "Transition to book an appointment."
      }
    ]
  },
  {
    "name": "appointment_booking",
    "state_prompt": "You will follow the steps below to book an appointment...",
    "tools": [
      {
        "type": "book_appointment_cal",
        "name": "book_appointment",
        "description": "Book an annual check up.",
        "cal_api_key": "cal_live_xxxxxxxxxxxx",
        "event_type_id": 60444,
        "timezone": "America/Los_Angeles"
      }
    ]
  }
]
For your calendar operations use case, you could structure it similarly: - A greeting state that determines user intent (check, book, cancel, reschedule) - Separate states for each operation with their specific tools Important: Transitions between states use edges, not just prompt instructions. You must define edges with
destination_state_name
and a
description
for when to transition. [(7) ]()
​ To learn more, see the sources I considered: [[1] Single/Multi Prompt Agent Overview](https://docs.retellai.com/build/single-multi-prompt/prompt-overview) [[2] Update Retell LLM](https://docs.retellai.com/api-references/update-retell-llm) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.