AS AgentScopeAPI 手册 / API Reference

InMemoryAgentEventStore

@Component public final class InMemoryAgentEventStore
源码Source io/agentscope/examples/copilotkit/service/InMemoryAgentEventStore.java:38–200

In 记忆智能体事件存储,负责持久化与读取数据。位于 io.agentscope.examples.copilotkit.service 包。核心成员包括 append、putRunInputMessages、getRunInputMessages、snapshot、hasEvents、clear。

In-memory AgentEvent log keyed by threadId.

AgentScope AgentEvents are the source of truth. AG-UI frames are projected on demand (see AgentEventAguiReplayer) for /agent/{agentId}/connect and inspect APIs.

Per-run input messages (user / tool / resume) are stored separately so connect replay can re-attach them to RUN_STARTED.input, matching CopilotKit's persistence model.

嵌套类摘要Nested Class Summary

类Class类型Kind说明Description
StoredAgentEvent记录record
承载已存储智能体事件数据的记录类型。
One AgentEvent captured during a specific AG-UI run.

方法摘要Method Summary

方法Method说明Description
public void append(String threadId, String runId, AgentEvent event)
执行追加相关操作。
Append one AgentEvent for a thread/run.
public void putRunInputMessages(String threadId, String runId, List<AguiMessage> messages)
执行 `putRunInputMessages` 方法。
Persist the new AG-UI input messages for a run (typically the latest user message).
public List<AguiMessage> getRunInputMessages(String threadId, String runId)
获取运行输入消息。
Input messages previously stored for a run, or empty when none.
public List<StoredAgentEvent> snapshot(String threadId)
设置快照。
Snapshot of persisted AgentEvents for a thread.
public boolean hasEvents(String threadId)
判断是否具有事件。
Whether the thread has any persisted AgentEvents.
public void clear(String threadId)
清空或重置内部状态。
Clear events and run inputs for a thread.

方法详情Method Detail

append

public void append(String threadId, String runId, AgentEvent event)

执行追加相关操作。

Append one AgentEvent for a thread/run.

参数Parameters
名称Name类型Type说明Description
threadIdString会话线程标识(类型 `String`)。thread identifier
runIdString运行标识(类型 `String`)。run identifier that produced the event
eventAgentEvent事件(类型 `AgentEvent`)。source AgentEvent
源码Source io/agentscope/examples/copilotkit/service/InMemoryAgentEventStore.java:57–75

putRunInputMessages

public void putRunInputMessages(String threadId, String runId, List<AguiMessage> messages)

执行 putRunInputMessages 方法。

Persist the new AG-UI input messages for a run (typically the latest user message).

参数Parameters
名称Name类型Type说明Description
threadIdString会话线程标识(类型 `String`)。thread identifier
runIdString运行标识(类型 `String`)。run identifier
messagesList<AguiMessage>消息列表(类型 `List`)。candidate input messages from `RunAgentInput`
源码Source io/agentscope/examples/copilotkit/service/InMemoryAgentEventStore.java:87–114

getRunInputMessages

public List<AguiMessage> getRunInputMessages(String threadId, String runId)

获取运行输入消息。

Input messages previously stored for a run, or empty when none.

参数Parameters
名称Name类型Type说明Description
threadIdString会话线程标识(类型 `String`)。thread identifier
runIdString运行标识(类型 `String`)。run identifier
返回Returns List<AguiMessage>
返回列出。immutable list, never null
源码Source io/agentscope/examples/copilotkit/service/InMemoryAgentEventStore.java:123–133

snapshot

public List<StoredAgentEvent> snapshot(String threadId)

设置快照。

Snapshot of persisted AgentEvents for a thread.

参数Parameters
名称Name类型Type说明Description
threadIdString会话线程标识(类型 `String`)。thread identifier
返回Returns List<StoredAgentEvent>
返回列出。immutable copy, never null
源码Source io/agentscope/examples/copilotkit/service/InMemoryAgentEventStore.java:141–149

hasEvents

public boolean hasEvents(String threadId)

判断是否具有事件。

Whether the thread has any persisted AgentEvents.

参数Parameters
名称Name类型Type说明Description
threadIdString会话线程标识(类型 `String`)。thread identifier
返回Returns boolean
返回布尔值,表示判断结果。true if non-empty
源码Source io/agentscope/examples/copilotkit/service/InMemoryAgentEventStore.java:157–165

clear

public void clear(String threadId)

清空或重置内部状态。

Clear events and run inputs for a thread.

参数Parameters
名称Name类型Type说明Description
threadIdString会话线程标识(类型 `String`)。thread identifier
源码Source io/agentscope/examples/copilotkit/service/InMemoryAgentEventStore.java:172–175

嵌套类详情Nested Class Detail

StoredAgentEvent

public record StoredAgentEvent(String runId, AgentEvent event)

承载已存储智能体事件数据的记录类型。位于 io.agentscope.examples.copilotkit.service 包。核心成员包括 runId、event。

One AgentEvent captured during a specific AG-UI run.

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