Why AI agents stop on refusals mid-task
AI agents stop on refusals mid-task because a refusal comes back as plain text with no tool call, and the agent loop takes that as the final answer. A model with its refusal direction removed keeps calling tools instead.
Point the agent only at systems, files and accounts you own or are allowed to test.
Where the loop ends
| The step returns | The loop | The run |
|---|---|---|
| A tool call | Runs the tool and calls the model again | Continues |
| Text with no tool call | Treats it as the final output | Ends, with the refusal as its answer |
| A refusal the SDK detects | Raises ModelRefusalError in the OpenAI Agents SDK | Ends, unless you handle it |
"The rule for whether the LLM output is considered as a "final output" is that it produces text output with the desired type, and there are no tool calls."
OpenAI Agents SDK, running agents
Fixes
| Fix | What it changes |
|---|---|
| Use an abliterated model | Removes the single direction that mediates refusal, per Arditi et al., 2024. |
| Name the scope in the instructions | List the systems and accounts the agent may touch, such as your own staging server. |
| Handle model_refusal | Returns a fallback instead of ending the run, in the OpenAI Agents SDK. |
| Cap the turns | max_turns raises MaxTurnsExceeded, so a stuck agent stops. |
Models
Kimi K3.1 Pro and DeepSeek V4.1 Flash 1017 are abliterated. How abliteration works.