当地代理

unqueue()

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

撤回队列中的消息,前提是代理尚未读取它。

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 表示消息因其他原因已离开队列:它已被读取,并有一个 user_message 事件说明了这一点;或者运行已结束,并在 unsent 中返回了它。