LocalAgent

unqueue()

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

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

synchronousbefore it is read
Using Python?

Switch any code block to Python: the choice applies to every page. Python SDK guide and resource reference.

const { id } = agent.queue("Rename it to final.md");
agent.unqueue(id);   // { removed: true }
agent.unqueue(id);   // { removed: false } — already removed, or already read
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

removed: false means the message is gone from the queue for another reason: it was read, and a user_message event said so, or the run ended and returned it in unsent.