Docs
CodeRabbit
Cloudflare
AG Grid
SerpAPI
Netlify
OpenRouter
Neon
WorkOS
Clerk
Electric
PowerSync
Sentry
Railway
Prisma
Strapi
Unkey
CodeRabbit
Cloudflare
AG Grid
SerpAPI
Netlify
OpenRouter
Neon
WorkOS
Clerk
Electric
PowerSync
Sentry
Railway
Prisma
Strapi
Unkey
Persistence (Advanced)
Embeddings
Reranking
Evaluate
Sandboxes (Advanced)
Class References
Function References
Interface References
Type Alias References
Variable References
Interface References

UIMessage

Defined in: packages/ai/src/types.ts:787

UIMessage - Domain-specific message format optimized for building chat UIs Contains parts that can be text, tool calls, or tool results. Generic over the structured-output data type so useChat({ outputSchema })'s schema narrows parts.find(p => p.type === 'structured-output').data on the consumer side without manual casts.

Type Parameters

TData

TData = unknown

Properties

createdAt?

ts
optional createdAt?: Date;
optional createdAt?: Date;

Defined in: packages/ai/src/types.ts:791


id

ts
id: string;
id: string;

Defined in: packages/ai/src/types.ts:788


metadata?

ts
optional metadata?: Record<string, any>;
optional metadata?: Record<string, any>;

Defined in: packages/ai/src/types.ts:798

Optional AG-UI metadata bag. TanStack writes the tanstack key. User keys stay at the top.


name?

ts
optional name?: string;
optional name?: string;

Defined in: packages/ai/src/types.ts:793

Optional AG-UI sender name. Converters preserve it across wire and persist.


parts

ts
parts: MessagePart<TData>[];
parts: MessagePart<TData>[];

Defined in: packages/ai/src/types.ts:790


role

ts
role: "assistant" | "user" | "activity" | "system";
role: "assistant" | "user" | "activity" | "system";

Defined in: packages/ai/src/types.ts:789