# useDocyrusAgentProjects URL: /docs/native/hooks/use-docyrus-agent-projects Lists, creates, renames and deletes Docyrus AI projects scoped to an agent. ## Installation ```bash pnpm dlx @docyrus/cli add @docyrus/rn-hooks-use-docyrus-agent-projects ``` **Dependencies:** - [@tanstack/react-query](https://www.npmjs.com/package/@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 ```tsx 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 | Option | Type | Default | Description | |--------|------|---------|-------------| | `client` | `DocyrusAgentProjectsClient \| null \| undefined` | - | Client with `get` / `post` / `patch` / `delete` | | `agentId` | `string` | - | Tenant AI agent ID (required) | | `userId` | `string \| null` | `null` | Only projects owned by / shared with this user | | `enabled` | `boolean` | `!!client` | Toggle the list query | ### UseDocyrusAgentProjectsResult | Field | Type | Description | |-------|------|-------------| | `projects` | `DocyrusAgentProject[]` | `{ id, name, description?, agentId?, deploymentId?, createdBy?, sharedTo? }` | | `isLoading` / `error` | `boolean` / `Error \| null` | List query state | | `refresh` | `() => Promise` | Invalidate the list | | `createProject` | `(input: CreateProjectInput) => Promise` | `{ name, description? }` | | `isCreating` | `boolean` | Create pending | | `renameProject` | `(projectId, name) => Promise` | Rename | | `isRenaming` | `boolean` | Rename pending | | `deleteProject` | `(projectId) => Promise` | Delete | | `isDeleting` | `boolean` | Delete pending |