UI componentsHooks
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.
Signature
useEvents(): SessionEvent[] | nullInstallation
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 { useEvents } from '@/lib/observability-hooks'
function FunctionCallCount() {
const events = useEvents()
const n = events?.filter((e) => e.type === 'function_call').length ?? 0
return <span>{n} tool invocations</span>
}Returns
SessionEvent[] | nullusePerformance
Extracts metrics + the MetricsSummary roll-up from the current session. Used by all the chart components to build their data series.
useOptions
Snapshot of the agent configuration captured with the session — model IDs, voice settings, tool list, runtime options. Returns null before load.