Skip to main content

Frontend Integration

Complete engineering reference for the River Agents frontend -- covering all 12 pages under the /agents route, their layout structures, component specifications, API call patterns, real-time WebSocket contracts, Zustand store definitions, and all four primary user journey flows.

Built with Next.js 15 App Router, React 19, TypeScript, Tailwind CSS, and Zustand for state management. This document is the implementation reference for frontend engineers adding pages, integrating new API endpoints, or extending the real-time layer.

Quick Navigation

Technology Stack

LayerTechnologyNotes
FrameworkNext.js 15 App RouterAll 12 pages use App Router conventions; no Pages Router usage
UI LibraryReact 19Concurrent features used for live-streaming log panels
LanguageTypeScriptStrict mode enabled; all API response shapes are typed
StylingTailwind CSSNo CSS modules; all component styles via utility classes
StateZustand7 stores; no Redux or Context API for agent state
ChartsRechartsUsed for time-series, area, and bar charts on monitoring pages
Real-TimeWebSocket (native)Three connection endpoints; see Real-Time Integration Architecture
Auth Guard<ProtectedRoute>Wraps all 12 pages; redirects to login if session is absent or expired
Layout<AgentLayout>Sidebar + top nav wrapper applied to all 12 pages

Page Map and Navigation Architecture

All routes are protected by <ProtectedRoute> and wrapped in <AgentLayout>. The sidebar renders links to all top-level pages. The Agent Detail View (/agents/[id]) and Run Detail (/agents/runs/[id]) are deep-link targets accessed from their respective list pages, not direct sidebar items.


Layout Wrapper Components

ComponentResponsibility
<ProtectedRoute>Validates the session on mount. Redirects to /login?redirect={current_path} if the session is absent or expired. Renders a loading skeleton during validation to prevent a flash of unauthenticated content.
<AgentLayout>Renders the sidebar (links to all top-level pages), top navigation bar (workspace name, user avatar, notification bell with approvalStore.pendingCount badge), and the page content area. Sidebar collapsed state is persisted in localStorage.

Page 1: Agent Library

Route: /agents

The workspace home page for River Agents. Loads all agents for the authenticated workspace and provides search, filtering, and management actions.

+---------------------------------------------------------------+
| Header: "River Agents" + description badge |
| [+ Create Agent] [Templates] [Monitor] [Audit Log] |
+---------------------------------------------------------------+
| Metric Cards Row: |
| +----------+ +----------+ +----------+ +----------+ |
| | Total | | Active | | Runs | | Success | |
| | Agents | | Agents | | Today | | Rate | |
| +----------+ +----------+ +----------+ +----------+ |
+---------------------------------------------------------------+
| Search Bar | Status Filter | Category Filter | [Grid/List] |
+---------------------------------------------------------------+
| Agent Cards (Grid View): |
| +------------------+ +------------------+ |
| | Icon Name | | Icon Name | |
| | Status Badge | | Status Badge | |
| | Description... | | Description... | |
| | Health | Level | | Health | Level | |
| | Owner | | Owner | |
| | [View] [Edit] | | [View] [Edit] | |
| | [Delete] | | [Delete] | |
| +------------------+ +------------------+ |
+---------------------------------------------------------------+

Feature Specification

FeatureBehavior
Metric Cards4 KPI cards: Total Agents (count), Active Agents (count), Runs Today (24h window), Success Rate (7-day rolling). Loaded via GET /api/v1/agents/metrics/summary.
SearchControlled text input; debounced 300ms. Triggers a server-side refetch with ?search={q} on the name and description fields.
Status FilterComboBox: All, Active, Paused, Draft, Archived. Maps to agent_status enum values.
Category FilterComboBox: All plus one entry per agent_category value. Can be combined with Status filter.
View ToggleGrid (card) and List (table row) modes. Selection persisted to agentStore.viewMode.
Agent Card -- GridIcon with category-colored background, name, status badge (color-coded), 2-line truncated description, health dot, action level tag, owner name, View / Edit / Delete buttons.
Agent Row -- ListSame data as grid card in a compact table row; description column truncated to 60 characters.
Delete ConfirmationModal requiring the user to manually type the agent name before DELETE /api/v1/agents/{id} fires. Prevents accidental deletion.
Quick ActionsFour header buttons: Create Agent (/agents/create), Templates (/agents/templates), Monitor (/agents/monitoring), Audit Log (/agents/audit).

Agent Card Data Fields

FieldRenderingSource
IconCategory-specific icon with a business_function-mapped background colorStatic icon + color config keyed on agent.category
NameBold, truncated to one lineagent.name
StatusColor-coded badge: Active (green), Paused (amber), Draft (gray), Running (blue), Archived (red)agent.status
Description2-line truncated paragraph, line-clamp-2agent.description
HealthColored dot: healthy (green), degraded (amber), critical (red)Computed from agent.health_status; derived from recent run metrics on a 5-minute evaluation cycle
Action LevelTag: "Read Only", "Recommend", "Approval", "Automated"agent.action_level mapped to display label
OwnerUser display nameagent.owner_user_id resolved via user cache in agentStore

