# interrupt() Method

> The method that stops what the agent is doing, but keeps the chat.

**Field:** Artificial Intelligence  
**Category:** Claude Agent SDK  
**Also known as:** Agent SDK interrupt, query.interrupt(), Claude Agent SDK interrupt()

## Think of it like

It is like saying stop to a helper. Then you give a new job.

## Definition

interrupt() is the Agent SDK method that stops what the agent is doing right now. It only works in streaming input mode, on the query object in TypeScript or on ClaudeSDKClient in Python. The session stays open, so you can send a new message straight after. In Python, read the messages still waiting before you read the reply to the new one. It is the same as pressing Esc in Claude Code.

## Example

A user clicks Stop while the agent heads the wrong way. The app calls interrupt(), then sends the user's new message.

## Example code

```typescript
await q.interrupt();
```

Stop the current turn. The session stays open.

## Why it matters

Users change their minds. This lets them steer without losing the session.

## Common mistake

Calling it in single message mode. It needs streaming input mode.

## Three principles

- **Stops this turn.** Not the session.
- **Streaming input only.** Not one-shot.
- **Then send more.** Same session.

## Related terms

- [Streaming Input Mode](https://learn.benibix.com/term/ai/streaming-input-mode)
- [abortController Option](https://learn.benibix.com/term/ai/abort-controller-option)
- [ClaudeSDKClient](https://learn.benibix.com/term/ai/claude-sdk-client)
- [query() Function](https://learn.benibix.com/term/ai/query-function)
- [Esc Shortcut](https://learn.benibix.com/term/ai/esc-shortcut)

## Told apart from

- [interrupt() vs abortController](https://learn.benibix.com/compare/interrupt-vs-abortcontroller): People think interrupt() and abortController do the same thing, because both stop an agent that is still at work. They do not. interrupt() stops only the turn the agent is on, and the session stays open, so you can send a new message right after. It needs streaming input mode. abortController ends the whole query() call, and nothing more comes back from it. Use the first to steer, and the second to quit.

![Two rows of turns. With interrupt(), turn 1 is done, turn 2 is stopped, and turn 3 is a new message, because the session stays open. With abortController, turn 1 is done, turn 2 is stopped, and nothing more comes, because the call is over.](https://learn.benibix.com/diagrams/ai9-sdk-stop.svg)

---

Source: https://learn.benibix.com/term/ai/interrupt-method
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-20
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
