Agent Configuration & Activity UI

Context

Agents are the employees of a Paperclip company. Each agent has an adapter type (claude_local, codex_local, process, http) that determines how it runs, a position in the org chart (who it reports to), a heartbeat policy (how/when it wakes up), and a budget. The UI at /agents needs to support creating and configuring agents, viewing their org hierarchy, and inspecting what they’ve been doing — their run history, live logs, and accumulated costs. This spec covers three surfaces:
  1. Agent Creation Dialog — the “New Agent” flow
  2. Agent Detail Page — configuration, activity, and logs
  3. Agents List Page — improvements to the existing list

1. Agent Creation Dialog

Follows the existing NewIssueDialog / NewProjectDialog pattern: a Dialog component with expand/minimize toggle, company badge breadcrumb, and Cmd+Enter submit.

Fields

Identity (always visible):
FieldControlRequiredDefaultNotes
NameText input (large, auto-focused)Yese.g. “Alice”, “Build Bot”
TitleText input (subtitle style)Noe.g. “VP of Engineering”
RoleChip popover (select)NogeneralValues from AGENT_ROLES: ceo, cto, cmo, cfo, engineer, designer, pm, qa, devops, researcher, general
Reports ToChip popover (agent select)NoDropdown of existing agents in the company. If this is the first agent, auto-set role to ceo and gray out Reports To. Otherwise required unless role is ceo.
CapabilitiesText inputNoFree-text description of what this agent can do
Adapter (collapsible section, default open):
FieldControlDefaultNotes
Adapter TypeChip popover (select)claude_localclaude_local, codex_local, process, http
Test environmentButtonRuns adapter-specific diagnostics and returns pass/warn/fail checks for current unsaved config
CWDText inputWorking directory for local adapters
Prompt TemplateTextareaSupports {{ agent.id }}, {{ agent.name }} etc.
ModelText inputOptional model override
Adapter-specific fields (shown/hidden based on adapter type): claude_local:
FieldControlDefault
Max Turns Per RunNumber input80
Skip PermissionsToggletrue
codex_local:
FieldControlDefault
SearchTogglefalse
Bypass SandboxToggletrue
process:
FieldControlDefault
CommandText input
ArgsText input (comma-separated)
http:
FieldControlDefault
URLText input
MethodSelectPOST
HeadersKey-value pairs
Runtime (collapsible section, default collapsed):
FieldControlDefault
Context ModeChip popoverthin
Monthly Budget (cents)Number input0
Timeout (sec)Number input900
Grace Period (sec)Number input15
Extra ArgsText input
Env VarsKey-value pair editor
Heartbeat Policy (collapsible section, default collapsed):
FieldControlDefault
EnabledToggletrue
Interval (sec)Number input300
Wake on AssignmentToggletrue
Wake on On-DemandToggletrue
Wake on AutomationToggletrue
Cooldown (sec)Number input10

Behavior

  • On submit, calls agentsApi.create(companyId, data) where data packs identity fields at the top level and adapter-specific fields into adapterConfig and heartbeat/runtime into runtimeConfig.
  • After creation, navigate to the new agent’s detail page.
  • If the company has zero agents, pre-fill role as ceo and disable Reports To.
  • The adapter config section updates its visible fields when adapter type changes, preserving any shared field values (cwd, promptTemplate, etc.).

2. Agent Detail Page

Restructure the existing tabbed layout. Keep the header (name, role, title, status badge, action buttons) and add richer tabs.
[StatusBadge]  Agent Name                    [Invoke] [Pause/Resume] [...]
               Role / Title
The [...] overflow menu contains: Terminate, Reset Session, Create API Key.

Tabs

Overview Tab

Two-column layout: left column is a summary card, right column is the org position. Summary card:
  • Adapter type + model (if set)
  • Heartbeat interval (e.g. “every 5 min”) or “Disabled”
  • Last heartbeat time (relative, e.g. “3 min ago”)
  • Session status: “Active (session abc123…)” or “No session”
  • Current month spend / budget with progress bar
Org position card:
  • Reports to: clickable agent name (links to their detail page)
  • Direct reports: list of agents who report to this agent (clickable)

Configuration Tab

Editable form with the same sections as the creation dialog (Adapter, Runtime, Heartbeat Policy) but pre-populated with current values. Uses inline editing — click a value to edit, press Enter or blur to save via agentsApi.update(). Sections:
  • Identity: name, title, role, reports to, capabilities
  • Adapter Config: all adapter-specific fields for the current adapter type
  • Heartbeat Policy: enable/disable, interval, wake-on triggers, cooldown
  • Runtime: context mode, budget, timeout, grace, env vars, extra args
Each section is a collapsible card. Save happens per-field (PATCH on blur/enter), not a single form submit. Validation errors show inline.

Runs Tab

This is the primary activity/history view. Shows a paginated list of heartbeat runs, most recent first. Run list item:
[StatusIcon] #run-id-short   source: timer     2 min ago     1.2k tokens   $0.03
             "Reviewed 3 PRs and filed 2 issues"
