Agent Thinking
agent-thinkingThe line above a chat composer while an agent works: a loader, the current activity under a sweep of light, an elapsed timer and a Stop button. Each new activity becomes a timed step you can unfold, and it finishes as “Worked for 14.2s”.
"use client";
import { useEffect, useState } from "react";
import { Button } from "@/components/forme/button/button";
import { ChatMessage } from "@/components/forme/chat-message/chat-message";
import { AgentThinking } from "@/components/forme/blocks/agent-thinking/agent-thinking";
const script = [
{ activity: "Thinking", ms: 1400 },
{ activity: "Searching the docs for “proration”", ms: 1800 },
{ activity: "Reading billing/plans.ts", ms: 1500 },
{ activity: "Reading billing/invoices.ts", ms: 1300 },
{ activity: "Drafting the change", ms: 2000 },
];
/** A stand-in for an agent's status stream. Yours would arrive over SSE or a socket. */
export function AgentThinkingDemo() {
const [run, setRun] = useState(0);
const [step, setStep] = useState(0);
const [stopped, setStopped] = useState(false);
const done = stopped || step >= script.length;
useEffect(() => {
if (done) return;
const timer = setTimeout(() => setStep((current) => current + 1), script[step]!.ms);
return () => clearTimeout(timer);
}, [step, done]);
function restart() {
setStep(0);
setStopped(false);
setRun((current) => current + 1);
}
return (
<div className="mx-auto flex w-full max-w-xl flex-col gap-5">
<ChatMessage from="user">Can we prorate plan upgrades mid-cycle?</ChatMessage>
<AgentThinking
key={run}
activity={script[Math.min(step, script.length - 1)]!.activity}
done={done}
onStop={() => setStopped(true)}
/>
{done ? (
<ChatMessage from="assistant" className="animate-enter">
{stopped
? "Stopped. Ask again whenever you are ready."
: "Yes. Upgrades already compute the remaining days in plans.ts; invoices.ts only needs to bill the difference instead of the full price. I have drafted that change."}
</ChatMessage>
) : null}
<Button variant="secondary" size="small" className="self-start" onClick={restart}>
Run again
</Button>
</div>
);
}Install
Adds the component, its registry dependencies, and the token stylesheet you import once.
API reference
Read from the source, so it is the API of the file you install. A prop marked * is required.
AgentThinking
The line above a chat composer while an agent works: what it is doing, for how long, and — one click away — everything it has done so far.
| Prop | Type | Default | Description |
|---|---|---|---|
activity* | string | — | What the agent is doing right now: "Reading billing.ts", "Searching the docs". Every change is kept as a step in the trail. |
done | boolean | false | True once the agent has finished. The timer stops and the row becomes a summary. |
variant | 'ring' | 'dots' | 'bars' | 'wave' | 'orbit' | 'braille' | 'infinity' | 'sparkle' | "wave" | The indicator beside the activity. |
onStop | () => void | — | Shows a Stop button while the agent works. |
className | string | — |
Related


Agent Log
What an agent did, as a tree that draws itself: each step opens its own height, the guide strokes out to it, and nested results branch beneath. Pure CSS, so it is a server component.
ai
ProPlan
The plan an agent proposes before it acts: a title, the approach, and numbered steps with the files each touches. It streams in with a waiting line for the next step, and offers Build and Revise only once it is complete.
ai

Agent Composer
The compact composer of an agent app: a rounded field with round controls flush inside, send that becomes stop in place, a light that runs round the edge while the agent works, and a status row beneath.
ai