Hooks

useDocyrusAgentProjects

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

iOSAndroidExpo Go

Installation

pnpm dlx @docyrus/cli add @docyrus/rn-hooks-use-docyrus-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 DocyrusAgentProjectsView / DocyrusAgentSidebarProjectsSection.

Usage

import { DocyrusAgentProjectsView } from '@/components/docyrus-native/docyrus-agent';
import { useDocyrusAgentProjects } from '@/hooks/docyrus-native/use-docyrus-agent-projects';

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

API Reference

UseDocyrusAgentProjectsArgs

OptionTypeDefaultDescription
clientDocyrusAgentProjectsClient | 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

UseDocyrusAgentProjectsResult

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

On this page