Skip to content

Reasoning

Reveals the thinking of an agent and how long it took.

reasoning-demo.tsx

Installation

The CLI adds the files, packages, theme variables, and Tailwind plugin that this component uses. Before you run it, set up your project.

Composition

  • Reasoning

    Owns the open state and the duration count. Set status, duration, and autoCollapse on it.

    • ReasoningTrigger

      Shows the state and the duration.

    • ReasoningPanel

      Set scrollable to cap the body height and scroll it. The newest line stays in view while the run is thinking.

Auto collapse

The panel collapses when the run ends and expands for a new run.

Checking the two options against the load numbers in the issue.
reasoning-auto-collapse-demo.tsx

Error

Reasoning failed

The provider stopped responding before the model finished. Retry the request.
reasoning-error-demo.tsx

Long reasoning

Set scrollable to cap the panel at 16rem.

Thought for 24s

The request touches three parts of the system. First, the schema change is additive, so old clients keep working. Second, the read path can stay on the current index if the new filter is pushed down.

Next I should check the write path. The new column is nullable, so the migration does not need a backfill. The batch job writes it after the fact.

Finally, the rollout order matters. Deploying the reader first means the writer can land later without a flag.

I also checked the failure modes. If the reader lands first and the column is missing, the query falls back to the old path. The logs record which path answered, so the cutover is observable.

That covers the plan. The remaining risk is the batch window on the read replica, which the maintenance page already explains.

reasoning-long-demo.tsx

API reference

vip/ui adds or changes the props below. For all other props, see React Aria Disclosure (opens in a new tab).

Reasoning

status: "thinking" | "complete" | "error"Required
Sets the trigger text and icon. Thinking animates unless reduced motion is on.
duration: number
Seconds of reasoning. Without it, a thinking run counts its own time and the count stops when the run ends. 60 seconds or more show as minutes and seconds.
autoCollapse: boolean = false
Collapses the panel when the status leaves thinking, and expands it when a new run starts. Set isExpanded to control the panel yourself.
defaultExpanded: boolean
Opens the panel at first. The default is open while status is thinking.
isExpanded: boolean
Controls the panel.
onExpandedChange: (isExpanded: boolean) => void
Receives requests to open or close the panel.

ReasoningPanel

scrollable: boolean = false
Caps the body at 16rem and makes it scrollable and focusable from the keyboard.
autoScroll: boolean = true
Keeps the newest line in view while a scrollable panel is thinking. Scroll up to pause it, and scroll to the end to start it again.