> ## Documentation Index
> Fetch the complete documentation index at: https://docs.retellai.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Debug wrong response

> How to fix when your AI agent gives incorrect responses

<Steps>
  <Step title="Check Model Capability">
    If your agent isn't following instructions correctly, especially with longer or complex prompts:

    1. Check if you're using a lightweight model (e.g., 4.1-mini)
    2. Switch to a more capable model like `gpt-4.1`

    <Frame>
      <img height="700" src="https://mintcdn.com/retellai/M9QYKZE4hbt00HfL/images/llm-selection.png?fit=max&auto=format&n=M9QYKZE4hbt00HfL&q=85&s=54e830e0c3de4e0977757c3e2d3c3db4" data-path="images/llm-selection.png" />
    </Frame>
  </Step>

  <Step title="Review Prompt Structure">
    If the issue persists:

    1. Check if your prompt structure is too complex
    2. Follow [prompt engineering guide](https://www.promptingguide.ai/)
    3. Break down complex tasks into clear, sequential steps
    4. Add explicit transition conditions between different steps
  </Step>
</Steps>
