> ## Documentation Index
> Fetch the complete documentation index at: https://darwin.so/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Vercel AI SDK

> Wrap Darwin as typed server tools in a Vercel AI SDK application.

Create server-only tools that call the Darwin SDK or REST API. Keep the public Search schema separate from Action mutations so the UI can render different confirmation behavior.

[Copy the Vercel AI SDK MCP recipe](https://github.com/darwin-studios/darwin-integrations/blob/main/frameworks/vercel-ai-sdk.md).

## Recommended application state

* selected `capabilityId` and `capabilityRevision`
* durable `actionId`
* stable `requestId` for each logical mutation
* current `status`, `actionRequired`, and `availableActions`

Stream explanatory model text separately from the authoritative Action result. A finished text stream does not mean external work completed.

## UI responsibilities

| Darwin response                             | UI treatment                                                  |
| ------------------------------------------- | ------------------------------------------------------------- |
| Search results                              | Comparable selection cards in canonical order.                |
| `awaiting_user`                             | A focused input request.                                      |
| `connection_required` or `payment_required` | A user-triggered link to Darwin's first-party flow.           |
| `approval_required`                         | Exact review terms with explicit approve and reject controls. |
| `completed` or `stopped`                    | A terminal result with no further polling.                    |

Keep the stream reconnectable and the Action state durable. A page refresh should read the stored `actionId`, not create a new Action.