API Calls

TriggerEndpointStore Update
Page mountGET /api/v1/agents?page=1&limit=20&workspace_id={id}agentStore.agents
Page mountGET /api/v1/agents/metrics/summaryagentStore.summaryMetrics
Filter changeGET /api/v1/agents?status={s}&category={c}&search={q}Replaces agentStore.agents
Delete actionDELETE /api/v1/agents/{id}Removes entry from agentStore.agents; invalidates agentStore.summaryMetrics

Page 2: Creation Entry

Route: /agents/create

Gateway page presenting the two agent creation paths. Renders a two-column card layout with a generation history sidebar.

+---------------------------------------------------------------+
| Header: "Create Agent" + description |
+---------------------------+-----------------------------------+
| | |
| +---------------------+ | +-----------------------------+ |
| | AI Creation | | | Guided Setup | |
| | | | | | |
| | Describe what you | | | Step-by-step wizard to | |
| | need in natural | | | configure every aspect of | |
| | language and let | | | your agent with full | |
| | AI generate the | | | manual control. | |
| | agent config. | | | | |
| | | | | | |
| | [Start AI Create] | | | [Start Guided Setup] | |
| +---------------------+ | +-----------------------------+ |
| | |
+---------------------------+-----------------------------------+
| Generation History (lazy-loaded sidebar): |
| Previous AI-generated configs -- click to resume a draft |
+---------------------------------------------------------------+

Feature Specification

FeatureBehavior
AI Creation CardRoutes to /agents/create/ai on click. Describes the natural language input path.
Guided Setup CardRoutes to /agents/create/guided on click. Describes the manual 5-step wizard path.
Generation History SidebarLazy-loaded after main two-card panel renders; not critical path. Calls GET /api/v1/agents/ai-drafts after mount. Each entry shows: prompt summary (truncated 80 chars), timestamp, and draft status (completed / draft). Clicking an entry navigates to /agents/create/ai and restores that draft from agentStore.aiDraft. Renders a loading skeleton while fetching.

Implementation note: The Generation History sidebar fetch is deferred with a useEffect that fires after the first paint. If the fetch fails (e.g., user has no prior drafts), the sidebar slot renders an empty state message -- it does not show an error state.


Page 3: AI-Powered Creation

Route: /agents/create/ai

Generates a complete agent configuration from a natural language description. The user reviews the generated configuration, edits individual sections inline, and deploys directly.

User Flow

Feature Specification

FeatureBehavior
Prompt InputLarge textarea; min-height 120px; multiline. Submit on Ctrl+Enter or button click.
Quick Starter ChipsPre-written prompt chips for common use cases (e.g., "Monitor customer support tickets", "Reconcile financial records daily"). Clicking a chip populates the textarea; the user can edit before submitting.
Generation Animation4-stage progress indicator shown during POST /api/v1/agents/generate. Stages: (1) Understanding Requirements, (2) Mapping Data Sources, (3) Configuring Actions, (4) Applying Governance. Stage transitions are driven by SSE progress events from the backend, not client-side timers.
Review Panel -- Connected ContextShows which data sources the AI selected and the reasoning label for each selection. Editable: user can add or remove sources from the generated set.
Review Panel -- Action BoundariesShows selected tools, the recommended action level, and a per-tool risk assessment label. Editable.
Review Panel -- GovernanceShows generated approval rules and any active org-level policies that will apply to this agent. Org policies are read-only; they cannot be overridden here.
Inline EditingAny field in the review panel is editable. Edits apply to the in-memory draft in agentStore.aiDraft and do not trigger a re-generation.
DeployPOST /api/v1/agents with the finalized config from agentStore.aiDraft. The name field must be non-empty before the button activates. On success, redirects to /agents/{new_id}.

API Calls

TriggerEndpointNotes
Submit descriptionPOST /api/v1/agents/generateReturns SSE stream; each stage emits a progress event; the final complete event contains the full generated config object
DeployPOST /api/v1/agentsBody: finalized config from agentStore.aiDraft; returns 202 with agent_id

Page 4: Guided Wizard

Route: /agents/create/guided (also /agents/create/guided?template={id})

A 5-step sequential configuration form. When navigated with ?template={id}, all fields are pre-populated from the template record fetched at mount.

Step Flow

Step Specifications

StepNameFields
1IdentityAgent Name (required text), Description (required textarea), Domain / Category (dropdown of 8 agent_category values), Admin / Owner (user selector)
2Goalinstruction_set large textarea (monospace font); AI Suggest button (calls POST /api/v1/agents/suggest-goal); Example Goals section populated contextually from the Step 1 category selection
3Data and SystemsCategorized grid of all available workspace data sources (Databases, APIs, SaaS, Files). Click to select / deselect; selected sources are highlighted. Per-source access level indicator (read-only / read-write). Search filter.
4Actions4 action level selector cards (see below). Selection updates agentStore.wizardDraft.action_level.
5Review and CertifyFull configuration summary; "Edit" links per section navigate back to the relevant step. Certification checkbox must be checked before the Deploy button activates.

