AS AgentScopeAPI 手册 / API Reference

SessionOperations

public final class SessionOperations
源码Source io/agentscope/spring/boot/admin/service/SessionOperations.java:50–450

会话 Operations,承载智能体的部署、调度与服务化运行。位于 io.agentscope.spring.boot.admin.service 包。核心成员包括 listSessions、listMessages、exportMarkdown、dumpStateJson、abort、compact。

Business logic for the per-session data-plane admin actions.

Designed so that the REST controller is a thin shell: it parses the request, defers to one method here, and serializes the result. All blocking I/O (AgentStateStore reads, JSON serialization) is pushed off the request thread via Schedulers#boundedElastic().

嵌套类摘要Nested Class Summary

类Class类型Kind说明Description
UndoResult记录record
承载 Undo 结果数据的记录类型。
Outcome of an undo/redo invocation.

构造器摘要Constructor Summary

构造器Constructor说明Description
public SessionOperations(AgentRegistry registry, SummarizationStrategy summarizer, AdminProperties properties, SnapshotStore snapshots)
初始化 `SessionOperations` 实例。
Creates a new instance.

方法摘要Method Summary

方法Method说明Description
public Mono<List<String>> listSessions(AgentStateStore stateStore)
列出会话。
Read-only listing of known session ids from `AgentStateStore#listSessionIds(String)`.
public Mono<List<MessageView>> listMessages(String agentIdOrSessionId)
列出消息。
Return the in-memory message list of a registered agent.
public Mono<String> exportMarkdown(String agentIdOrSessionId)
设置该参数。
Render the conversation as a Markdown transcript.
public Mono<String> dumpStateJson(String agentIdOrSessionId)
设置该参数。
Dump the full `AgentState` JSON for a session.
public Mono<Void> abort(String agentIdOrSessionId)
设置中止。
Cooperatively interrupt the agent.
public Mono<CompactResponse> compact(String agentIdOrSessionId, CompactRequest request)
执行 `compact` 方法。
Compact a session: summarize the older portion of the context, truncate to the last `keepLast` messages, and persist via the agent's `AgentStateStore`.
public Mono<UndoResult> undo(String agentIdOrSessionId)
设置该参数。
Restore the agent's state to the snapshot stored before the most recent mutation.
public Mono<UndoResult> redo(String agentIdOrSessionId)
设置该参数。
Reverse a previous `#undo(String)`.
public Mono<PlanModeView> planState(String agentIdOrSessionId)
设置计划状态。
Read the current plan-mode state of a session.
public Mono<PlanModeView> enterPlanMode(String agentIdOrSessionId)
设置该参数。
Switch the agent into plan mode.
public Mono<PlanModeView> exitPlanMode(String agentIdOrSessionId)
设置该参数。
Exit plan mode.
public Mono<List<AgentTaskView>> listAgentTasks(String agentIdOrSessionId)
列出智能体任务。
List the per-`io.agentscope.core.state.AgentState` task records of a session.

构造器详情Constructor Detail

SessionOperations

public SessionOperations(AgentRegistry registry, SummarizationStrategy summarizer, AdminProperties properties, SnapshotStore snapshots)

初始化 SessionOperations 实例。

Creates a new instance.

参数Parameters
名称Name类型Type说明Description
registryAgentRegistry注册表(类型 `AgentRegistry`)。The registry.
summarizerSummarizationStrategysummarizer(类型 `SummarizationStrategy`)。The summarizer.
propertiesAdminProperties属性(类型 `AdminProperties`)。The properties.
snapshotsSnapshotStoresnapshots(类型 `SnapshotStore`)。The snapshots.
源码Source io/agentscope/spring/boot/admin/service/SessionOperations.java:57–66

方法详情Method Detail

listSessions

public Mono<List<String>> listSessions(AgentStateStore stateStore)

列出会话。

Read-only listing of known session ids from AgentStateStore#listSessionIds(String).

参数Parameters
名称Name类型Type说明Description
stateStoreAgentStateStore状态存储(类型 `AgentStateStore`)。The state store.
返回Returns Mono<List<String>>
返回Mono>。Returns mono.
源码Source io/agentscope/spring/boot/admin/service/SessionOperations.java:69–84

listMessages

public Mono<List<MessageView>> listMessages(String agentIdOrSessionId)

列出消息。

Return the in-memory message list of a registered agent.

参数Parameters
名称Name类型Type说明Description
agentIdOrSessionIdString智能体标识或会话标识(类型 `String`)。The agent id or session id.
返回Returns Mono<List<MessageView>>
返回Mono>。Returns mono.
源码Source io/agentscope/spring/boot/admin/service/SessionOperations.java:87–98

exportMarkdown

public Mono<String> exportMarkdown(String agentIdOrSessionId)

设置该参数。

Render the conversation as a Markdown transcript.

