AS AgentScopeAPI 手册 / API Reference

TranscriptStore

public interface TranscriptStore
源码Source io/agentscope/harness/agent/transcript/TranscriptStore.java:35–78

定义 Transcript 存储契约的接口。位于 io.agentscope.harness.agent.transcript 包。核心成员包括 appendSegment、listSegments、readSegment、compact、withRuntimeContext、delete。

Narrow append-oriented store for session transcripts.

Orthogonal to io.agentscope.harness.agent.filesystem.remote.store.BaseStore (document KV). Writes are immutable segments — never in-place append on a shared object — so concurrent writers cannot silently overwrite each other.

Key layout:

`{tenant}/{agentId}/{sessionId}/events/{seqStart}-{seqEnd}-{writerId}.jsonl
`

嵌套类摘要Nested Class Summary

类Class类型Kind说明Description
SegmentInfo记录record
承载 Segment 信息数据的记录类型。
Metadata for one immutable segment.

方法摘要Method Summary

方法Method说明Description
public String appendSegment(TranscriptRef ref, long seqStart, long seqEnd, String writerId, byte[] jsonl)
追加 `appendSegment`。
Appends one immutable JSONL segment and returns its storage key.
public List<SegmentInfo> listSegments(TranscriptRef ref)
列出 `listSegments`。
Lists segments ordered by `seqStart` ascending.
public InputStream readSegment(String segmentKey)
设置该参数。
Opens a segment for reading; caller must close the stream.
default public void compact(TranscriptRef ref)
default
设置该参数。
Optional compaction of small segments into a single object.
default public TranscriptStore withRuntimeContext(RuntimeContext rc)
default
执行使用运行时上下文相关操作。
Returns a store view bound to the given per-call `RuntimeContext` so that namespace-scoped backends (e.g., per-user local filesystems) route transcript segments into the caller's namespace instead of the un-namespaced root.
public void delete(TranscriptRef ref)
删除数据。
Deletes all segments for the transcript.

方法详情Method Detail

appendSegment

public String appendSegment(TranscriptRef ref, long seqStart, long seqEnd, String writerId, byte[] jsonl)

追加 appendSegment。

Appends one immutable JSONL segment and returns its storage key.

参数Parameters
名称Name类型Type说明Description
refTranscriptRef引用(类型 `TranscriptRef`)。transcript identity
seqStartlongseq 启动(类型 `long`)。inclusive start sequence (caller-assigned, contiguous preferred)
seqEndlongseq 结束(类型 `long`)。inclusive end sequence
writerIdStringwriter 标识(类型 `String`)。unique writer / replica id (prevents key collisions)
jsonlbyte[]jsonl(类型 `byte[]`)。UTF-8 JSONL payload (one `io.agentscope.harness.agent.memory.session.SessionEntry` per line)
返回Returns String
返回字符串结果。storage key of the written segment
源码Source io/agentscope/harness/agent/transcript/TranscriptStore.java:48–49

listSegments

public List<SegmentInfo> listSegments(TranscriptRef ref)

列出 listSegments。

Lists segments ordered by seqStart ascending.

参数Parameters
名称Name类型Type说明Description
refTranscriptRef引用(类型 `TranscriptRef`)。The ref.
返回Returns List<SegmentInfo>
返回列出。Returns list.
源码Source io/agentscope/harness/agent/transcript/TranscriptStore.java:52

readSegment

public InputStream readSegment(String segmentKey)

设置该参数。

Opens a segment for reading; caller must close the stream.

参数Parameters
名称Name类型Type说明Description
segmentKeyStringsegment 键(类型 `String`)。The segment key.
返回Returns InputStream
返回InputStream。Returns input stream.
源码Source io/agentscope/harness/agent/transcript/TranscriptStore.java:55

compact

default public void compact(TranscriptRef ref)
default

设置该参数。

Optional compaction of small segments into a single object.

参数Parameters
名称Name类型Type说明Description
refTranscriptRef引用(类型 `TranscriptRef`)。The ref.
源码Source io/agentscope/harness/agent/transcript/TranscriptStore.java:58

withRuntimeContext

default public TranscriptStore withRuntimeContext(RuntimeContext rc)
default

执行使用运行时上下文相关操作。

Returns a store view bound to the given per-call RuntimeContext so that namespace-scoped backends (e.g., per-user local filesystems) route transcript segments into the caller's namespace instead of the un-namespaced root.

参数Parameters
名称Name类型Type说明Description
rcRuntimeContextrc(类型 `RuntimeContext`)。The rc.
返回Returns TranscriptStore
返回TranscriptStore。Returns transcript store.
源码Source io/agentscope/harness/agent/transcript/TranscriptStore.java:68–70

delete

public void delete(TranscriptRef ref)

删除数据。

Deletes all segments for the transcript.

参数Parameters
名称Name类型Type说明Description
refTranscriptRef引用(类型 `TranscriptRef`)。The ref.
源码Source io/agentscope/harness/agent/transcript/TranscriptStore.java:73

嵌套类详情Nested Class Detail

SegmentInfo

record SegmentInfo( String key, long seqStart, long seqEnd, String writerId, Instant createdAt)

承载 Segment 信息数据的记录类型。位于 io.agentscope.harness.agent.transcript 包。核心成员包括 key、seqStart、seqEnd、writerId、createdAt。

Metadata for one immutable segment.

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