Skip to Content
Hooks

useKivaAgentProjects

Lists, creates, renames and deletes Kiva AI projects scoped to an agent.

iOSAndroidExpo Go

Installation

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

A verbatim port of the web hook. Endpoints: GET /v1/ai/projects, POST /v1/ai/projects ({ name, description?, tenant_ai_agent_id }), PATCH /v1/ai/projects/{id} ({ name }), DELETE /v1/ai/projects/{id}. The list is filtered client-side to the agent (and to userId when given). Pair it with KivaAgentProjectsView / KivaAgentSidebarProjectsSection.

Usage

import { KivaAgentProjectsView } from '@/components/kiva-native/kiva-agent';
import { useKivaAgentProjects } from '@/hooks/kiva-native/use-kiva-agent-projects';

const { projects, createProject, deleteProject } = useKivaAgentProjects({ client, agentId: AGENT_ID });

API Reference

UseKivaAgentProjectsArgs

OptionTypeDefaultDescription
clientKivaAgentProjectsClient | null | undefined-Client with get / post / patch / delete
agentIdstring-Tenant AI agent ID (required)
userIdstring | nullnullOnly projects owned by / shared with this user
enabledboolean!!clientToggle the list query

UseKivaAgentProjectsResult

FieldTypeDescription
projectsKivaAgentProject[]{ id, name, description?, agentId?, deploymentId?, createdBy?, sharedTo? }
isLoading / errorboolean / Error | nullList query state
refresh() => Promise<void>Invalidate the list
createProject(input: CreateProjectInput) => Promise<KivaAgentProject | null>{ name, description? }
isCreatingbooleanCreate pending
renameProject(projectId, name) => Promise<boolean>Rename
isRenamingbooleanRename pending
deleteProject(projectId) => Promise<boolean>Delete
isDeletingbooleanDelete pending

On this page