Four Message Roles API

The API messages list contains four roles:

  • system — developer instruction, highest priority;
  • user — user input;
  • assistant — previous model responses, including tool calls;
  • tool — tool execution results, associated via toolcallid.

Tool definitions are passed in a separate tools field.

Each call is stateless: the framework is responsible for sending the full history each time.

Related: Five Context Components, Agent Loop in Code