Skip to documentation
Documentation navigation

Documentation navigation

Documentation / guides

UserMessage

Add a human-authored turn to an AgenticMessages thread.

developer

UserMessage is a human-authored conversation turn. It embeds Message, so its role and ordered blocks are directly accessible.

API surface

type UserMessage struct{ Message }

The embedded value should normally use RoleUser:

message := &content.UserMessage{Message: content.Message{
	Role: content.RoleUser,
	Blocks: []content.Block{
		&content.TextBlock{Text: "Summarize this."},
		&content.DocumentBlock{
			MediaType: content.MediaTypeDocumentText,
			Name: "notes.txt", Text: "A short note.",
		},
	},
}}

Blocks may contain multimodal input when the selected model advertises the capability. UserMessage has no usage or tool-correlation fields; those belong to assistant and tool-result turns.

Proof

Related: SystemMessage, Conversation input.

← back to documentation