# buildUserPrompt
Source: https://docs.maelstrom-ai.co/dev/reference/planner-llm/functions/builduserprompt/
Documentation revision: 89a8f5e9d10cedcf0b30376d7846113f06f26120
SDK manifests in this build: @maelstrom-co/react@0.2.1, @maelstrom-co/client@0.2.1, @maelstrom-co/connectors@0.2.1, @maelstrom-co/protocol@0.2.1, @maelstrom-co/engine@0.2.1
These docs follow this source revision. Manifest versions do not prove release compatibility; verify the installed package exports before using an API.

> **buildUserPrompt**(`request`, `options?`, `logger?`): `string`

Defined in: [packages/planner-llm/src/lib/prompt/prompt-builder.ts:148](https://github.com/maelstrom-co/maelstrom/blob/89a8f5e9d10cedcf0b30376d7846113f06f26120/packages/planner-llm/src/lib/prompt/prompt-builder.ts#L148)

Build the user-prompt half from a chart request.

Per-call work — depends on the request’s vessels, instances, layout, and update reasons, so the result can’t be precomputed.

This standalone API constructs its own enum snapshot. `llmPlanner` instead reuses the enum snapshot the Engine captured for the request (`StageContext.enumSnapshot`), so prompt literals and validation share the exact candidates.

## Parameters

### request

`ChartRequest`

### options?

`Pick`<[`PromptOptions`](https://docs.maelstrom-ai.co/dev/reference/planner-llm/interfaces/promptoptions/), `"user"`\>

### logger?

`Logger`

## Returns

`string`

## Throws

If Action parameter definitions are ambiguous or exceed the enum-candidate ceiling, or if a `user` customizer is invalid (function targeting a non-default key) or itself throws. Customizer messages have the form `Prompt section customizer for "<key>" ...`. Callers operating inside a `Promise<Result>` contract should wrap in try/catch and convert to a Result error rather than letting the throw escape.

## Example

```ts
const userPrompt = buildUserPrompt(request, {
  user: { vessels: (defaults) => `${defaults}\n\nDomain note: …` },
});
```
