### Answer
The "Invalid message role received: state_transition" error is a known issue that affects multi-prompt agents during state transitions [(1) ](
) [(2) ](
) . Based on community reports, this error typically occurs when the agent transitions between states and you try to send a message afterward [(2) ](
) .
Here are the troubleshooting steps that have helped other users:
Try switching LLM models:
- If you're using GPT-4.1, try switching to GPT-4o or GPT-4o mini [(1) ](
) [(2) ](
)
- Users have reported that changing the LLM model can resolve this issue [(1) ](
)
Test in different environments:
- The error may only occur in test chat but work fine during actual phone calls [(2) ](
)
- Try testing your agent with a voice call to see if the issue persists
Check your state transition logic:
When building multi-prompt agents, ensure your state transitions are properly defined [(3) ](
) :
7. Ask if user is interested in an in person tour.
- if yes, transition to schedule_tour.
- if no or hesitant, call function end_call to hang up politely and say will reach out if any other interesting properties pop up.