Skip to content
47% off: the complete course for $79 (reg. $149)Order now →
Agent Builder

AI agent glossary

Message roles (system, user, assistant)

The labels that mark who said each part of a conversation sent to a model: system instructions, the user, or the assistant itself.

Chat model APIs take a conversation as a list of messages, each with a role. User messages contain what the person or your application says. Assistant messages contain what the model said earlier, including its tool call requests. The system prompt carries standing instructions that frame the whole conversation.

Providers structure this slightly differently. The Anthropic Messages API takes the system prompt as a separate top-level parameter and only allows user and assistant roles in the message list, with tool results sent inside user messages. OpenAI's APIs use system or developer messages and a separate tool role for results.

Roles matter because models are trained to weigh them differently. Durable rules and persona belong in the system prompt; the specific request belongs in a user message. Because the model has no memory, your code resends the full message history, in order, on every call.

Learn more in the course

Related terms

Go from definitions to doing

Learn to use and build AI agents in 65 practical lessons.