Skip to content

Agent Run Console ​

Help users understand a long-running AI task: how far it has got, what state the system is in, why something failed, and when they need to step in Status: not started | Priority P0


1. Business scenario ​

A multi-agent research assistant: the user asks a research question and several agents work on it together:

  1. A planner agent breaks the question down and drafts a search plan
  2. A search agent calls paper-search tools and collects 20–50 candidate papers
  3. Reader agents read in parallel and extract key points
  4. A writer agent turns everything into a report with citations
  5. When it hits a paywall, gets too few results, or finds conflicting conclusions, it asks the user to step in (add keywords, upload a PDF, decide between options)

A task can run from 10 minutes to an hour, and users leave and come back. The agents work, but users get confused about four things:

User confusionWhat the UI must answer
ProgressWhich step is it on? How long is left? What has it produced so far?
StateIs it running, waiting, retrying, or stuck? Which agent is doing what?
ErrorsWhat went wrong and why, what has the system already tried, what can I do?
InterventionDoes it need me now? What exactly do I need to do? Will it continue after I'm done?

2. Architecture and technology choices ​

[Scenario simulator]  Scripted event scenarios (happy path / retry succeeds / partial failure / needs human / disconnect), replayed over time
      │               (can be swapped for a real agent backend, see section 7)
      ▼
[Event API]  GET /tasks/:id/events   (SSE with event ids, supports Last-Event-ID replay)
             GET /tasks/:id/snapshot (current snapshot for first paint and resync)
      ▼
[Client state]  useTaskStream: SSE subscription → dedupe/sort → pure reducer(state, event) → derived view data
      ▼
[UI]  Task list (dense table) | Task detail: summary + timeline + flow graph + agent swimlanes + outputs
      Human-action inbox | Error cards | Global connection status
PartChoiceWhy
FrameworkNext.js (App Router) + TypeScriptFront end and a mock SSE Route Handler in one app; easy to deploy on Vercel
UITailwind CSS + shadcn/ui (built on Radix)Source-level control over components; solid accessibility basics (focus management, keyboard support)
Server stateTanStack QueryCaching and invalidation for lists and snapshots; the event stream goes through the reducer
Real-time dataSSE (EventSource)One-way push is enough; the browser reconnects automatically and Last-Event-ID allows replay
Flow graphReact Flow (@xyflow/react)Nodes are custom React components, good for a live-colored DAG of agent steps
Long listsTanStack VirtualLogs and events can reach thousands of rows
MotionCSS transitions + Motion (motion/react)State changes and list insertions; respects prefers-reduced-motion
TestingVitest (reducer) + Testing Library (components) + Playwright (E2E scenario replay) + axe (accessibility)Every state has a replayable scenario, shared by tests and demos
Component docsStorybookShows every state of every component, and doubles as the design system showcase
DesignFigmaInformation architecture and key screens are designed before coding

Why an event stream + reducer instead of polling a status endpoint: for long tasks the value is in the process. Keeping events makes the timeline, replay and "what happened while you were away" summary possible. The reducer is a pure function, so out-of-order or duplicate events can be replayed after dedupe and sorting by id, and it is easy to test.


3. State model (the core of the design) ​

Task state: queued → running ⇄ waiting_human → (retrying) → succeeded | partially_succeeded | failed | cancelled

Step state: pending / running / retrying(n/N) / blocked (waiting on a dependency) / needs_human / succeeded / skipped / failed

Connection state: live / reconnecting / offline (shows last update time)

State × UI matrix (excerpt)

StateSummary barTimelinePrimary action
runningProgress bar + current step + estimated time left (shown as "about", or hidden when unsure)Current node pulsesPause / Cancel
retryingYellow "Retrying automatically 2/3" + reasonNode shows retry countNone needed (details expandable)
needs_humanProminent banner "Needs you: add search keywords" + how long it has waitedNode highlighted"Handle it" goes straight to the form
partially_succeeded"7/10 papers read, 3 couldn't be fetched"Failed nodes expandableUpload PDF / Skip and continue
failedFailure card (three parts)Jumps to the failed nodeRetry from the failed step / Edit and rerun
offlineGrey bar "Connection lost, reconnecting… last update 12:03"FrozenManual refresh

Three-part error card copy: what happened → what the system already did → what you can do. Example: "The paper search service timed out. We retried automatically 3 times and all failed. You can: retry this step later / switch to the backup search source / skip search and use the papers you uploaded."


