Agent Workspace

A whole agent screen: task in, plan, tool calls, approval and a summary out.

PROGet Agent Workspace and 168 other Pro components with pro lifetime — Get Pro

Category
AI Agent
Access
Pro
Source
533 lines · one file
States
8 drawn
Kind
Block

The decision inside it

It takes one generator, not a framework

`onRun` yields plain updates and awaits `approval(id)` when it needs a yes. That fits any agent library or none, and a built-in example run means the screen is alive before there is a backend.

When to use it

Use Agent Workspace for a whole agent screen: a task box, the plan ticking off, tool calls, approvals, messages and a run summary. You give it one onRun async generator that yields updates and awaits approval(id) when it needs a person. For single parts, use Task Plan, Tool Call or Approval Request.

Installation

How you get it

Paste this into Claude Code, Cursor, Codex or any coding agent. It installs the file and uses it as it is, instead of writing a new one.

Use Liro's Agent Workspace for this.
Install it: npx shadcn@latest add @liro/agent-workspace
(the @liro registry is set up in components.json, with LIRO_KEY in .env.local)
Import it from @/components/ui/agent-workspace.
Do not rewrite or restyle it. Pass my data through its props
and keep its built-in states.

For the full brief with every prop and the mistakes assistants usually make, use Copy prompt above. Pro components install through the @liro registry with your CLI token: see the Namespaced tab.

Usage

components/agent.tsx
import { AgentWorkspace, type AgentRunRequest, type AgentUpdate } from "@/components/ui/agent-workspace";

async function* run({ task, approval }: AgentRunRequest): AsyncIterable<AgentUpdate> {
  yield { type: "plan", steps: [{ id: "find", title: "Find unpaid invoices" }, { id: "send", title: "Send reminders" }] };
  yield { type: "step", id: "find", status: "running" };
  yield { type: "tool", id: "t1", name: "invoices.search", status: "success", summary: "2 unpaid" };
  yield { type: "step", id: "find", status: "done" };
  yield { type: "approval", id: "a1", title: "Email 2 customers?", risk: "medium" };
  const decision = await approval("a1");
  yield { type: "step", id: "send", status: decision.approved ? "done" : "skipped" };
  yield { type: "done", title: `Finished: ${task}`, status: decision.approved ? "completed" : "partial" };
}

export function Agent() {
  return <AgentWorkspace onRun={run} welcome={{ title: "What should the agent do?" }} />;
}

API reference

“Copy prompt” above puts a full brief on your clipboard, install command, dependencies, props, and the mistakes an assistant usually makes with this component.

Props

Read from the component’s own TypeScript interface when the site is built, so this table cannot drift from the file you install.

TypeNotes
onRun(request: AgentRunRequest) => AsyncIterable<AgentUpdate> NoRuns the task and yields what happens. Leave it out to use the built-in example.
onRunEnd(result: { task: string; status: RunStatus }) => void NoCalled when a run ends, however it ends.
agent{ name: string; avatar?: React.ReactNode } NoShown in the header and inside the status ring.
welcomeAgentWorkspaceWelcome NoThe screen before the first task.
placeholderstring No–
currencystring NoISO 4217 code for costs. Default "USD".

Dependencies

npm packages

clsxframer-motionlucide-reacttailwind-merge

Liro foundations, installed alongside it

liro-themeagent-run-statusagent-timelineapproval-requestbuttonchat-empty-stateprompt-inputrun-summarystreaming-responsetask-plantool-calltooltip

States

All of them are drawn by the component. None is left for you to design.

  • Idle
  • Running
  • Needs approval
  • Paused
  • Completed
  • Step skipped
  • Stopped
  • Failed

Accessibility

  • Keyboard reachable throughout, in visual order
  • Focus trapped in overlays, Escape closes them
  • Focus returns to whatever opened it
  • Live regions announce what changed, not that something did
  • Honours prefers-reduced-motion

Responsive behavior

  • Sizes to its container, not the viewport
  • Usable from 320px up
  • Pointer-based interaction, so trackpad and touch both work
  • No hover-only affordances