UI componentsHooks
usePerformance
Extracts metrics + the MetricsSummary roll-up from the current session. Used by all the chart components to build their data series.
Signature
usePerformance(): { metrics, summary }Installation
pnpm dlx agent-observability-ui@latest add observability-hooksnpx agent-observability-ui@latest add observability-hooksyarn dlx agent-observability-ui@latest add observability-hooksbunx --bun agent-observability-ui@latest add observability-hooksUsage
import { usePerformance } from '@/lib/observability-hooks'
function ToolCallCount() {
const { summary } = usePerformance()
if (!summary) return null
return <span>{summary.total_tool_calls} tool calls</span>
}Returns
{ metrics: SessionMetrics | null, summary: MetricsSummary | null }useTranscript
Returns the structured turns, the raw chat history, and the highlighted-turn state — the data the built-in TurnTranscriptSection consumes.
useEvents
Raw session events (function calls, agent_state_changed, speech_created, etc.) as captured by the SDK. Returns null if the provider has not loaded a session yet.