AS AgentScopeAPI 手册 / API Reference

PreSummaryEvent

@Deprecated(forRemoval = true, since = "2.0.0") public final class PreSummaryEvent extends SummaryEvent
源码Source io/agentscope/core/hook/PreSummaryEvent.java:51–146

前置摘要事件,描述执行过程中的事件。位于 io.agentscope.core.hook 包,继承自 SummaryEvent。核心成员包括 getInputMessages、setInputMessages、getMaxIterations、getCurrentIteration、getEffectiveGenerateOptions、setGenerateOptions。

Event fired before summary generation when max iterations is reached.

Modifiable: Yes - #setInputMessages(List), #setGenerateOptions(GenerateOptions)

Context:

  • #getAgent() - The agent instance

  • #getMemory() - Agent's memory

  • #getModelName() - The model name (e.g., "qwen-plus")

  • #getGenerateOptions() - The generation options (temperature, etc.)

  • #getInputMessages() - Messages to send to LLM for summary (modifiable)

  • #getMaxIterations() - The maximum iterations configured for the agent

  • #getCurrentIteration() - The current iteration count when summary triggered

Use Cases:

  • Inject additional context into the summary prompt

  • Modify the summary system instructions

  • Change generation parameters for summary

  • Log summary generation input

构造器摘要Constructor Summary

构造器Constructor说明Description
public PreSummaryEvent(Agent agent, String modelName, GenerateOptions generateOptions, List<Msg> inputMessages, int maxIterations, int currentIteration)
初始化 `PreSummaryEvent` 实例。
Constructor for PreSummaryEvent.

方法摘要Method Summary

方法Method说明Description
public List<Msg> getInputMessages()
获取输入消息。
Get the messages that will be sent to LLM for summary generation.
public void setInputMessages(List<Msg> inputMessages)
设置输入消息。
Modify the messages to send to LLM for summary.
public int getMaxIterations()
获取最大迭代。
Get the maximum iterations configured for the agent.
public int getCurrentIteration()
获取当前迭代。
Get the current iteration count when summary was triggered.
public GenerateOptions getEffectiveGenerateOptions()
获取 `getEffectiveGenerateOptions`。
Get the effective generation options.
public void setGenerateOptions(GenerateOptions generateOptions)
设置 `setGenerateOptions`。
Set custom generation options for this summary call.

构造器详情Constructor Detail

PreSummaryEvent

public PreSummaryEvent(Agent agent, String modelName, GenerateOptions generateOptions, List<Msg> inputMessages, int maxIterations, int currentIteration)

初始化 PreSummaryEvent 实例。

Constructor for PreSummaryEvent.

参数Parameters
名称Name类型Type说明Description
agentAgent智能体(类型 `Agent`)。The agent instance (must not be null)
modelNameString模型名称(类型 `String`)。The model name (must not be null)
generateOptionsGenerateOptionsgenerate 选项(类型 `GenerateOptions`)。The generation options (may be null)
inputMessagesList<Msg>输入消息(类型 `List`)。The messages to send to LLM for summary (must not be null)
maxIterationsint最大迭代(类型 `int`)。The maximum iterations configured for the agent
currentIterationint当前迭代(类型 `int`)。The current iteration count when summary triggered
抛出Throws
  • NullPointerException 可能抛出 `NullPointerException`。if agent, modelName, or inputMessages is null
源码Source io/agentscope/core/hook/PreSummaryEvent.java:70–83

方法详情Method Detail

getInputMessages

public List<Msg> getInputMessages()

获取输入消息。

Get the messages that will be sent to LLM for summary generation.

返回Returns List<Msg>
输入消息。The input messages
源码Source io/agentscope/core/hook/PreSummaryEvent.java:90–92

setInputMessages

public void setInputMessages(List<Msg> inputMessages)

设置输入消息。

Modify the messages to send to LLM for summary.

参数Parameters
名称Name类型Type说明Description
inputMessagesList<Msg>输入消息(类型 `List`)。The new message list (must not be null)
抛出Throws
  • NullPointerException 可能抛出 `NullPointerException`。if inputMessages is null
源码Source io/agentscope/core/hook/PreSummaryEvent.java:100–102

getMaxIterations

public int getMaxIterations()

获取最大迭代。

Get the maximum iterations configured for the agent.

返回Returns int
返回数值结果。The maximum iterations
源码Source io/agentscope/core/hook/PreSummaryEvent.java:109–111

getCurrentIteration

public int getCurrentIteration()

获取当前迭代。

Get the current iteration count when summary was triggered.

返回Returns int
当前迭代数量。The current iteration count
源码Source io/agentscope/core/hook/PreSummaryEvent.java:118–120

getEffectiveGenerateOptions

public GenerateOptions getEffectiveGenerateOptions()

获取 getEffectiveGenerateOptions。

Get the effective generation options.

返回Returns GenerateOptions
返回GenerateOptions。The effective generation options
源码Source io/agentscope/core/hook/PreSummaryEvent.java:130–134

setGenerateOptions

public void setGenerateOptions(GenerateOptions generateOptions)

设置 setGenerateOptions。

Set custom generation options for this summary call.

参数Parameters
名称Name类型Type说明Description
generateOptionsGenerateOptionsgenerate 选项(类型 `GenerateOptions`)。The custom generation options
源码Source io/agentscope/core/hook/PreSummaryEvent.java:143–145

继承成员Inherited Members

继承自Methods inherited from SummaryEvent
基于官方固定版本源码静态生成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.