# Agent run

Follow an agent's steps, inspect details and handle cancellation or retry.

Access: pro. Category: Blocks. Kind: composite.

## When to use

- Use it when a page needs follow an agent's steps, inspect details and handle cancellation or retry.
- Choose it inside an authenticated product surface when the host application owns routing, persistence, and service calls.

## Alternatives

- Choose empty-state instead when empty collections, search results and errors with a clear next action is the actual interface need, rather than agent run.

## Setup for agents

Use React 19 and TypeScript. Initialize shadcn for your framework, then merge this exact entry into components.json:

```json
{
  "registries": {
    "@tidal-pro": {
      "url": "https://tidalui.com/r/pro/{name}.json",
      "headers": {
        "Authorization": "Bearer ${TIDALUI_TOKEN}"
      }
    }
  }
}
```

The namespace must be named **@tidal-pro** because transitive Pro dependencies use that namespace. Obtain an agent key from your active Pro account at https://tidalui.com/account. Keep TIDALUI_TOKEN in your local environment, never in components.json, client code, Git or logs.

```sh
export TIDALUI_TOKEN='your-private-agent-key'
npx shadcn@latest add @tidal-pro/waitlist-form
npx shadcn@latest add https://tidalui.com/r/tidal-button.json
```

Free command: `npx shadcn@latest add https://tidalui.com/r/<name>.json`.
Pro command: `npx shadcn@latest add @tidal-pro/<name>`.

Import the base stylesheet and every stylesheet listed on the installed item's metadata. For example:

```tsx
import "./components/ui/tidal.css";
import "./components/ui/hero-section.css";
// Place installed components inside this wrapper:
<div className="tidal-scope" data-theme="dark">...</div>
```

Omit data-theme for the default light theme. Put the attribute on the same tidal-scope element for dark mode. Every component installs the shared free tidal-base dependency. After upgrading, run `npx shadcn@latest add https://tidalui.com/r/tidal-base.json --overwrite` to receive current tokens. Review local modifications before overwriting.

