Skip to Content
Hooks

useKivaAgentInfo

Fetches a Kiva AI agent's profile, suggestions and capabilities from the agent-deployment endpoint and maps them onto the KivaAgent props.

iOSAndroidExpo Go

Installation

pnpm dlx @kivacore/ui-cli add @kivacore/rn-hooks-use-kiva-agent-info
Required Packages(1 package)
pnpm add @tanstack/react-query

A verbatim port of the web hook. It reads GET /v1/ai/agent-deployments/base/{agentId} (or /v1/ai/agent-deployments/{deploymentId}) and returns an AgentProfile (name, description, welcome message, avatar), the agent's standard suggestions, and its feature capabilities, ready to spread onto KivaAgent. A QueryClientProvider must be mounted above it.

Usage

import { KivaAgent } from '@/components/kiva-native/kiva-agent';
import { useKivaAgentInfo } from '@/hooks/kiva-native/use-kiva-agent-info';

function Assistant({ client }) {
  const { agent, suggestions, capabilities } = useKivaAgentInfo({ client, agentId: AGENT_ID });

  if (!agent) return null;

  return <KivaAgent agent={agent} suggestions={suggestions} capabilities={capabilities} />;
}

API Reference

UseKivaAgentInfoArgs

OptionTypeDefaultDescription
clientKivaAgentInfoClient | null | undefined-Client with a get(url, params?) method (e.g. RestApiClient)
agentIdstring | nullnullTenant AI agent ID (base deployment)
deploymentIdstring | nullnullRead a specific deployment instead of the base record
enabledboolean!!client && (agentId || deploymentId)Toggle the query

UseKivaAgentInfoResult

FieldTypeDescription
agentAgentProfile | nullMapped profile, null until loaded
suggestionsstring[]standardSuggestions of the agent
capabilitiesAgentCapabilitiessupportFiles, supportWebSearch, supportDocumentSearch (backend documentSearch), supportThinking, supportDeepResearch, supportWorkCanvas (backend featureWorks), supportMultipleModels, promptOptimizationChoice
rawKivaAgentDeploymentEnvelope | nullRaw deployment payload
isLoadingbooleanQuery loading flag
errorError | nullQuery error
refresh() => Promise<void>Refetch

Query key: ['kiva-agent', 'info', deploymentId ?? 'base:<agentId>'] (same as web).

On this page