Fields per row:
  • Status icon (green check = succeeded, red X = failed, yellow spinner = running, gray clock = queued, orange timeout = timed_out, slash = cancelled)
  • Run ID (short, first 8 chars)
  • Invocation source chip (timer, assignment, on_demand, automation)
  • Relative timestamp
  • Token usage summary (total input + output)
  • Cost
  • Result summary (first line of result or error)
Clicking a run opens a run detail inline (accordion expand) or a slide-over panel showing:
  • Full status timeline (queued -> running -> outcome) with timestamps
  • Session before/after
  • Token breakdown: input, output, cached input
  • Cost breakdown
  • Error message and error code (if failed)
  • Exit code and signal (if applicable)
Log viewer within the run detail:
  • Streams heartbeat_run_events for the run, ordered by seq
  • Each event rendered as a log line with timestamp, level (color-coded), and message
  • Events of type stdout/stderr shown in monospace
  • System events shown with distinct styling
  • For running runs, auto-scrolls and appends live via WebSocket events (heartbeat.run.event, heartbeat.run.log)
  • “View full log” link fetches from heartbeatsApi.log(runId) and shows in a scrollable monospace container
  • Truncation: show last 200 events by default, “Load more” button to fetch earlier events

Issues Tab

Keep as-is: list of issues assigned to this agent with status, clickable to navigate to issue detail.

Costs Tab

Expand the existing costs tab:
  • Cumulative totals from agent_runtime_state: total input tokens, total output tokens, total cached tokens, total cost
  • Monthly budget progress bar (current month spend vs budget)
  • Per-run cost table: date, run ID, tokens in/out/cached, cost — sortable by date or cost
  • Chart (stretch): simple bar chart of daily spend over last 30 days

Properties Panel (Right Sidebar)

The existing AgentProperties panel continues to show the quick-glance info. Add:
  • Session ID (truncated, with copy button)
  • Last error (if any, in red)
  • Link to “View Configuration” (scrolls to / switches to Configuration tab)

3. Agents List Page

Current state

Shows a flat list of agents with status badge, name, role, title, and budget bar.

Improvements

Add “New Agent” button in the header (Plus icon + “New Agent”), opens the creation dialog. Add view toggle: List view (current) and Org Chart view. Org Chart view:
  • Tree layout showing reporting hierarchy
  • Each node shows: agent name, role, status badge
  • CEO at the top, direct reports below, etc.
  • Uses the agentsApi.org(companyId) endpoint which already returns OrgNode[]
  • Clicking a node navigates to agent detail
List view improvements:
  • Add adapter type as a small chip/tag on each row
  • Add “last active” relative timestamp
  • Add running indicator (animated dot) if agent currently has a running heartbeat
Filtering:
  • Tab filters: All, Active, Paused, Error (similar to Issues page pattern)

4. Component Inventory

New components needed:
ComponentPurpose
NewAgentDialogAgent creation form dialog
AgentConfigFormShared form sections for create + edit (adapter, heartbeat, runtime)
AdapterConfigFieldsConditional fields based on adapter type
HeartbeatPolicyFieldsHeartbeat configuration fields
EnvVarEditorKey-value pair editor for environment variables
RunListItemSingle run row in the runs list
RunDetailExpanded run detail with log viewer
LogViewerStreaming log viewer with auto-scroll
OrgChartTree visualization of agent hierarchy
AgentSelectReusable agent picker (for Reports To, etc.)
Reused existing components:
  • StatusBadge, EntityRow, EmptyState, PropertyRow
  • shadcn: Dialog, Tabs, Button, Popover, Command, Separator, Toggle

5. API Surface

All endpoints already exist. No new server work needed for V1.
ActionEndpointUsed by
List agentsGET /companies/:id/agentsList page
Get org treeGET /companies/:id/orgOrg chart view
Create agentPOST /companies/:id/agentsCreation dialog
Update agentPATCH /agents/:idConfiguration tab
Pause/Resume/TerminatePOST /agents/:id/{action}Header actions
Reset sessionPOST /agents/:id/runtime-state/reset-sessionOverflow menu
Create API keyPOST /agents/:id/keysOverflow menu
Get runtime stateGET /agents/:id/runtime-stateOverview tab, properties panel
Invoke/WakeupPOST /agents/:id/heartbeat/invokeHeader invoke button
List runsGET /companies/:id/heartbeat-runs?agentId=XRuns tab
Cancel runPOST /heartbeat-runs/:id/cancelRun detail
Run eventsGET /heartbeat-runs/:id/eventsLog viewer
Run logGET /heartbeat-runs/:id/logFull log view

6. Implementation Order

  1. New Agent Dialog — unblocks agent creation from the UI
  2. Agents List improvements — add New Agent button, tab filters, adapter chip, running indicator
  3. Agent Detail: Configuration tab — editable adapter/heartbeat/runtime config
  4. Agent Detail: Runs tab — run history list with status, tokens, cost
  5. Agent Detail: Run Detail + Log Viewer — expandable run detail with streaming logs
  6. Agent Detail: Overview tab — summary card, org position
  7. Agent Detail: Costs tab — expanded cost breakdown
  8. Org Chart view — tree visualization on list page
  9. Properties panel updates — session ID, last error
Steps 1-5 are the core. Steps 6-9 are polish.