Task Queue
The tasks the agent has lined up (running, waiting, done, failed) in run order, with reorder, pause, cancel and approve.
≈ 1,087 tokens per use (tool 553 · guidance 278 · typical payload 256)How token costs are estimated
Example: Task Queue
What have you got lined up for this afternoon?
Queued for this afternoon
doneWorking nowSummarise the Q3 support tickets212 of 340 tickets read
Up next
- 1 of 4: Draft renewal emails for Orchard accounts~4 min · 9 accounts
- 2 of 4: Update the board deck with October numbers~6 min · 12 slides
- 3 of 4: Check the help centre for broken links~3 min · 180 pages
- 4 of 4: Match September invoices to payments~5 min · 64 invoices
- Failed: Export the survey resultsSurvey tool asked to sign in again.
When to use
- The agent has several separate tasks lined up to run one after another, and the user may want a say in the order.
- The user asks what the agent is working on next, or to change the order, pause or drop something it queued.
When not to use
- It's the steps of one job running now. Use Execution Progress.
- The tasks are for the user to do. Use a Checklist or the Todo List.
- Work items move between stages on a team board. Use a Kanban Board.
- There is only one task. Do it, or ask.
How the agent should use it
- Pass every task from the runtime with its real
state(running,waiting,done,failed), and keep ids stable as states change. - List waiting tasks in run order. Give each a short
detailsuch as "~4 min · 9 accounts". - Add
progress(0–1) to a running task that can measure it, and a plainerrorto a failed one. - Turn off what the runtime can't do with
canReorder,canPauseorcanCancel: false. - Treat every result as a command: act on it, then send updated props. The component never assumes a command was applied.
- On
approve, run the waiting tasks in exactly the returnedorder. Afterpause, show the task aswaitingagain.
Interaction
- Working now shows the running task with a spinner, its progress and Pause and Cancel buttons.
- Up next is a numbered list. Each row has Move up, Move down and Cancel buttons (44px targets, labelled with the task and its position); focus stays on the moved task and each move is announced.
- Approve order sends the order the user settled on; Reset order appears once it differs from the agent's. After approving, the order locks and a record takes focus.
- Pause and cancel mark the task "Pausing…" or "Cancelling…" until the host sends its new state. A task being cancelled is left out of an approved order.
- Failed tasks stay in view with their error; finished ones fold under Finished. While streaming, tasks arrive one by one and controls are disabled.
Installation
npx shadcn@latest add https://your-site.com/r/task-queue.json
Usage
import { tool } from "ai"
import { taskQueueTool } from "@/components/genui/task-queue.schema"
const tools = {
[taskQueueTool.name]: tool({
description: taskQueueTool.description,
inputSchema: taskQueueTool.inputSchema,
}),
}import { TaskQueue } from "@/components/genui/task-queue"
function ToolPart({ part, addToolResult }) {
if (part.type !== "tool-show_queue") return null
return (
<TaskQueue
{...part.input}
status={part.state === "input-streaming" ? "streaming" : undefined}
result={part.state === "output-available" ? part.output : undefined}
onResult={(result) =>
addToolResult({
tool: "show_queue",
toolCallId: part.toolCallId,
output: result,
})
}
/>
)
}The result is one command:
{ action: "approve", order: ["deck", "renewals", "links", "invoices"] }
{ action: "pause", taskId: "tickets" }
{ action: "cancel", taskId: "links" }Schema
| Prop | Type | Notes |
|---|---|---|
title | string | The queue's name |
tasks | { id, title, detail?, state, progress?, error? }[] | 1–20. Data-bound. Waiting tasks in run order |
note | string? | One quiet line under the list |
canReorder, canPause, canCancel | boolean? | Default true |
approveLabel | string? | Default Approve order |
Host props: status (streaming, ready), onResult, result and className.
Source
Design Review
A designer reviews a design-system change the AI proposed (a rule, component, token, pattern or artifact) and approves, declines or sends it back before it enters the system.
Checkpoint
The restore points of a long agent run, with the current one marked. Roll back to an earlier one after a confirm step, or continue.