Browser session
Shows what the agent did in a browser, the page's responses, and the outcome inside its reply.
Loading preview…
Install
- 1
Run this command in your Tailwind CSS project. It adds
components/ai/browser-session-default.tsxand installs its dependencies.$ npx shadcn@latest add https://gradientdeck.com/ai-components/r/browser-session-default.json
Usage & API
Example
import { BrowserSession } from "@/components/ai/browser-session-default"
<BrowserSession
site="…"
steps={[]}
status="running"
/>Props BrowserSession
| Prop | Type & description | Required |
|---|---|---|
site | string | Required |
steps | BrowserStep[] | Required |
status | "running" | "complete" | "failed" | Required |
summary | stringA brief result shown when the session is collapsed. | Optional |
url | stringOptional link to the page the agent worked on. | Optional |
defaultOpen | boolean | Optional |
Dependencies
- React
- Tailwind CSS
- lucide-react
Implementation notes
Browser session takes site, steps, status, and optional summary, url and defaultOpen. A step has id, label, status and optional detail. The header button toggles the list. Collapsed, a running visit shows the latest step whose status is running, or the last step, or Opening the page if there is nothing to show. A finished collapsed visit shows summary if you passed it, otherwise that same current label, otherwise No actions recorded. Open, every step is a row: a spinner, an alert, or a check, then label, then detail when it exists. Failed status on the session and failed status on a step are independent. A session can be running while one earlier step is already failed, if that is the array you pass.
Example
import { BrowserActionLog } from "@/components/ai/browser-session-action-log"
<BrowserActionLog
domain="…"
events={[]}
/>Props BrowserActionLog
| Prop | Type & description | Required |
|---|---|---|
domain | string | Required |
events | BrowserEvent[] | Required |
Dependencies
- React
- Tailwind CSS
- lucide-react
Implementation notes
Browser action log takes domain and events. The list is an ordered set of action plus detail. done shows a check, active shows a spinner, and pending shows an empty circle and omits detail even if you passed one. The live marker in the header does not read from event status. There is no clock, no screenshot and no link to the page. The domain is text, not a URL. Update the events array as the agent moves from pending to active to done.
Choosing a layout
Use the session when the agent opened a real site and the reply should say what it clicked and what the page said back. detail is the place for that observation: a settings label it found, a confirmation the page showed, a URL it landed on. summary is the one line a collapsed, finished visit leaves behind, so the thread can stay short. Open the list when the path matters. Keep a failed step's detail, because a stopped visit with only a status icon does not say which action failed.
Use the action log when you know the upcoming actions and want them visible before they run. pending is that future row. The session list does not have a pending status. Its steps are done, running or failed, and a step you have not started yet simply is not in the array. Do not use either layout for a web search. Search results are pages the agent found, not clicks inside one product. A tool call can record a browser tool's raw payload when you need the arguments, but it will not read as a visit.
What is the difference between summary and a step's detail?
detail belongs to one step and is shown under that step's label when the session is open. summary is a single line for the whole visit, shown only when the session is collapsed and status is not running. A running collapsed session ignores summary and shows the current step label instead. Leave summary out and a finished collapsed session falls back to the last step's label.
How do I show steps the agent has not taken yet?
Use the action log and set those events to pending. The action stays visible and detail stays hidden. The session variant has no pending value. Omit steps you have not started, then append them, usually first as running and later as done or failed.