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

# Escalate a difficult request

> Decide when a low-cost path should hand a task to a stronger model or a person.

Use this near the end of your inexpensive path, when you have the request and evidence about what that path can handle.

[Open this recipe in the playground](https://console.sqwish.ai/#playground?recipe=escalate), or set `D1_API_KEY` as in the [quickstart](/quickstart) and run the same request:

```bash theme={null}
curl --fail-with-body --silent --show-error https://console.sqwish.ai/v1/decide \
  -H "Authorization: Bearer $D1_API_KEY" \
  -H "Content-Type: application/json" \
  --data-binary @- <<'JSON'
{
  "model": "sqwish-d1-core",
  "context": {
    "conversation": [
      {
        "from": "customer",
        "text": "I was charged £1,200 instead of £120. I need this fixed today or I'll dispute it with my bank."
      },
      {
        "from": "bot",
        "text": "Sorry about that. I can see a charge of £1,200 on 3 October."
      }
    ],
    "bot_next_reply": "Refunds usually take 5 to 7 working days. Is there anything else I can help with?"
  },
  "decisions": [
    {
      "id": "route",
      "kind": "single",
      "question": "Can the bot safely finish this conversation with its next reply?",
      "outcomes": {
        "handle": "The reply resolves the issue and nothing risky is left.",
        "escalate": "A person or a stronger model should take over."
      },
      "costs": {
        "keep": {
          "handle": 0,
          "escalate": 10
        },
        "hand_off": {
          "handle": 1,
          "escalate": 0
        }
      }
    }
  ]
}
JSON
```

## Use the result

Read `decisions.route.action`. The classes are `handle` and `escalate`; the declared costs turn them into `keep` and `hand_off` actions. `top` is the predicted class, not the action name your application should dispatch.

The sample policy makes a mistaken keep more costly than an unnecessary handoff. Replace those costs with a policy justified by your workflow. A lower handoff rate is useful only if accepted answers remain good enough.

Log reviewed failures, successful keeps and handoffs. Measure the turns kept incorrectly, handoff rate, and the actual incremental cost and quality of the stronger path. Include cases where that stronger path also fails. A self-assessment of difficulty is not proof an answer is right.

## What was evaluated

There is no public evaluation for this recipe. Its examples demonstrate the request and action policy. Build a labelled set from your own cheap and expensive paths before automating escalation.

<Note>No public evaluation is recorded for this recipe. Its sample labels illustrate the format; measure it on your own reviewed cases before use.</Note>

## Improve it for your application

Keep the decision IDs and outcome order stable while evaluating changes. [Review a dataset](/guides/datasets), [tune the wording](/guides/prompt-tuning), and compare the result against your current policy before changing production. Check [fallback](/guides/models-and-fallback) so you know which model actually answered.
