AS AgentScopeAPI 手册 / API Reference
消息·事件·格式化Messages, events & formatting · 单元Unit 04

消息与事件:系统内唯一的数据契约Messages and events: the single data contract

掌握 Msg、内容块、角色和流式事件。学完本单元,你能排查消息丢失、顺序错乱、工具结果无法回填和前端重复渲染。Master Msg, content blocks, roles and streaming events. After this unit you can debug lost messages, ordering issues, unlinked tool results and duplicated UI rendering.

10 道题questions 5 张概念卡concept cards 2 个相关事故related incidents

学习目标Learning goals

  • 正确构造 system/user/assistant/tool 四类消息Construct system/user/assistant/tool messages correctly
  • 理解工具调用块与工具结果块的关联方式Understand how tool-call and tool-result blocks correlate
  • 消费流式事件并合并增量与最终消息Consume streaming events and merge deltas with the final message

概念闪卡Concept cards

点击卡片翻面查看解释。Click a card to flip it and reveal the explanation.

关键 APIKey APIs

点击进入对应的 Python 或 Java 参考页。Open the exact Python or Java reference for each type.

问题巩固Check yourself

完成 10 道题;答错会自动进入错题本。Answer all ten questions. Wrong answers are added to your wrong-answer book automatically.

01AgentScope 支持哪四种消息角色?Which four message roles does AgentScope support?
02Python 中表示一次工具调用的内容块是?Which Python content block represents a tool call?
03Python 中表示工具执行结果的内容块是?Which Python content block represents a tool result?
04Python 中所有事件的基类是?What is the base class for Python events?
05文本流式增量对应哪个事件?Which event carries a streaming text delta?
06Java 中统一消息类型是?What is the unified Java message type?
07Java 中表示工具调用的内容块是?Which Java content block represents a tool call?
08从 Python Msg 中提取纯文本应调用?How do you extract plain text from a Python Msg?
09Java 中所有内容块的基类是?What is the base class for Java content blocks?
10工具结果依靠什么与模型发起的调用关联?What links a tool result to the model's tool call?

接着看的生产事故Production incidents to read next

基于官方固定版本源码静态生成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.