# unqueue()

Canonical URL: https://developers.iagenify.com/sdk/ref/local-agent/unqueue/
Language: en

`agent.unqueue(id) → { removed: boolean }`

Takes back a queued message, as long as the agent has not read it yet.

Status: synchronous · before it is read

```javascript
const { id } = agent.queue("Rename it to final.md");
agent.unqueue(id);   // { removed: true }
agent.unqueue(id);   // { removed: false } — already removed, or already read
```

`removed: false` means the message is gone from the queue for another reason: it was read, and a [user_message](/sdk/agent/events/user-message) event said so, or the run ended and returned it in `unsent`.

- [queue()](/sdk/ref/local-agent/queue): Sending while the agent works.

```python
queued = agent.queue("Rename it to final.md")
agent.unqueue(queued["id"])   # {"removed": True}
agent.unqueue(queued["id"])   # {"removed": False} — already removed, or already read
```
