useAgent
function useAgent(session?): UseAgentReturn;Defined in: packages/react/src/hooks/session/useAgent.ts:28
Note. This feature is under active development and may change based on developer feedback and real-world usage. useAgent encapculates all agent state, normalizing some quirks around how remote voice agents work.
Parameters
| Parameter | Type |
|---|---|
session? | unknown |
Returns
Example
const { agent, state } = useAgent();
return <button disabled={state !== "speaking"} onClick={() => agent.interrupt()}>Interrupt</button>;