Agent chat workspace
Chat with an agent that plans, acts and asks first, with your chats, the thread and the customer beside it.
What a screen is
A screen is a whole page exported from the kit, built only from kit components and tokens. Import it once, pass your data and callbacks, and render it as the page: it brings its own nav and <main>, and its loading and empty states are built in. A pattern is the copy-in version you own and change; a block is one area that sits inside your <main>.
When to use
- an operator works with agents by chat, and the agent proposes a plan, runs it and stops for an OK before a side effect
- the chat is about one record, like a customer, and its facts, invoices and run log should sit beside the thread
- you want the whole page done, with thinking, approval, a failed step, loading and empty, and only need to pass data and callbacks
When not to use
- an assistant panel beside another page — Chat in a rail or a Drawer
- one agent run step by step with its tool calls — RunDetail or RunHandoffsScreen
- a long plan that needs edits, autonomy and Request changes before it runs — PlanReviewScreen
- every approval across agents in one inbox — NotificationsInboxScreen
Usage
Chat with an agent that plans, acts and asks first, on one page: your chats on the left with what needs approval, the thread in the middle, and the customer, invoices and run log on the right. The agent's plan and the OK it waits for sit in a dock above the thread, which scrolls on its own so the composer stays in view. Approve plan or Approve is the one solid primary while it waits. Import it once and pass the chats, the thread, the plan, the approval and your callbacks; thinking, a failed step, loading, no chats yet and phones come with it.
Props
| Prop | Type | Default | Notes |
|---|---|---|---|
conversations | array | — | { id, title, agent: { name, initials?, src? }, preview?, lastActivity, unread?, needsApproval? }[] The chat list. A row shows the agent's Avatar, the title, the agent and preview, lastActivity, and one Badge: Approval (warning) when needsApproval; the title truncates with an ellipsis and the Badge never wraps, else "n new" (brand) when unread. Sample Northwind chats when omitted. |
selectedConversationId | string | — | The open chat. Left out, the screen keeps it, starting with the first chat. |
onSelectConversation | function | — | (id) => void. A row was picked; in the Drawer, the Drawer closes. |
messages | array | — | The open chat's thread: kit ChatMessage[] (parts, steps, status and error as Chat draws them). Messages sent from the composer are added locally until this prop changes. Sample Acme Logistics thread when omitted. |
plan | object | — | { title, steps: AgentPlanStep[], status: "draft" | "accepted" | "running" | "complete" | "failed", currentStepId?, footerNote? } A Chat plan part (AgentPlan) added to the latest assistant message, unless a message already has a plan part. draft shows Approve plan (the view's one solid primary); Approve plan sets running on the first step locally. More than 4 steps fold to the first 3 and Show all; the count of steps needing approval links to the first one. |
approval | object | — | { title, description?, risk?, action: ApprovalCardAction, facts?, status?, resolvedBy?, resolvedAt? } ApprovalCard in the dock over the thread (below --grid-breakpoint-md: a warning Alert with Review that opens it in a bottom Drawer). Approve and Deny set the status locally (resolved line "you · just now") until this prop's status changes. Pending → approved, from the card or the prop, opens a success Toast. |
context | object | — | { name, customer: { label, value }[], invoices: { id, number, due, amount, status: "overdue" | "due" | "paid", daysOverdue? }[], runLog?: AgentTrailStep[] } The right panel, headed by name. runLog left out follows the plan: steps before the current one done, the current one running, waiting for approval or failed, the rest pending. Sample Acme Logistics context when omitted. |
contextTab | enum | — | Open context tab. Left out, the screen keeps it, starting on customer. |
onContextTabChange | function | — | (tab) => void |
thinking | boolean | false | Chat isThinking: the thinking state in the thread; with onStop, Send becomes Stop. |
thinkingSteps | array | — | Chat thinkingSteps: { label, status, durationMs? }[] while thinking. |
error | object | — | { title, description? } A failed step: a danger Alert (inline) at the top of the dock. Set plan.status failed with the step's error so the plan in the thread shows Retry and Skip. |
onSend | function | — | (text) => void. The composer. |
onStop | function | — | () => void. Stop while thinking. |
onNewChat | function | — | () => void. New chat (outline) in the chat list's header, or the chat list Drawer's footer. |
onAcceptPlan | function | — | () => void. Approve plan on a draft plan. |
onApprove | function | — | () => void. Approve, or ⌘/Ctrl+Enter in the card. |
onDeny | function | — | () => void. Deny, or Escape in the card. |
onRetryStep | function | — | (stepId) => void. Retry on the failed step. |
onSkipStep | function | — | (stepId) => void. Skip on a running or failed step. |
onStopPlan | function | — | () => void. Stop on a running plan. |
onDenyPlan | function | — | () => void. Deny (outline) beside Approve plan on a draft plan. Deny leaves the plan with no actions and the note "Denied by you · just now" until the plan prop changes. Left out, the plan shows no Deny. |
workspace | object | — | { name, icon? } App nav brand. Northwind when omitted. |
user | object | — | { name, email?, src? } Account menu at the foot of the app nav (kit DropdownMenu: the avatar on the rail, the account card in the Drawer, both with src as the photo and an online presence mark; the menu holds View profile, Account settings, Documentation, Switch account with a sample second account, Add account and Sign out, all samples that only close the menu except Account settings, which goes to a Settings row when the screen has one). |
onNavigate | function | — | (destination) => void. destination is "overview" | "chats" | "agents" | "runs" | "workflows" | "customers" | "invoices" (app nav rows; "chats" also from the breadcrumb, "agents" from the menu). |
loading | boolean | false | Nav stays; Skeletons for the chat list (Loading chats) and the context (Loading context), Chat loading with its composer disabled, no dock; main is aria-busy. |
empty | boolean | false | No chats yet: the list's Empty, Chat's guided start with three suggestions, and the context's Empty. Also when conversations is []. |
className | string | — | On the root layout-shell. |
States
- page: default, loading, empty, thinking, awaiting-approval, approved, error
- chat: Approval (Badge, warning tone; wins over unread), n new (Badge, brand tone), selected (ListView single selection: brand edge, aria-selected)
- dock: approval pending (ApprovalCard, Approve the one solid primary; Send goes soft. Below --grid-breakpoint-md a warning Alert with Review opens it in a bottom Drawer), approval resolved (one line: Approved or Denied by you · just now), failed step (danger Alert; the plan in the thread shows the step's error, Retry and Skip), none (no approval or error: Chat fills the panel)
- layout: chat list, thread and context side by side (--grid-breakpoint-lg and wider), thread and context; the chat list opens in a left Drawer from Chats (below --grid-breakpoint-lg), the thread alone; the nav, the chat list and the context open in Drawers (below --grid-breakpoint-md); the chat list and context Drawers fill the screen below --grid-breakpoint-sm
Accessibility
- Renders its own <main> named Chats: <title>; the app nav is named App. Don't wrap the screen in another main
- PageHeader title is the page h1; the chat list and context panels are asides with h2 headings; the thread panel is a section named Chat: <title>
- The search sits in a role=search region named Filter chats; the Input is named Search chats and "/" focuses it when the list is on screen (aria-keyshortcuts)
- Row badges say Approval or n new in words; never colour alone
- The dock is a section named Approvals, before the thread in reading order; it scrolls on its own, and the Chat thread (role=log) scrolls separately. The plan sits in the thread as part of the agent's answer
- Risk, step status and invoice status are words (Badges, AgentTrail status words); the failed step is a danger Alert with a title
- Chats, Context and Menu open kit Drawers and report aria-expanded
- loading sets aria-busy on main; the Skeletons say Loading chats and Loading context
- No motion of its own
Responsive
- 1280 and wider: app nav, then the chat list, the thread, and the context; both side panels are --layout-auto-min wide, so the thread sits centred
- Below --grid-breakpoint-lg: the chat list moves into a left kit Drawer opened by Chats in the header; the context stays
- Below --grid-breakpoint-md: the nav (Menu) and the context (Context) move into Drawers too; the thread fills the page
- Below --grid-breakpoint-sm: the chat list and context Drawers fill the screen
- The dock takes the panel down to a short thread minimum (three --space-16 rows) and then scrolls, so the card's Approve shows and the composer never leaves the screen
- Dark mode follows the root theme; semantic tokens only
Do not
- Do not copy the screen's parts into a local cousin; change it through its props or compose Chat, AgentPlan and ApprovalCard yourself
- Do not wrap it in an app shell or another main
- Do not add a second solid primary Button; the plan's Approve plan or the card's Approve is the one while it waits, Send otherwise
- Do not put the approval card inside Chat messages, or a second plan in the dock; the plan is a plan part in the thread, the waiting OK goes in the dock
- Do not show a status by colour alone
- Do not use raw hex
Built from
Related
- Component
Chat
Assistant panel with a header, a thread, and a composer.
- Component
Drawer
Edge panel for secondary tasks.
- Block
Run detail
One agent run on one screen: clock, cost, pending approval and every step, all following the step you pick.
- Screen
Run / Handoffs
One multi-agent run as a whole page: a lane per agent, the handoffs between them, and the approval that needs you.