Vite: Use React + TypeScript. Map @/* to ./src/* in paths and Vite resolve.alias. Import tidal.css and each component stylesheet in your application entry.

Next.js 15 App Router: Next.js App Router: import tidal.css and component CSS in app/layout.tsx. Interactive examples belong in a client component with "use client". Map @/* to ./* or ./src/* to match your project.

TypeScript 6: use paths without baseUrl:

```json
{
  "compilerOptions": {
    "paths": {
      "@/*": [
        "./src/*"
      ]
    }
  }
}
```

Pro registry requests are server/CLI-only. Use the same-origin account interface in a browser; cross-origin Authorization preflights are intentionally unsupported.


## Install Agent run

```sh
npx shadcn@latest add @tidal-pro/agent-run
```

Stylesheets: `components/ui/tidal.css`, `components/ui/agent-run.css`.

## Minimal example

```tsx
import"./components/ui/tidal.css";
import"./components/ui/agent-run.css";
import{TidalAgentRun}from"./components/ui/agent-run";
export default()=><div className="tidal-scope"><TidalAgentRun status={"queued"} steps={[{id:"example",label:"Demo",status:"pending"}]} title={"Demo"}/></div>;
```

## Structured props

- `TidalAgentRun.status: TidalRunStatus`: Required status value accepted by this exported component.
- `TidalAgentRun.steps: ReadonlyArray<TidalRunStep>`: Required steps value accepted by this exported component.
- `TidalAgentRun.title: ReactNode`: Required title value accepted by this exported component.
- `TidalAgentRun.announceUpdates?: boolean | undefined` (default false): Optional announce updates value accepted by this exported component.
- `TidalAgentRun.cancelButtonProps?: Omit<Omit<DetailedHTMLProps<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref">, "type" | "children"> | undefined` (default {}): Optional cancel button props value accepted by this exported component.
- `TidalAgentRun.children?: ReactNode`: Optional children value accepted by this exported component.
- `TidalAgentRun.description?: ReactNode`: Optional description value accepted by this exported component.
- `TidalAgentRun.disabled?: boolean | undefined` (default false): Optional disabled value accepted by this exported component.
- `TidalAgentRun.elapsedText?: ReactNode`: Optional elapsed text value accepted by this exported component.
- `TidalAgentRun.emptyMessage?: ReactNode` (default "No steps yet."): Optional empty message value accepted by this exported component.
- `TidalAgentRun.headingLevel?: "h2" | "h3" | "h4" | "h5" | "h6" | undefined` (default "h3"): Optional heading level value accepted by this exported component.
- `TidalAgentRun.onCancel?: ((event: MouseEvent<HTMLButtonElement>) => void) | undefined`: Callback invoked when the cancel interaction is proposed.
- `TidalAgentRun.onRetry?: ((event: MouseEvent<HTMLButtonElement>) => void) | undefined`: Callback invoked when the retry interaction is proposed.
- `TidalAgentRun.retryButtonProps?: Omit<Omit<DetailedHTMLProps<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref">, "type" | "children"> | undefined` (default {}): Optional retry button props value accepted by this exported component.
- `TidalAgentRun.statusNote?: ReactNode`: Optional status note value accepted by this exported component.

## Complete usage example

[Source](https://tidalui.com/examples/agent-run.tsx) | [Manifest](https://tidalui.com/examples/agent-run.json). Install the listed additional dependencies. Consumer fixture: TypeScript pass; Vite pass. This fixture check is distinct from the actual shadcn install receipt.

```tsx
"use client";

import "./components/ui/tidal.css";

import { useLayoutEffect, useRef, useState } from "react";

import { TidalAgentRun, type TidalRunStatus, type TidalRunStep } from "./components/ui/agent-run";

import "./components/ui/agent-run.css";

import "./components/ui/status-badge.css";

import "./components/ui/progress.css";

import "./components/ui/collapsible-panel.css";



const tidalExampleStyles = ".tidal-scope .agent-run-demo {\n  width: min(100%, 640px);\n  max-width: 640px;\n  min-width: 0;\n}\n.tidal-scope .agent-run-demo-controls {\n  display: flex;\n  gap: 8px;\n  flex-wrap: wrap;\n  margin-top: 16px;\n}\n.tidal-scope .agent-run-demo-controls button {\n  min-height: 44px;\n  padding: 10px 14px;\n  border: 1px solid var(--t-border);\n  border-radius: 9px;\n  background: var(--t-surface);\n  color: var(--t-ink);\n  font: inherit;\n  font-size: 12px;\n}\n.tidal-scope .agent-run-demo-controls button:disabled {\n  opacity: 0.45;\n}";

export function AgentRunDemo() {
  const advance = useRef<HTMLButtonElement>(null),
    run = useRef<HTMLElement>(null);
  const [status, setStatus] = useState<TidalRunStatus>("running"),
    [step, setStep] = useState(1);
  useLayoutEffect(() => {
    if (status === "completed" && document.activeElement === advance.current)
      run.current
        ?.querySelector<HTMLElement>(".tidal-agent-run-note")
        ?.focus({ preventScroll: true });
  }, [status]);
  const labels = [
    "Read project notes",
    "Review open tasks",
    "Prepare a summary",
  ];
  const steps: TidalRunStep[] = labels.map((label, i) => ({
    id: String(i),
    label,
    status:
      status === "completed" || i < step
        ? "completed"
        : i === step && status === "running"
          ? "running"
          : "pending",
    description: ["3 sample documents", "5 sample tasks", "Markdown report"][i],
    content: [
      "Release notes, design review and launch checklist.",
      "Two sample tasks need an owner before launch.",
      "The sample report is ready for review.",
    ][i],
  }));
  return (
    <div className="agent-run-demo">
      <TidalAgentRun
        ref={run}
        title="Prepare project summary"
        description="Review notes and open tasks for the next project update."
        status={status}
        steps={steps}
        elapsedText="Sample run"
        statusNote={
          status === "completed"
            ? "Sample summary complete."
            : status === "cancelled"
              ? "Sample run cancelled."
              : "Local preview. No agent is running."
        }
        onCancel={() => setStatus("cancelled")}
        onRetry={() => {
          setStatus("running");
          setStep(1);
        }}
      >
        {status === "completed" ? (
          <p>Two tasks need an owner. The mobile review is complete.</p>
        ) : undefined}
      </TidalAgentRun>
      <div className="agent-run-demo-controls">
        <button
          ref={advance}
          disabled={status !== "running"}
          onClick={() => {
            if (step < 2) setStep(step + 1);
            else setStatus("completed");
          }}
        >
          Advance sample
        </button>
        <button
          onClick={() => {
            setStatus("running");
            setStep(1);
          }}
        >
          Reset
        </button>
      </div>
    </div>
  );
}

export default function AgentExample() {
  return (
    <div className="tidal-scope" data-theme="light" dir="ltr">
      <style>{tidalExampleStyles}</style>
      <AgentRunDemo />
    </div>
  );
}

```

## Gotchas

- The host application owns data, validation, persistence, navigation, and service side effects described by this API.

## Theme and accessibility

{"tokens":["--t-accent","--t-border","--t-border-strong","--t-canvas","--t-danger","--t-display","--t-ease-out","--t-ease-spring","--t-faint","--t-font","--t-ink","--t-line","--t-muted","--t-primary","--t-primary-contrast","--t-radius-card","--t-radius-control","--t-radius-overlay","--t-radius-panel","--t-ring","--t-shadow-lg","--t-shadow-soft","--t-soft","--t-subtle","--t-surface","--t-wash"],"darkMode":true}

{"keyboard":["Tab and Shift+Tab follow the component's native focus order."],"aria":"The component wires labels and relationships from consumer-provided visible text or ARIA props; preserve those labels in production.","notes":"Verify focus visibility, text alternatives, contrast, and reduced motion in the final composition."}

Consumer-owned status (queued, running, completed, failed, cancelled), title, headingLevel (h3 default, h2-h6 supported) and stable-id steps (pending, running, completed, failed, skipped). Optional description, elapsedText, statusNote, output children, emptyMessage, disabled (cancel/retry actions only; step inspection stays available) and announceUpdates (false by default). Steps with content compose native Collapsible panel; steps without content stay plain noninteractive rows. The active step exposes aria-current=step. Progress counts completed and skipped steps without claiming elapsed time or work estimates. Cancel appears for queued/running and Retry for failed/cancelled only when callbacks exist. Native action handlers run first and can prevent higher callbacks; disabled and aria-disabled normalize; action types remain button. Only an actually focused action being removed or disabled recovers focus to the persistent note; declined actions do not retain stale focus intent. Consumers own execution, transport, logs, artifacts, status consistency and side effects.
