AS AgentScopeAPI 手册 / API Reference

SessionEntry

@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type") @JsonSubTypes({ @JsonSubTypes.Type(value = SessionEntry.MessageEntry.class, name = "message"), @JsonSubTypes.Type(value = SessionEntry.ToolUseEntry.class, name = "tool_use"), @JsonSubTypes.Type(value = SessionEntry.ToolResultEntry.class, name = "tool_result"), @JsonSubTypes.Type(value = SessionEntry.CompactionEntry.class, name = "compaction"), @JsonSubTypes.Type(value = SessionEntry.SummaryEntry.class, name = "summary") }) @JsonInclude(JsonInclude.Include.NON_NULL) public abstract sealed class SessionEntry permits SessionEntry.MessageEntry, SessionEntry.ToolUseEntry, SessionEntry.ToolResultEntry, SessionEntry.CompactionEntry, SessionEntry.SummaryEntry
源码Source io/agentscope/harness/agent/memory/session/SessionEntry.java:43–313

会话条目,在多次调用之间保存和恢复会话与记忆数据。位于 io.agentscope.harness.agent.memory.session 包。核心成员包括 getId、getParentId、getTimestamp、SessionEntry。

Base class for all session tree entries (pi-mono-inspired JSONL session model).

Each entry has a unique id and a parentId forming a tree structure. Entries are appended to the session JSONL file in order; they are never deleted.

Entry types:

  • MessageEntry — conversation message (user/assistant/system) or placeholder

  • ToolUseEntry — structured tool call (machine-readable process record)

  • ToolResultEntry — structured tool result, paired via toolCallId

  • CompactionEntry — marks a compaction event (non-destructive)

  • SummaryEntry — holds a compaction summary

嵌套类摘要Nested Class Summary

类Class类型Kind说明Description
MessageEntry类class
消息条目,在多次调用之间保存和恢复会话与记忆数据。
A message entry wrapping a conversation turn (user/assistant/system), or a placeholder when the message had no renderable text/tool blocks (e.g.
ToolUseEntry类class
工具使用条目,在多次调用之间保存和恢复会话与记忆数据。
Structured tool-call record.
ToolResultEntry类class
工具结果条目,在多次调用之间保存和恢复会话与记忆数据。
Structured tool-result record, paired with `ToolUseEntry` via `toolCallId`.
CompactionEntry类class
压缩条目,在多次调用之间保存和恢复会话与记忆数据。
Non-destructive compaction marker.
SummaryEntry类class
摘要条目,在多次调用之间保存和恢复会话与记忆数据。
Holds the text of a compaction summary (the condensed version of compacted messages).

构造器摘要Constructor Summary

构造器Constructor说明Description
protected SessionEntry(String id, String parentId, Instant timestamp)
初始化 `SessionEntry` 实例。
Creates a new instance.

方法摘要Method Summary

方法Method说明Description
public String getId()
获取标识。
Returns the id.
public String getParentId()
获取父级标识。
Returns the parent id.
public Instant getTimestamp()
获取时间戳。
Returns the timestamp.

构造器详情Constructor Detail

SessionEntry

protected SessionEntry(String id, String parentId, Instant timestamp)

初始化 SessionEntry 实例。

Creates a new instance.

参数Parameters
名称Name类型Type说明Description
idString标识(类型 `String`)。The id.
parentIdString父级标识(类型 `String`)。The parent id.
timestampInstant时间戳(类型 `Instant`)。The timestamp.
源码Source io/agentscope/harness/agent/memory/session/SessionEntry.java:63–67

方法详情Method Detail

getId

public String getId()

获取标识。

Returns the id.

返回Returns String
返回字符串结果。Returns a string.
源码Source io/agentscope/harness/agent/memory/session/SessionEntry.java:69–71

getParentId

public String getParentId()

获取父级标识。

Returns the parent id.

返回Returns String
返回字符串结果。Returns a string.
源码Source io/agentscope/harness/agent/memory/session/SessionEntry.java:73–75

getTimestamp

public Instant getTimestamp()

获取时间戳。

Returns the timestamp.

返回Returns Instant
返回Instant。Returns instant.
源码Source io/agentscope/harness/agent/memory/session/SessionEntry.java:77–79

嵌套类详情Nested Class Detail

MessageEntry

public static final class MessageEntry extends SessionEntry

消息条目,在多次调用之间保存和恢复会话与记忆数据。位于 io.agentscope.harness.agent.memory.session 包,继承自 SessionEntry。核心成员包括 getRole、getContent、getToolCallId、getBlockTypes、MessageEntry。

A message entry wrapping a conversation turn (user/assistant/system), or a placeholder when the message had no renderable text/tool blocks (e.g. image-only).

ToolUseEntry

public static final class ToolUseEntry extends SessionEntry

工具使用条目,在多次调用之间保存和恢复会话与记忆数据。位于 io.agentscope.harness.agent.memory.session 包,继承自 SessionEntry。核心成员包括 getToolCallId、getName、getInput、isTruncated、getOriginalSize、ToolUseEntry。

Structured tool-call record. Process-complete and machine-readable; input may be truncated with #truncated/#originalSize set.

ToolResultEntry

public static final class ToolResultEntry extends SessionEntry

工具结果条目,在多次调用之间保存和恢复会话与记忆数据。位于 io.agentscope.harness.agent.memory.session 包,继承自 SessionEntry。核心成员包括 getToolCallId、getName、getOutput、getOutputBlockTypes、isTruncated、getOriginalSize。

Structured tool-result record, paired with ToolUseEntry via toolCallId. output may be truncated with #truncated/#originalSize set.

CompactionEntry

public static final class CompactionEntry extends SessionEntry

压缩条目,在多次调用之间保存和恢复会话与记忆数据。位于 io.agentscope.harness.agent.memory.session 包,继承自 SessionEntry。核心成员包括 getFirstKeptEntryId、getSummaryEntryId、CompactionEntry。

Non-destructive compaction marker. Records which entry is the first kept entry — all entries before firstKeptEntryId are considered compacted (not visible to the LLM) but remain in the file for full history replay.

SummaryEntry

public static final class SummaryEntry extends SessionEntry

摘要条目,在多次调用之间保存和恢复会话与记忆数据。位于 io.agentscope.harness.agent.memory.session 包,继承自 SessionEntry。核心成员包括 getSummary、getFormat、SummaryEntry。

Holds the text of a compaction summary (the condensed version of compacted messages).

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