AS AgentScopeAPI 手册 / API Reference

Builder

public static final class Builder
源码Source io/agentscope/core/state/AgentState.java:313–393

构建器,用于构建并配置目标实例。位于 io.agentscope.core.state 包。核心成员包括 sessionId、userId、summary、context、addMessage、replyId。

A class in io.agentscope.core.state that persists and restores session and memory data across calls. Declared in io.agentscope.core.state.

方法摘要Method Summary

方法Method说明Description
public Builder sessionId(String sessionId)
设置会话标识。
Performs the session id operation.
public Builder userId(String userId)
设置用户标识。
Nullable; `null` = anonymous / single-tenant context.
public Builder summary(String summary)
设置摘要。
Performs the summary operation.
public Builder context(List<Msg> context)
设置上下文。
Performs the context operation.
public Builder addMessage(Msg message)
添加消息。
Adds the message.
public Builder replyId(String replyId)
设置回复标识。
Replies to the id.
public Builder curIter(int curIter)
设置当前迭代次数。
Performs the cur iter operation.
public Builder shutdownInterrupted(boolean shutdownInterrupted)
设置该配置项。
Performs the shutdown interrupted operation.
public Builder permissionContext(PermissionContextState permissionContext)
设置权限上下文。
Performs the permission context operation.
public Builder toolContext(ToolContextState toolContext)
设置工具上下文。
Performs the tool context operation.
public Builder tasksContext(TaskContextState tasksContext)
设置任务上下文。
Performs the tasks context operation.
public Builder planModeContext(PlanModeContextState planModeContext)
设置计划模式上下文。
Performs the plan mode context operation.
public AgentState build()
构建并返回最终实例。
Creates and returns an instance.

方法详情Method Detail

sessionId

public Builder sessionId(String sessionId)

设置会话标识。

Performs the session id operation.

参数Parameters
名称Name类型Type说明Description
sessionIdString会话标识(类型 `String`)。The session id.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/core/state/AgentState.java:328–331

userId

public Builder userId(String userId)

设置用户标识。

Nullable; null = anonymous / single-tenant context.

参数Parameters
名称Name类型Type说明Description
userIdString用户标识(类型 `String`)。The user id.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/core/state/AgentState.java:334–337

summary

public Builder summary(String summary)

设置摘要。

Performs the summary operation.

参数Parameters
名称Name类型Type说明Description
summaryString摘要(类型 `String`)。The summary.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/core/state/AgentState.java:339–342

context

public Builder context(List<Msg> context)

设置上下文。

Performs the context operation.

参数Parameters
名称Name类型Type说明Description
contextList<Msg>上下文(类型 `List`)。The context.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/core/state/AgentState.java:344–347

addMessage

public Builder addMessage(Msg message)

添加消息。

Adds the message.

参数Parameters
名称Name类型Type说明Description
messageMsg消息(类型 `Msg`)。The message.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/core/state/AgentState.java:349–353

replyId

public Builder replyId(String replyId)

设置回复标识。

Replies to the id.

参数Parameters
名称Name类型Type说明Description
replyIdString回复标识(类型 `String`)。The reply id.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/core/state/AgentState.java:355–358

curIter

public Builder curIter(int curIter)

设置当前迭代次数。

Performs the cur iter operation.

参数Parameters
名称Name类型Type说明Description
curIterint当前迭代次数(类型 `int`)。The cur iter.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/core/state/AgentState.java:360–363

shutdownInterrupted

public Builder shutdownInterrupted(boolean shutdownInterrupted)

设置该配置项。

Performs the shutdown interrupted operation.

参数Parameters
名称Name类型Type说明Description
shutdownInterruptedbooleanshutdown Interrupted(类型 `boolean`)。The shutdown interrupted.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/core/state/AgentState.java:365–368

permissionContext

public Builder permissionContext(PermissionContextState permissionContext)

设置权限上下文。

Performs the permission context operation.

参数Parameters
名称Name类型Type说明Description
permissionContextPermissionContextState权限上下文(类型 `PermissionContextState`)。The permission context.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/core/state/AgentState.java:370–373

toolContext

public Builder toolContext(ToolContextState toolContext)

设置工具上下文。

Performs the tool context operation.

参数Parameters
名称Name类型Type说明Description
toolContextToolContextState工具上下文(类型 `ToolContextState`)。The tool context.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/core/state/AgentState.java:375–378

tasksContext

public Builder tasksContext(TaskContextState tasksContext)

设置任务上下文。

Performs the tasks context operation.

参数Parameters
名称Name类型Type说明Description
tasksContextTaskContextState任务上下文(类型 `TaskContextState`)。The tasks context.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/core/state/AgentState.java:380–383

planModeContext

public Builder planModeContext(PlanModeContextState planModeContext)

设置计划模式上下文。

Performs the plan mode context operation.

参数Parameters
名称Name类型Type说明Description
planModeContextPlanModeContextState计划模式上下文(类型 `PlanModeContextState`)。The plan mode context.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/core/state/AgentState.java:385–388

build

public AgentState build()

构建并返回最终实例。

Creates and returns an instance.

返回Returns AgentState
返回AgentState。Returns agent state.
源码Source io/agentscope/core/state/AgentState.java:390–392
基于官方固定版本源码静态生成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.