Open Agent Loops
API Reference

UserMessage

@open-agent-loops/core


Defined in: types/user-message.ts:40

A user turn.

Remarks

The only role whose content may be multimodal: a plain string, or an array of ContentParts (text / image / audio / file). That mirrors the chat-completions spec, where images, audio, and files are input-only and ride on user turns; the array passes straight through egress to the provider.

Abstraction over — OpenAI's user message ({ role, content }), where content is a string or a ContentPart array; timestamp is the only extension. The multimodal array crosses egress unchanged.

Example

Wire shape — plain text, then multimodal

{ "role": "user", "content": "What's the weather in NYC?" }
{
  "role": "user",
  "content": [
    { "type": "text", "text": "What's in this image?" },
    { "type": "image_url", "image_url": { "url": "https://example.com/a.png" } }
  ]
}

Extends

  • MessageBase

Properties

PropertyTypeDescriptionOverridesInherited fromDefined in
contentstring | ContentPart[]Plain text, or a multimodal ContentPart array.MessageBase.content-types/user-message.ts:44
roleUserDiscriminant: a user turn.--types/user-message.ts:42
timestamp?number[extension — not in the OpenAI spec] Creation time (ms since epoch), for ordering.-MessageBase.timestamptypes/message-base.ts:35

On this page