Hooks
Hooks let you use different React features from your components. You can either use the built-in Hooks or combine them to build your own. This page lists all built-in Hooks in usdk.
useAgent
Returns the current `Agent` context.
useAuthToken
Returns the current authentication token.
useCachedMessages
Returns cached messages for the current conversation, with optional filtering. Automatically handles loading and updates.
useConversation
Returns the current `Conversation`.
useConversations
Returns the array of conversations the `Agent` is currently participating in.
useEnv
Returns the environment variables from your `.env.txt` file.
useEnvironment
Returns the current environment - `'development'` or `'production'`.
useKv
Returns the key-value storage interface from the AppContext.
useName
Returns the agent's name, prioritizing the registry name over the agent's default name.
useNumMessages
Returns the total number of cached messages in the current conversation.
usePersonality
Returns the agent's personality/bio, prioritizing the registry personality over the agent's default bio.
useTts
Returns a memoized text-to-speech interface with optional voice endpoint and sample rate configuration.