---
title: "Agent Versions hooks"
description: "Hand-written shim. Generated CRUD hooks via ./agent-versions.gen.
useForkAgentVersion + useSetDefaultAgentVersion stay hand-written."
section: "Libraries"
group: "React hooks"
order: 400
---

## Hooks

### `useCreateAgentVersion` `mutation`

Create an ADDITIONAL version of an existing agent. The initial v1 is created automatically by `createAgent` — do NOT call this right after `createAgent`. Use this only when you actually need a v2+, or use `forkAgentVersion` to branch from a specific version.

```ts
useCreateAgentVersion(options?: MutationOpts<AgentVersion, CreateAgentVersionParams>)
```

**Types:** [AgentVersion](/types/agent-version) · [CreateAgentVersionParams](/types/create-agent-version-params)

### `useDeleteAgentVersion` `mutation`

Soft-delete an agent version.

```ts
useDeleteAgentVersion(options?: MutationOpts<SuccessResponse, string>)
```

**Types:** [SuccessResponse](/types/success-response)

### `useForkAgentVersion` `composite`

```ts
useForkAgentVersion(options?: MutationOpts<AgentVersion, ForkAgentVersionParams>)
```

**Types:** [AgentVersion](/types/agent-version) · [ForkAgentVersionParams](/types/fork-agent-version-params)

### `useListAgentVersions` `query`

List agent versions.

```ts
useListAgentVersions(params?: Omit<ListAgentVersionsParams, | > & { filter?: AgentVersionFilter; orderBy?: AgentVersionOrderBy[]; } & AgentVersionShorthands, options?: QueryOpts<Page<AgentVersion>>)
```

**Types:** [ListAgentVersionsParams](/types/list-agent-versions-params) · [AgentVersionFilter](/types/agent-version-filter) · [AgentVersionOrderBy](/types/agent-version-order-by) · [AgentVersionShorthands](/types/agent-version-shorthands) · [Page](/types/page) · [AgentVersion](/types/agent-version)

### `usePurgeAgentVersion` `composite`

Permanently delete a soft-deleted agent version.

```ts
usePurgeAgentVersion(options?: MutationOpts<SuccessResponse, PurgeAgentVersionParams>)
```

**Types:** [SuccessResponse](/types/success-response) · [PurgeAgentVersionParams](/types/purge-agent-version-params)

### `useRestoreAgentVersion` `composite`

Restore a soft-deleted agent version.

```ts
useRestoreAgentVersion(options?: MutationOpts<AgentVersion, string>)
```

**Types:** [AgentVersion](/types/agent-version)

### `useRetrieveAgentVersion` `query`

Get an agent version by ID.

```ts
useRetrieveAgentVersion(id: string, options?: QueryOpts<AgentVersion>)
```

**Types:** [AgentVersion](/types/agent-version)

### `useSetDefaultAgentVersion` `composite`

```ts
useSetDefaultAgentVersion(options?: MutationOpts<Agent, SetDefaultAgentVersionParams>)
```

**Types:** [Agent](/types/agent) · [SetDefaultAgentVersionParams](/types/set-default-agent-version-params)

### `useUpdateAgentVersion` `mutation`

Update an agent version.

```ts
useUpdateAgentVersion(options?: MutationOpts<AgentVersion, UpdateAgentVersionParams>)
```

**Types:** [AgentVersion](/types/agent-version) · [UpdateAgentVersionParams](/types/update-agent-version-params)
