AS AgentScopeAPI 手册 / API Reference

AgentResponse

public class AgentResponse extends BaseResponse
源码Source io/agentscope/runtime/engine/schemas/AgentResponse.java:25–91

智能体响应,承载智能体的部署、调度与服务化运行。位于 io.agentscope.runtime.engine.schemas 包,继承自 BaseResponse。核心成员包括 getSessionId、setSessionId、created、inProgress、completed、failed。

Agent response class that extends BaseResponse. Includes session_id for conversation tracking.

构造器摘要Constructor Summary

构造器Constructor说明Description
public AgentResponse()
初始化 `AgentResponse` 实例。
Creates a new instance.
public AgentResponse(String id)
初始化 `AgentResponse` 实例。
Creates a new instance.
public AgentResponse(String id, String sessionId)
初始化 `AgentResponse` 实例。
Creates a new instance.
public AgentResponse(String id, String sessionId, Long createdAt)
初始化 `AgentResponse` 实例。
Creates a new instance.

方法摘要Method Summary

方法Method说明Description
public String getSessionId()
获取会话标识。
Returns the session id.
public void setSessionId(String sessionId)
设置会话标识。
Sets the session id.
public AgentResponse created()
返回已创建。
Set status to created and return self.
public AgentResponse inProgress()
将响应状态设置为进行中。
Set status to in_progress and return self.
public AgentResponse completed()
返回已完成。
Set status to completed and return self.
public AgentResponse failed(Error error)
设置失败。
Set status to failed with error and return self.

构造器详情Constructor Detail

AgentResponse

public AgentResponse()

初始化 AgentResponse 实例。

Creates a new instance.

源码Source io/agentscope/runtime/engine/schemas/AgentResponse.java:29–31

AgentResponse

public AgentResponse(String id)

初始化 AgentResponse 实例。

Creates a new instance.

参数Parameters
名称Name类型Type说明Description
idString标识(类型 `String`)。The id.
源码Source io/agentscope/runtime/engine/schemas/AgentResponse.java:33–35

AgentResponse

public AgentResponse(String id, String sessionId)

初始化 AgentResponse 实例。

Creates a new instance.

参数Parameters
名称Name类型Type说明Description
idString标识(类型 `String`)。The id.
sessionIdString会话标识(类型 `String`)。The session id.
源码Source io/agentscope/runtime/engine/schemas/AgentResponse.java:37–40

AgentResponse

public AgentResponse(String id, String sessionId, Long createdAt)

初始化 AgentResponse 实例。

Creates a new instance.

参数Parameters
名称Name类型Type说明Description
idString标识(类型 `String`)。The id.
sessionIdString会话标识(类型 `String`)。The session id.
createdAtLong已创建 At(类型 `Long`)。The created at.
源码Source io/agentscope/runtime/engine/schemas/AgentResponse.java:42–46

方法详情Method Detail

getSessionId

public String getSessionId()

获取会话标识。

Returns the session id.

返回Returns String
返回字符串结果。Returns a string.
源码Source io/agentscope/runtime/engine/schemas/AgentResponse.java:48–50

setSessionId

public void setSessionId(String sessionId)

设置会话标识。

Sets the session id.

参数Parameters
名称Name类型Type说明Description
sessionIdString会话标识(类型 `String`)。The session id.
源码Source io/agentscope/runtime/engine/schemas/AgentResponse.java:52–54

created

public AgentResponse created()

返回已创建。

Set status to created and return self.

返回Returns AgentResponse
返回AgentResponse。Returns agent response.
源码Source io/agentscope/runtime/engine/schemas/AgentResponse.java:59–63

inProgress

public AgentResponse inProgress()

将响应状态设置为进行中。

Set status to in_progress and return self.

返回Returns AgentResponse
返回AgentResponse。Returns agent response.
源码Source io/agentscope/runtime/engine/schemas/AgentResponse.java:68–72

completed

public AgentResponse completed()

返回已完成。

Set status to completed and return self.

返回Returns AgentResponse
返回AgentResponse。Returns agent response.
源码Source io/agentscope/runtime/engine/schemas/AgentResponse.java:77–81

failed

public AgentResponse failed(Error error)

设置失败。

Set status to failed with error and return self.

参数Parameters
名称Name类型Type说明Description
errorError错误(类型 `Error`)。The error.
返回Returns AgentResponse
返回AgentResponse。Returns agent response.
源码Source io/agentscope/runtime/engine/schemas/AgentResponse.java:86–90

继承成员Inherited Members

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