参数Parameters
名称Name类型Type说明Description
agentIdOrSessionIdString智能体标识或会话标识(类型 `String`)。The agent id or session id.
返回Returns Mono<String>
返回Mono。Returns mono.
源码Source io/agentscope/spring/boot/admin/service/SessionOperations.java:101–136

dumpStateJson

public Mono<String> dumpStateJson(String agentIdOrSessionId)

设置该参数。

Dump the full AgentState JSON for a session.

参数Parameters
名称Name类型Type说明Description
agentIdOrSessionIdString智能体标识或会话标识(类型 `String`)。The agent id or session id.
返回Returns Mono<String>
返回Mono。Returns mono.
源码Source io/agentscope/spring/boot/admin/service/SessionOperations.java:139–141

abort

public Mono<Void> abort(String agentIdOrSessionId)

设置中止。

Cooperatively interrupt the agent.

参数Parameters
名称Name类型Type说明Description
agentIdOrSessionIdString智能体标识或会话标识(类型 `String`)。The agent id or session id.
返回Returns Mono<Void>
返回Mono。Returns mono.
源码Source io/agentscope/spring/boot/admin/service/SessionOperations.java:144–146

compact

public Mono<CompactResponse> compact(String agentIdOrSessionId, CompactRequest request)

执行 compact 方法。

Compact a session: summarize the older portion of the context, truncate to the last keepLast messages, and persist via the agent's AgentStateStore.

参数Parameters
名称Name类型Type说明Description
agentIdOrSessionIdString智能体标识或会话标识(类型 `String`)。The agent id or session id.
requestCompactRequest请求(类型 `CompactRequest`)。The request.
返回Returns Mono<CompactResponse>
返回Mono。Returns mono.
源码Source io/agentscope/spring/boot/admin/service/SessionOperations.java:155–215

undo

public Mono<UndoResult> undo(String agentIdOrSessionId)

设置该参数。

Restore the agent's state to the snapshot stored before the most recent mutation.

参数Parameters
名称Name类型Type说明Description
agentIdOrSessionIdString智能体标识或会话标识(类型 `String`)。The agent id or session id.
返回Returns Mono<UndoResult>
返回Mono。Returns mono.
源码Source io/agentscope/spring/boot/admin/service/SessionOperations.java:221–245

redo

public Mono<UndoResult> redo(String agentIdOrSessionId)

设置该参数。

Reverse a previous #undo(String).

参数Parameters
名称Name类型Type说明Description
agentIdOrSessionIdString智能体标识或会话标识(类型 `String`)。The agent id or session id.
返回Returns Mono<UndoResult>
返回Mono。Returns mono.
源码Source io/agentscope/spring/boot/admin/service/SessionOperations.java:248–272

planState

public Mono<PlanModeView> planState(String agentIdOrSessionId)

设置计划状态。

Read the current plan-mode state of a session.

参数Parameters
名称Name类型Type说明Description
agentIdOrSessionIdString智能体标识或会话标识(类型 `String`)。The agent id or session id.
返回Returns Mono<PlanModeView>
返回Mono。Returns mono.
源码Source io/agentscope/spring/boot/admin/service/SessionOperations.java:285–293

enterPlanMode

public Mono<PlanModeView> enterPlanMode(String agentIdOrSessionId)

设置该参数。

Switch the agent into plan mode.

参数Parameters
名称Name类型Type说明Description
agentIdOrSessionIdString智能体标识或会话标识(类型 `String`)。The agent id or session id.
返回Returns Mono<PlanModeView>
返回Mono。Returns mono.
源码Source io/agentscope/spring/boot/admin/service/SessionOperations.java:301–320

exitPlanMode

public Mono<PlanModeView> exitPlanMode(String agentIdOrSessionId)

设置该参数。

Exit plan mode.

参数Parameters
名称Name类型Type说明Description
agentIdOrSessionIdString智能体标识或会话标识(类型 `String`)。The agent id or session id.
返回Returns Mono<PlanModeView>
返回Mono。Returns mono.
源码Source io/agentscope/spring/boot/admin/service/SessionOperations.java:323–341

listAgentTasks

public Mono<List<AgentTaskView>> listAgentTasks(String agentIdOrSessionId)

列出智能体任务。

List the per-io.agentscope.core.state.AgentState task records of a session.

参数Parameters
名称Name类型Type说明Description
agentIdOrSessionIdString智能体标识或会话标识(类型 `String`)。The agent id or session id.
返回Returns Mono<List<AgentTaskView>>
返回Mono>。Returns mono.
源码Source io/agentscope/spring/boot/admin/service/SessionOperations.java:354–367

嵌套类详情Nested Class Detail

UndoResult

public record UndoResult(String sessionId, boolean restored, int undoDepth, int redoDepth)

承载 Undo 结果数据的记录类型。位于 io.agentscope.spring.boot.admin.service 包。核心成员包括 sessionId、restored、undoDepth、redoDepth。

Outcome of an undo/redo invocation.

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