AS AgentScopeAPI 手册 / API Reference

MsgRole

public enum MsgRole
源码Source io/agentscope/core/message/MsgRole.java:35–67

定义消息角色相关取值的枚举。位于 io.agentscope.core.message 包。核心成员包括 USER、ASSISTANT、SYSTEM、TOOL。

Defines the role of a message participant in agent conversations.

This enum specifies the origin or purpose of each message in the conversation flow, enabling proper message routing, processing, and context management.

Message roles:

  • #USER - Messages from human users or external inputs

  • #ASSISTANT - Messages generated by AI agents or assistants

  • #SYSTEM - System instructions, prompts, or configuration messages

  • #TOOL - Messages containing tool execution results or responses

The role is essential for determining how messages should be processed and formatted when interacting with different LLM APIs and tool systems.

枚举常量摘要Enum Constant Summary

常量Constant说明Description
USER
执行用户相关操作。
User role for messages from human users or external inputs.
ASSISTANT
执行 `ASSISTANT` 方法。
Assistant role for messages generated by AI agents or assistants.
SYSTEM
用于系统指令,提示词,或配置消息的系统角色。
System role for system instructions, prompts, or configuration messages.
TOOL
执行工具相关操作。
Tool role for messages containing tool execution results or responses.

枚举常量详情Enum Constant Detail

USER

USER
staticfinal

执行用户相关操作。

User role for messages from human users or external inputs.

源码Source io/agentscope/core/message/MsgRole.java:42

ASSISTANT

ASSISTANT
staticfinal

执行 ASSISTANT 方法。

Assistant role for messages generated by AI agents or assistants.

源码Source io/agentscope/core/message/MsgRole.java:50

SYSTEM

SYSTEM
staticfinal

用于系统指令,提示词,或配置消息的系统角色。

System role for system instructions, prompts, or configuration messages.

源码Source io/agentscope/core/message/MsgRole.java:58

TOOL

TOOL
staticfinal

执行工具相关操作。

Tool role for messages containing tool execution results or responses.

源码Source io/agentscope/core/message/MsgRole.java:66
基于官方固定版本源码静态生成Generated from pinned official sources · Python 2.0.11 · Java 2.0.4
签名与文档为静态抽取;如有疑问请以源码为准。Signatures and docs are extracted statically; verify against the source when in doubt.