Four Message Roles in the 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, linked via toolcallid). Tool definitions are passed in a separate tools field. Each call is stateless: the framework is expected to send the full history each time.
Related: [Five Context Components], [Agent Loop in Code]