Action Level Selector Cards (Step 4)

+-----------------+ +-----------------+ +-----------------+ +-----------------+
| Read and | | Recommend | | Act with | | Fully |
| Respond | | Actions | | Approval | | Automated |
| | | | | | | |
| Query and | | Suggest actions | | Execute after | | Execute without |
| analyze only. | | but never | | human approves | | human approval. |
| No writes. | | execute them. | | each action. | | |
| | | | | | | |
| Risk: None | | Risk: Low | | Risk: Medium | | Risk: High |
+-----------------+ +-----------------+ +-----------------+ +-----------------+

Each card renders a visual risk indicator: None (green), Low (yellow), Medium (orange), High (red). Selecting a card shows a detailed enforcement summary below the grid explaining exactly what the agent can and cannot do at that level.

Template Pre-Fill

When ?template={id} is present, the page calls GET /api/v1/templates/{id} on mount and populates agentStore.wizardDraft from the template's template_config fields. The user can modify any field. The resulting agent record stores template_id for traceability.

API Calls

TriggerEndpointNotes
Mount with ?template={id}GET /api/v1/templates/{id}Populates agentStore.wizardDraft
Step 2 AI SuggestPOST /api/v1/agents/suggest-goalBody: { name, description, category }; returns suggested instruction_set
Step 3 mountGET /api/v1/workspace/data-sourcesLoads available data sources for the selection grid
Deploy (Step 5)POST /api/v1/agentsReturns 202 with agent_id; wizard enters polling mode

Implementation note: The POST /api/v1/agents returns 202 because agent validation is asynchronous. After receiving the 202, the wizard shows a "Deploying..." state and polls GET /api/v1/agents/{id}/validation-status at 2-second intervals until status transitions to configured or active. On async validation failure, the wizard renders an inline error banner with field-level detail and navigates the user back to the step containing the failing field.


Page 5: Agent Detail View

Route: /agents/[id]

The primary operational workspace for a live agent. A persistent hero header and KPI strip remain fixed above a 7-tab content area.

+---------------------------------------------------------------+
| [<- Back] [Icon] Agent Name [Status Badge] |
| Description text | Owner | Domain | Created date |
| [Run Now] [Pause / Resume] [Edit] [Deploy New Version] |
+---------------------------------------------------------------+
| Total Runs | Success Rate | Avg Latency | Actions Taken |
| Pending Approvals | Uptime |
+---------------------------------------------------------------+
| [Overview] [Activity] [Data Access] [Governance] |
| [Monitoring] [Audit and Logs] [Settings] |
+---------------------------------------------------------------+
| Tab content area (varies by selected tab) |
| |
+---------------------------------------------------------------+

Hero Header