4. Implementation steps (about 3 weeks) ​

PhaseWorkAcceptance
D1–3Requirements and design: user task list, information architecture, state diagram, state × UI matrix; Figma designs and prototype for the task list, task detail and human-action pagesDesigns cover every state in the matrix
D4–5Event schema (TypeScript types) + scenario simulator (5 scenarios) + SSE Route Handler (with Last-Event-ID)The browser receives events replayed from a scenario
D6–8useTaskStream + reducer + unit tests; task detail page: summary, timeline (virtualized), error cardsAll 5 scenarios render correctly
D9–10Flow graph view (@xyflow/react, nodes colored live) + agent swimlane view"Who is doing what" across parallel agents is visible at a glance
D11–12Human-action inbox: tasks needing input in one place, task resumes after handling; unread count in the page title + browser notification (with permission)The "needs human" scenario works end to end
D13Task list: dense table, filters, sorting, keyboard navigation (j/k to move, Enter to open), command palette100+ tasks without lag
D14–15Accessibility (axe, keyboard, VoiceOver, aria-live for key state changes) + 375px small-screen layout + dark modeNo serious axe issues; main flow works on a phone
D16–17Playwright E2E (one per scenario) + Storybook + deploymentLive URL + passing CI
D18–21Usability test with 5 people → rank issues → one iteration → write a case study page (before/after)Case study + iteration log

5. Challenges and highlights ​

ChallengeSolution
Out-of-order, duplicate or missed events after a disconnectEvents carry monotonically increasing ids; the reducer is idempotent by id; reconnects send Last-Event-ID for replay; periodic snapshot resync
High-frequency events cause jankBuffer events and commit once per frame (requestAnimationFrame); virtualize the log; only the summary layer is live, details expand on demand
Too many states, cluttered UIUse a state machine instead of combinations of booleans; three layers of information: one-line summary → timeline → raw events/logs
Users come back and can't tell what happened"While you were away" summary computed from the last-viewed time, with items needing action on top
Intervention requests get missedInbox + unread count in the title + optional notification; show waiting time; make the timeout policy visible ("will be skipped after 30 minutes without a response")
Screen reader users miss live changesAnnounce only key changes (done, failed, needs human) with aria-live="polite", never every log line
State shown by color aloneEvery state has an icon + text label; contrast meets WCAG AA
Demos depend on a real LLM, costly and flakyThe scenario simulator replays scripts, so demos, tests and screenshots are reproducible

6. Resume description (STAR) ​

Agent Run Console | Owned interaction design and front-end development

  • S: Tasks in a multi-agent research assistant often ran for tens of minutes; users couldn't judge progress, couldn't understand failures, and often missed the moments when human input was needed.
  • T: Own the whole interaction chain, from information architecture and design to shipping the front end, so users can understand progress, state and errors and step in on time.
  • A: Mapped a three-level state machine (task / step / connection) and a state × UI matrix, and produced designs in Figma; built the client state layer on an SSE event stream with an idempotent reducer, handling reconnect replay and out-of-order dedupe; implemented the timeline, a React Flow graph, agent swimlanes and a human-action inbox; replayed 5 scenario types through a simulator and covered every state with Vitest, Playwright and axe; ran a 5-person usability test and iterated.
  • R: In usability tests, completion of "find why the task failed and get it going again" rose from X% to X%, and average time fell from X s to X s; zero serious axe issues; INP < 200 ms with 1,000 events. (Numbers to be filled in from real measurements)

7. Extensions ​

  • Connect a real agent backend: replace the simulator with the event stream of the "Browser Automation Agent" or "AI Document Review Pipeline" project; the front end stays the same
  • Replay mode: scrub through any past task along its timeline
  • Multi-task status board: aggregate by agent and error type to see which errors are most common

  • Front end / Next.js / Streaming UI and long-running tasks: progress for long tasks, SSE
  • Back end / FastAPI / SSE streaming endpoints: event stream protocol
  • Architecture / Pipeline orchestration / Task state machine and resumable runs: state modeling
  • Architecture / Reliability / Human-in-the-loop: when to ask for help and how to resume
  • Architecture / Observability / Traces and LLM call records: where timeline data comes from
  • AI / Agent / Agent and workflow patterns: how multiple agents collaborate

Vin Amory · AI development × content creation · Technical notes cite official docs in each page’s sources section