🧩interrupt() Method
Also known as Agent SDK interrupt, query.interrupt(), Claude Agent SDK interrupt()
The method that stops what the agent is doing, but keeps the chat.
Think of it like
It is like saying stop to a helper. Then you give a new job.
Example
A user clicks Stop while the agent heads the wrong way. The app calls interrupt(), then sends the user's new message.
Why it matters
Users change their minds. This lets them steer without losing the session.
Definition
Example code
typescript
await q.interrupt();Common mistake
Key takeaways
- 1Stops this turn. Not the session.
- 2Streaming input only. Not one-shot.
- 3Then send more. Same session.