ElementBehavior
Back ButtonNavigates to /agents (Agent Library)
Action ButtonsContext-sensitive set based on agent.status: Active shows Run Now + Pause; Paused shows Resume; any status shows Edit and Deploy New Version
Run NowOpens a modal for optional payload input (rendered as a form from the agent's trigger_config.input_schema). Calls POST /api/v1/agents/{id}/runs on submit. Disabled when agent.status is not active.
Deploy New VersionOpens the Settings tab pre-focused on the instruction set editor; saving creates a new version draft and initiates the deploy flow.

KPI Strip

MetricDescriptionSource
Total RunsLifetime execution countagentMetrics.total_runs
Success RateCompleted / Total runs over the 7-day windowagentMetrics.success_rate_7d
Avg LatencyMean execution duration in the 7-day windowagentMetrics.avg_latency_ms
Actions TakenTotal tool dispatches across all runsagentMetrics.total_tool_calls
Pending ApprovalsActive approval_requests records in pending statusapprovalStore.pendingCount -- rendered amber with bold font if count > 0
UptimePercentage of time in active status over the rolling 30-day windowagentMetrics.uptime_percent

Tab Specifications

Tab 1: Overview

Content is dynamic per agent_category. Common elements across all categories: Quick Stats Cards (category-specific KPIs), Recent Activity Preview (last 5 events), Automation Relationship Map (visual diagram of connected data sources, tools, and notification channels), Quick Actions row (Run Now, View Logs, Edit Configuration).

Domain-specific overview components:

CategoryDomain-Specific Components
customer_supportTicket resolution feed, CSAT score card, response time metric, escalation rate
sales_lead_qualificationLead pipeline visualization, qualification rate, scoring distribution chart
finance_reconciliationReconciliation status indicator, anomaly count, match rate, flagged items count
risk_compliancePolicy violation feed, severity distribution chart, recent enforcement action log
data_analyst_insightsRecent queries list, report gallery thumbnails, key insight highlights
operations_monitoringSystem health mini-dashboard, active alert count, remediation action log
executive_decision_supportBrief gallery, cross-domain KPI summary cards, trend indicators
custom_enterpriseConfigurable widget layout; defaults to standard activity timeline if no widgets configured

Tab 2: Activity

Chronological event feed across all runs. Supported event types: run_started, run_completed, tool_executed, approval_requested, approval_resolved, config_changed, agent_paused, agent_resumed. Time filters: Last 24h, Last 7 days, Last 30 days, Custom range.

When the agent has an active run, new events append in real time via the /ws/agent-runs/{execution_id} WebSocket. Click any event to expand: full reasoning text, tool call arguments, observation, model used. Each event shows a trace link to the full run log.

Tab 3: Data Access

Grid of all connected data sources. Per-source detail: source name, type (PostgreSQL, Salesforce, REST, etc.), access level (read / read-write), connection status (live health indicator -- green / amber / red), last accessed timestamp. Expandable schema preview shows the table and column tree. Add / Remove source actions create a new draft agent version.

Tab 4: Governance

Current action level with full enforcement description. Active org-level and workspace-level policies listed by name and condition. Approval rules table (tool name, condition, approver group). Approval history table (timestamp, tool, status, approver, decision duration). Access control list (roles permitted to edit / deploy / approve / view this agent). Recent policy violations flagged during runs.

Tab 5: Monitoring

Time-series charts using Recharts: success rate trend (7-day area chart), latency distribution (p50 / p95 / p99 line chart), throughput in runs per hour (bar chart). Current health status indicator with contributing factors. Token consumption breakdown. Period comparison (current vs prior equivalent window).

Tab 6: Audit and Logs

Scoped execution history for this agent only. Same column structure as the global /agents/audit page but pre-filtered to agent_id={id}. Click any run row to drill down to the turn-by-turn log. Export scoped to this agent.

Tab 7: Settings

Editable fields: name, description, domain (saving any of these updates the agent record; does not create a new version). instruction_set editor -- saving creates a new draft version. Trigger configuration (add / edit / remove; includes a cron expression builder for scheduled triggers). Tool binding management (add / remove tools). Notification channel configuration per agent. Version history list with diff view between any two versions. Danger Zone section: Pause, Archive, Delete -- each with a confirmation modal. Archival is blocked if active runs exist unless force=true is passed.

API Calls

TriggerEndpointStore Update
Page mountGET /api/v1/agents/{id}agentStore.selectedAgent
Page mountGET /api/v1/agents/{id}/metrics?period=7dagentStore.selectedAgentMetrics
Activity tabGET /api/v1/agents/runs?agent_id={id}&limit=5executionStore.recentRuns
Governance tab -- ApprovalsGET /api/v1/agents/approvals?agent_id={id}approvalStore.approvals
Settings tab -- VersionsGET /api/v1/agents/{id}/versionsagentStore.versions
Run NowPOST /api/v1/agents/{id}/runsPrepends to executionStore.runs
Pause / Resume / ArchivePOST /api/v1/agents/{id}/{action}Optimistic update on agentStore.selectedAgent.status; confirmed or rolled back on response

Page 6: Template Library

Route: /agents/templates

Browsable catalog of built-in and user-defined agent templates.

+---------------------------------------------------------------+
| Header: "Agent Templates" + description |
| [Build from Scratch] |
+---------------------------------------------------------------+
| Search | Category Filter | [Grid / List Toggle] |
+---------------------------------------------------------------+
| Template Cards (Grid View): |
| +------------------+ +------------------+ |
| | Icon Name | | Icon Name | |
| | Category Badge | | Category Badge | |
| | Description | | Description | |
| | Integrations | | Integrations | |
| | Governance Level | | Governance Level | |
| | [View] [Use] | | [View] [Use] | |
| +------------------+ +------------------+ |
+---------------------------------------------------------------+

Feature Specification

FeatureBehavior
SearchFilters templates by name and description. Client-side on the loaded set; server-side refetch with ?search={q} for matches beyond the initial page.
Category FilterComboBox: All plus one option per agent_category value. Triggers GET /api/v1/templates?category={c}.
View ToggleGrid (card) and List (table) modes. Persisted to templateStore.viewMode.
Template Card (Grid)Icon, name, category badge, 2-line description, integration logos (max 3 shown + "+N more" label), governance level indicator, View Blueprint and Use Template buttons.
Template Row (List)Table columns: name + description, category, integrations, governance level, View Details and Use Template actions.
Use TemplateNavigates to /agents/create/guided?template={id}. No API call -- the wizard page handles the fetch on mount.
Build from ScratchHeader button navigating to /agents/create (Creation Entry).

Template Card Fields

FieldDescription
IconCategory-specific icon with colored background
NameTemplate name (e.g., "Customer Support Specialist")
CategoryBadge showing agent_category display label
DescriptionShort description of what the template configures (2 lines, truncated)
IntegrationsList of recommended data sources and tools (e.g., "Zendesk, Confluence +2")
GovernanceGovernance level text (e.g., "Act with Approval") with color indicator matching the action level risk scheme

API Calls

TriggerEndpointStore Update
Page mountGET /api/v1/templates?page=1&limit=20&status=publishedtemplateStore.templates
Category filterGET /api/v1/templates?category={c}Replaces templateStore.templates

Page 7: Template Detail

Route: /agents/templates/[id]

Full preview of a single template showing its configuration, capabilities, and connectivity requirements.

+---------------------------------------------------------------+
| Hero Section: |
| [<- Back] [Category Badge] |
| Template Name (large heading) |
| Full description paragraph |
| [Use This Template] |
+---------------------------------------------------------------+
| Mission Architecture: |
| What this agent does + Key objectives list |
+---------------------------------------------------------------+
| Capabilities Grid: |
| +-------------+ +-------------+ +-------------+ |
| | Icon + Name | | Icon + Name | | Icon + Name | |
| | Description | | Description | | Description | |
| +-------------+ +-------------+ +-------------+ |
+---------------------------------------------------------------+
| Connectivity Hub: |
| Data sources and tools organized by type |
+---------------------------------------------------------------+
| Deployment CTA: |
| [Use This Template] -- Est. setup time: ~5 min |
+---------------------------------------------------------------+

Section Specifications

SectionContent
HeroTemplate name, category badge, full description paragraph, primary "Use This Template" CTA.
Mission ArchitectureDetailed purpose statement, key objectives as a bulleted list, explanation of how the agent operates in the target business context.
Capabilities GridCards showing specific agent capabilities (e.g., "Ticket Triage", "Knowledge Retrieval", "Response Drafting"). Each card shows: icon, capability name, one-sentence description.
Connectivity HubAll required data sources and tools grouped by type (Databases, APIs, SaaS). Shows required access level per source (read / read-write) and whether the source is already connected in the user's workspace.
Deployment CTALarge "Use This Template" button linking to /agents/create/guided?template={id}, with an estimated setup time derived from the number of fields requiring customization.

API Calls

TriggerEndpointStore Update
Page mountGET /api/v1/templates/{id}templateStore.selectedTemplate

Page 8: System Monitoring

Route: /agents/monitoring

Platform-wide observability dashboard for the entire River Agents execution ecosystem.

+---------------------------------------------------------------+
| Header: "System Monitoring" |
+---------------------------------------------------------------+
| +----------+ +----------+ +----------+ +----------+ |
| | Active | | Total | | Avg | | Failure | |
| | Agents | | Runs 24h | | Latency | | Rate | |
| +----------+ +----------+ +----------+ +----------+ |
+---------------------------------------------------------------+
| System Throughput Chart (Area Chart -- runs/hour, last 24h) |
+---------------------------------------------------------------+
| Alert Stream (WS feed) | Cluster Health Table |
| severity | agent | msg | Instance | Status | CPU | Mem |
| timestamp | Uptime | Active Runs |
+---------------------------------------------------------------+

Feature Specification

FeatureBehavior
Top Metric Cards4 cards: Active Agents, Total Runs (24h), Average Latency (ms), Failure Rate (%). Auto-refreshes every 30 seconds via GET /api/v1/monitoring/summary.
System Throughput ChartRecharts AreaChart -- runs per hour over the last 24 hours. Areas stacked by status: completed (green), failed (red), running (blue). Data loaded via GET /api/v1/monitoring/throughput?period=24h.
Alert StreamReal-time feed subscribed via /ws/monitoring. Each alert shows: severity icon (info / warn / error), agent name if agent-scoped, message text, timestamp. Ordered by recency; maximum 50 entries visible before virtualized scrolling.
Cluster Health TableInfrastructure instances: Instance ID, status (healthy / degraded / critical), CPU %, Memory %, uptime, active run count. Loaded via GET /api/v1/monitoring/cluster. Refreshes every 60 seconds.

WebSocket behavior: This page subscribes to /ws/monitoring on mount and unsubscribes on unmount. Incoming run_started and run_completed events increment the metric card counts directly without triggering a full refetch. On WebSocket disconnect, the page falls back to polling GET /api/v1/monitoring/summary every 15 seconds.


Page 9: Runs Management

Route: /agents/runs

Cross-agent execution run history with filtering, inline approval actions, and the approval review modal.

+---------------------------------------------------------------+
| Header: "Agent Runs" |
+---------------------------------------------------------------+
| +----------+ +----------+ +----------+ +----------+ |
| | Total | | Completed| | Failed | | Pending | |
| | Runs | | | | | | Approval | |
| +----------+ +----------+ +----------+ +----------+ |
+---------------------------------------------------------------+
| Search Bar | Status Filter | Time Range Filter |
+---------------------------------------------------------------+
| Run ID | Agent | Status | Trigger | Duration | Time | Actions|
| (table rows with pagination) |
+---------------------------------------------------------------+

Feature Specification

FeatureBehavior
Stats Cards4 cards: Total Runs, Completed (with success %), Failed (with failure %), Pending Approval (count). Loaded via GET /api/v1/agents/runs/summary.
SearchSearch by run ID prefix or agent name. Triggers server-side refetch.
Status FilterOptions: All, Running, Completed, Failed, Pending Approval. Maps to execution_status enum values.
Time Range FilterPresets: Last 24h, Last 7 days, Last 30 days. Custom date range picker.
Runs TableColumns: Run ID (monospace, truncated, copy button), Agent (icon + name), Status badge (color-coded), Trigger type badge, Duration, Timestamp, Actions.
Context ActionsActions per row vary by status; see the Status-Based Action Matrix below.
Approval Review ModalOpened by the "Review" action on approval_pending rows. See modal spec below.

Status-Based Action Matrix

StatusAvailable Actions
runningStop (emergency halt via POST /api/v1/agents/runs/{id}/stop)
completedView Details (navigates to /agents/runs/{id})
failedRetry (POST /api/v1/agents/runs/{id}/retry), View Details
approval_pendingReview (opens Approval Modal), View Details

Approval Review Modal

+----------------------------------------------+
| Approval Required |
| |
| Agent: [Agent Name] |
| Run ID: [EXEC-123] |
| |
| Proposed Action: |
| Tool: update_crm |
| Arguments: { id: 123, status: "high" } |
| |
| Agent Reasoning: |
| "Based on enrichment data, this lead |
| qualifies as high-value enterprise..." |
| |
| Risk Context: |
| No policy violations detected. |
| |
| [Edit Arguments] |
| [Reject] [Approve] |
+----------------------------------------------+

Edit and Approve path: Clicking "Edit Arguments" expands a JSON editor pre-populated with the proposed tool arguments. Saving this path submits PATCH /api/v1/approvals/{id} with { status: "APPROVED", modified_args: {...}, reviewer_note: "..." }. This path is used when the approver agrees with the action but wants to modify specific argument values before execution.

API Calls

TriggerEndpointStore Update
Page mountGET /api/v1/agents/runs?page=1&limit=20executionStore.runs
Page mountGET /api/v1/agents/runs/summaryexecutionStore.summary
Filter changeGET /api/v1/agents/runs?status={s}&from={t}&to={t}Replaces executionStore.runs
ApprovePATCH /api/v1/approvals/{id} { status: "APPROVED" }Updates approvalStore.approvals; updates matching executionStore.runs entry status
RejectPATCH /api/v1/approvals/{id} { status: "REJECTED", reviewer_note }Same store updates as approve
Edit and ApprovePATCH /api/v1/approvals/{id} { status: "APPROVED", modified_args }Same store updates as approve

Page 10: Run Detail

Route: /agents/runs/[id]

Full execution trace for a single agent run with a live-streaming, terminal-style log viewer.

+---------------------------------------------------------------+
| Breadcrumb: Agent Runs > [Run ID] |
+---------------------------------------------------------------+
| +-----------------------------+ +-------------------------+ |
| | [Icon] Agent Name | | Run Summary: | |
| | [Status Badge] [Run ID] | | Run ID | |
| | Trigger type | Timestamp | | Agent | |
| | [Retry] / [Stop] | | Status | |
| | | | Trigger | |
| | Duration | Trigger | | | Duration | |
| | Log Lines | Started | | Log Lines | |
| | | +------------------------+ |
| | Execution Log Viewer: | | Status Timeline: | |
| | 00:00.000 INFO [msg] | | [x] Queued | |
| | 00:00.142 INFO [msg] | | [x] Initialised | |
| | 00:01.540 WARN [msg] | | [x] Executing | |
| | 00:02.450 ERROR [msg] | | [ ] Completed | |
| +-----------------------------+ +------------------------+ |
+---------------------------------------------------------------+

Feature Specification

FeatureBehavior
Breadcrumb"Agent Runs > {run_id_truncated}" with back-navigation link to /agents/runs.
Hero CardAgent icon + name, large status badge, run ID, trigger type + timestamp. Action buttons: Retry (failed runs only), Stop (running runs only).
Stats Strip4 inline metrics: Duration, Trigger type, Log Lines count, Start time.
Execution Log ViewerScrollable, virtualized list of log entries. Each row: monospace timestamp (MM:SS.mmm), level badge (INFO -- blue / WARN -- amber / ERROR -- red), message text. Rows are hoverable. During active runs, new entries append at the bottom via WebSocket.
Auto-Scroll BehaviorViewer auto-scrolls to the bottom while the user has not manually scrolled up. If the user scrolls up, auto-scroll suspends and a "Jump to live" button appears pinned at the bottom.
Run Summary SidebarKey-value card: Run ID, Agent, Status, Trigger, Duration, Log Lines. Fixed position on screens wider than 1280px.
Status TimelineVertical timeline: Queued, Initialised, Executing, Completed (or Failed / Cancelled / Max Turns Exceeded). Filled circle for complete phases; empty circle for pending. Timestamps shown per phase.

Live Log Streaming

When selectedRun.status is running or approval_pending, this page subscribes to /ws/agent-runs/{execution_id}. WebSocket events map to log entry types:

WebSocket EventLog Entry Appended
turn_reasoningreasoning log entry with thinking text and token count
tool_calledtool_call log entry with tool name and arguments
tool_resulttool_result log entry with output and duration
approval_requestedapproval_requested log entry; renders an inline approval card in the log viewer
approval_resolvedapproval_resolved log entry
run_completedrun_completed entry; updates status badge; closes WebSocket
run_failedrun_failed entry; updates status badge; closes WebSocket

API Calls

TriggerEndpointStore Update
Page mountGET /api/v1/agents/runs/{id}executionStore.selectedRun
Page mountGET /api/v1/agents/runs/{id}/logsexecutionStore.logs
Retry actionPOST /api/v1/agents/runs/{id}/retryNavigates to new run's detail page on 202 response
Stop actionPOST /api/v1/agents/runs/{id}/stopUpdates executionStore.selectedRun.status to cancelled; closes WebSocket

Page 11: Workspace Settings

Route: /agents/settings

Workspace-level River Agents configuration organized in 6 tabs.

Tab Structure

Tab Specifications

Tab 1: General

SectionFields
Workspace IdentityWorkspace name, description, region and timezone
PreferencesDefault view mode (grid / list), default metrics time range, theme preference

Tab 2: Compute and Limits

SectionFields
ConcurrencyMax concurrent agent runs (slider with numeric input)
Turn LimitsDefault max_turns per execution
TimeoutsDefault per-tool timeout (seconds)
Rate LimitsAPI trigger rate limits (requests/minute), webhook ingestion limits
Resource QuotasMax agents per workspace, max runs per day, token budget per month

Tab 3: Governance

SectionFields
Default Action LevelDefault action_level applied to new agents created in this workspace
Global PoliciesOrg-wide governance policies that apply to all agents (read-only list for non-admins); policy editor for admins with WHEN/THEN condition expression builder
Network PerimetersAllowed outbound domains, IP restrictions

Tab 4: Access Control

SectionFields
MembersList of workspace members with current role
Role DefinitionsAdmin (full control), Editor (create and edit agents), Operator (run and approve), Viewer (read-only)
InviteInvite new members by email with role pre-assignment
Role AssignmentChange member roles; role changes take effect immediately

Tab 5: Notifications

SectionFields
Email ChannelsEmail targets for agent events
Slack ChannelsSlack workspace connection and channel mapping
Alert TriggersWhich events trigger notifications: run failure, approval needed, health degraded, policy violation, run completed
Digest SettingsDaily and weekly digest email schedule

Tab 6: API and Webhooks

SectionFields
API KeysGenerate and manage API keys for programmatic agent triggers. Table: key name, created date, last used, status (active / revoked), actions (copy / revoke). The key value is shown once at generation time -- not retrievable again.
Webhook SubscriptionsOutbound webhook configuration. Table: URL, subscribed events, status (active / failed / untested), last successful delivery, actions (edit / delete / send test payload).

API Calls

TriggerEndpointNotes
Page mountGET /api/v1/workspace/settingsPopulates all 6 tab sections from a single response
Save any tabPATCH /api/v1/workspace/settings with changed fieldsReturns full updated settings; settingsStore.settings is replaced
Generate API keyPOST /api/v1/workspace/api-keysReturns key value once; store in browser clipboard immediately
Revoke API keyDELETE /api/v1/workspace/api-keys/{id}Immediately invalidates; no undo
Create webhookPOST /api/v1/workspace/webhooksRequires URL and at least one subscribed event
Test webhookPOST /api/v1/workspace/webhooks/{id}/testSends a synthetic test payload to the registered URL; response shows delivery status

Page 12: Audit and Logs

Route: /agents/audit

Immutable audit trail for the workspace with full-text search, filtering, and export. No edit or delete controls are rendered anywhere on this page; the API returns 405 Method Not Allowed for any mutation request against /api/v1/audit.

+---------------------------------------------------------------+
| Header: "Audit Trail" |
+---------------------------------------------------------------+
| +----------+ +----------+ +----------+ +----------+ |
| | Total | | Agent | | Security | | Policy | |
| | Events | | Actions | | Events | |Violations| |
| +----------+ +----------+ +----------+ +----------+ |
+---------------------------------------------------------------+
| Search | Agent Filter | Date Range | Event Type | [Grid/Table]|
| [Export] |
+---------------------------------------------------------------+
| Timestamp | Event Type | Agent | User | Action | Status |
| [Expand Detail -- full JSON payload] |
+---------------------------------------------------------------+
| Pagination |
+---------------------------------------------------------------+

Feature Specification

FeatureBehavior
Stats Cards4 cards: Total Events, Agent Actions (tool executions + run transitions), Security Events (auth events, access changes, permission denials), Policy Violations.
SearchFull-text search across event description, agent name, and user name. Server-side via ?q={text}.
Agent FilterComboBox listing all workspace agents. Filters events to a single agent.
Date RangePicker with presets: Last 24h, Last 7 days, Last 30 days, Last 90 days.
Event Type FilterOptions: All, Agent Actions, Security, Policy, System, Approvals. Maps to audit_event_type categories.
View ToggleTable view (detailed rows) and Grid view (card layout). Each entry shows the same data; layout only differs.
Audit TableColumns: Timestamp (ISO 8601), Event Type (color-coded badge), Agent, User, Action description, Status (success / failure / blocked).
Expandable RowClick any row to expand: full event payload rendered as formatted JSON, including tool arguments, response data, and reasoning context where available.
ExportGET /api/v1/audit/export with current filter state. Small exports (under 10,000 rows): direct file download. Large exports: queued delivery via email with an estimated wait time shown to the user.

Event Type Color Coding

Event TypeBadge ColorExamples
Agent ActionBlueTool executed, run started, run completed
SecurityRedAuthentication event, access control change, permission denied
PolicyOrangePolicy evaluated, policy violation, governance override
SystemGrayAgent created, agent deployed, configuration changed
ApprovalPurpleApproval requested, approved, rejected, expired

API Calls

TriggerEndpointStore Update
Page mountGET /api/v1/audit?page=1&limit=50auditStore.entries
Filter changeGET /api/v1/audit?type={t}&agent={id}&from={t}&to={t}&q={q}Replaces auditStore.entries
ExportGET /api/v1/audit/exportTriggers direct download or queued email

Real-Time Integration Architecture

WebSocket Endpoints

EndpointSubscribed ByEvents Received
/ws/agent-runs/{execution_id}Run Detail page, Agent Detail Activity tab (when a run is active)run_started, turn_reasoning, tool_called, tool_result, approval_requested, approval_resolved, run_completed, run_failed
/ws/monitoringSystem Monitoring page, Agent Library (metric card updates)run_started, run_completed, alert_triggered, cluster_health_updated
/ws/approvalsRuns Management page, Agent Detail Governance tabapproval_created, approval_resolved

All WebSocket connections are authenticated using the JWT subprotocol header: Sec-WebSocket-Protocol: Bearer {access_token}.

Connection Lifecycle

Reconnection policy: All WebSocket connections use exponential backoff on unexpected disconnect: initial retry at 1 second, doubling up to a 30-second maximum. After 5 consecutive failed reconnection attempts, the component renders an "Unable to stream live updates -- retrying..." banner and falls back to polling the equivalent HTTP endpoint at 10-second intervals. Intentional closes (component unmount) do not trigger reconnection.


State Management Architecture

Zustand Store Definitions

StoreOwnsKey State Fields
agentStoreAgent CRUD, list management, creation draftsagents[], selectedAgent, selectedAgentMetrics, versions[], filters, viewMode, wizardDraft, aiDraft, summaryMetrics
executionStoreRun list, active run state, live log streamruns[], selectedRun, logs[], filters, summary, wsConnected
approvalStoreApproval request managementapprovals[], selectedApproval, pendingCount
templateStoreTemplate browsing and selectiontemplates[], selectedTemplate, filters, viewMode
monitoringStoreSystem-wide metrics and alertsstatus, activeRuns[], pendingApprovals[], wsConnected
settingsStoreWorkspace settings statesettings, originalSettings, isDirty, saving
auditStoreAudit log browsing and exportentries[], filters, stats, exporting

Store Invalidation Rules

ActionInvalidates
Agent lifecycle transition (pause, deploy, archive)agentStore.selectedAgent, agentStore.agents (update in place)
Run completed (via WebSocket run_completed event)executionStore.runs, executionStore.selectedRun, agentStore.selectedAgentMetrics
Approval resolvedapprovalStore.approvals, approvalStore.pendingCount, executionStore.runs (update matching entry status)
Agent configuration updated (new version deployed)agentStore.selectedAgent, agentStore.versions
Settings tab savedsettingsStore.settings, settingsStore.originalSettings
Audit log viewedNo invalidation -- audit data is never mutated

API Integration Pattern

All frontend API calls route through one of three channels. No frontend component calls the Backend service (:8005) or river-agent microservice (:8007) directly. TLO Gateway is the sole entry point for all three channels.

ChannelBase URLAuthUse
HTTPTLO_GATEWAY_URL/api/v1Authorization: Bearer {jwt}All CRUD and query operations
FileSTORAGE_GATEWAY_URLPre-signed URL embedded in requestReport and export downloads
WebSocketTLO_GATEWAY_URL/wsSec-WebSocket-Protocol: Bearer {jwt}Real-time streaming

Implementation note: Engineers adding new frontend API calls must ensure the corresponding route is registered at TLO Gateway before the frontend feature ships. The frontend never bypasses TLO Gateway, even for internal service-to-service data (e.g., metrics from the monitoring service are exposed through TLO endpoints, not called directly).


User Journey Flows

Journey 1: First Agent Creation (AI Path)

Journey 2: First Agent Creation (Template Path)

Journey 3: Monitoring an Active Agent Run

Journey 4: Investigating a Failed Run