AS AgentScopeAPI 手册 / API Reference

ContractProvider

public interface ContractProvider
源码Source io/agentscope/extensions/aistio/transport/ContractProvider.java:27–111

定义契约提供者契约的接口。位于 io.agentscope.extensions.aistio.transport 包。核心成员包括 info、sessions、sessionState、context、messages、subagents。

Backing data for the /agentscope/* HTTP contract, implemented by the bridge.

Every method returns JSON-serializable maps and lists. Throwing NotFoundException maps to 404 and UnsupportedOperationException to 501; anything else becomes a 500.

嵌套类摘要Nested Class Summary

类Class类型Kind说明Description
NotFoundException类class
未找到异常,表示执行过程中的错误。
Signals that the requested session or resource does not exist on this instance.
BusyException类class
Busy 异常,表示执行过程中的错误。
Signals the session is busy and the caller should wait until idle.
UnauthorizedException类class
Unauthorized 异常,表示执行过程中的错误。
Signals a missing or invalid internal token on a write endpoint.

方法摘要Method Summary

方法Method说明Description
public Map<String, Object> info()
返回信息。
Returns the info.
public List<Map<String, Object>> sessions()
返回会话。
Returns the sessions.
public Map<String, Object> sessionState(String sessionId)
设置会话状态。
Performs the session state operation.
public Map<String, Object> context(String sessionId)
设置上下文。
Performs the context operation.
public Map<String, Object> messages(String sessionId, int offset, int limit)
执行消息相关操作。
Performs the messages operation.
public List<Map<String, Object>> subagents()
返回 `subagents` 结果。
Returns the subagents.
public List<Map<String, Object>> workspaces()
返回 `workspaces` 结果。
Returns the workspaces.
public void compress(String sessionId)
设置压缩。
Performs the compress operation.
public void terminate(String sessionId)
设置该参数。
Performs the terminate operation.
public void abort(String sessionId)
设置中止。
Aborts the current turn without terminating the session.
public Map<String, Object> tasks(String sessionId)
设置任务。
Session task inventory.
default public Map<String, Object> subagentTasks(String sessionId)
default
设置子智能体任务。
Background subagent tasks (not todolist).
default public void cancelSubagentTask(String sessionId, String taskId)
default
执行取消子智能体任务相关操作。
Cancel a background subagent task.
default public void planMode(String sessionId, byte[] body)
default
执行计划模式相关操作。
Enter/exit plan mode.
default public void postMessage(String sessionId, byte[] body)
default
执行后置消息相关操作。
Inject a user message into the live session.
default public Map<String, Object> exportTranscript(String sessionId)
default
设置该参数。
Optional transcript export.
default public String sessionPhase(String sessionId)
default
设置会话阶段。
Current phase string for command success responses.

方法详情Method Detail

info

public Map<String, Object> info()

返回信息。

Returns the info.

返回Returns Map<String, Object>
返回映射。Returns map.
源码Source io/agentscope/extensions/aistio/transport/ContractProvider.java:29

sessions

public List<Map<String, Object>> sessions()

返回会话。

Returns the sessions.

返回Returns List<Map<String, Object>>
返回列出>。Returns list.
源码Source io/agentscope/extensions/aistio/transport/ContractProvider.java:31

sessionState

public Map<String, Object> sessionState(String sessionId)

设置会话状态。

Performs the session state operation.

参数Parameters
名称Name类型Type说明Description
sessionIdString会话标识(类型 `String`)。The session id.
返回Returns Map<String, Object>
返回映射。Returns map.
源码Source io/agentscope/extensions/aistio/transport/ContractProvider.java:33

context

public Map<String, Object> context(String sessionId)

设置上下文。

Performs the context operation.

参数Parameters
名称Name类型Type说明Description
sessionIdString会话标识(类型 `String`)。The session id.
返回Returns Map<String, Object>
返回映射。Returns map.
源码Source io/agentscope/extensions/aistio/transport/ContractProvider.java:35

messages

public Map<String, Object> messages(String sessionId, int offset, int limit)

执行消息相关操作。

Performs the messages operation.

参数Parameters
名称Name类型Type说明Description
sessionIdString会话标识(类型 `String`)。The session id.
offsetint偏移量(类型 `int`)。The offset.
limitint数量上限(类型 `int`)。The limit.
返回Returns Map<String, Object>
返回映射。Returns map.
源码Source io/agentscope/extensions/aistio/transport/ContractProvider.java:37

subagents

public List<Map<String, Object>> subagents()

返回 subagents 结果。

Returns the subagents.

返回Returns List<Map<String, Object>>
返回列出>。Returns list.
源码Source io/agentscope/extensions/aistio/transport/ContractProvider.java:39

workspaces

public List<Map<String, Object>> workspaces()

返回 workspaces 结果。

Returns the workspaces.

返回Returns List<Map<String, Object>>
返回列出>。Returns list.
源码Source io/agentscope/extensions/aistio/transport/ContractProvider.java:41

compress

public void compress(String sessionId)

设置压缩。

Performs the compress operation.

参数Parameters
名称Name类型Type说明Description
sessionIdString会话标识(类型 `String`)。The session id.
源码Source io/agentscope/extensions/aistio/transport/ContractProvider.java:43

terminate

public void terminate(String sessionId)

设置该参数。

Performs the terminate operation.

参数Parameters
名称Name类型Type说明Description
sessionIdString会话标识(类型 `String`)。The session id.
源码Source io/agentscope/extensions/aistio/transport/ContractProvider.java:45

abort

public void abort(String sessionId)

设置中止。

Aborts the current turn without terminating the session.

参数Parameters
名称Name类型Type说明Description
sessionIdString会话标识(类型 `String`)。The session id.
源码Source io/agentscope/extensions/aistio/transport/ContractProvider.java:48

tasks

public Map<String, Object> tasks(String sessionId)

设置任务。

Session task inventory.

参数Parameters
名称Name类型Type说明Description
sessionIdString会话标识(类型 `String`)。The session id.
返回Returns Map<String, Object>
返回映射。Returns map.
源码Source io/agentscope/extensions/aistio/transport/ContractProvider.java:54

subagentTasks

default public Map<String, Object> subagentTasks(String sessionId)
default

设置子智能体任务。

Background subagent tasks (not todolist).

参数Parameters
名称Name类型Type说明Description
sessionIdString会话标识(类型 `String`)。The session id.
返回Returns Map<String, Object>
返回映射。Returns map.
源码Source io/agentscope/extensions/aistio/transport/ContractProvider.java:59–61

cancelSubagentTask

default public void cancelSubagentTask(String sessionId, String taskId)
default

执行取消子智能体任务相关操作。

Cancel a background subagent task.

参数Parameters
名称Name类型Type说明Description
sessionIdString会话标识(类型 `String`)。The session id.
taskIdString任务标识(类型 `String`)。The task id.
源码Source io/agentscope/extensions/aistio/transport/ContractProvider.java:64–66

planMode

default public void planMode(String sessionId, byte[] body)
default

执行计划模式相关操作。

Enter/exit plan mode.

参数Parameters
名称Name类型Type说明Description
sessionIdString会话标识(类型 `String`)。The session id.
bodybyte[]正文(类型 `byte[]`)。The body.
源码Source io/agentscope/extensions/aistio/transport/ContractProvider.java:69–71

postMessage

default public void postMessage(String sessionId, byte[] body)
default

执行后置消息相关操作。

Inject a user message into the live session.

参数Parameters
名称Name类型Type说明Description
sessionIdString会话标识(类型 `String`)。The session id.
bodybyte[]正文(类型 `byte[]`)。The body.
源码Source io/agentscope/extensions/aistio/transport/ContractProvider.java:77–79

exportTranscript

default public Map<String, Object> exportTranscript(String sessionId)
default

设置该参数。

Optional transcript export.

参数Parameters
名称Name类型Type说明Description
sessionIdString会话标识(类型 `String`)。The session id.
返回Returns Map<String, Object>
返回映射。Returns map.
源码Source io/agentscope/extensions/aistio/transport/ContractProvider.java:82–84

sessionPhase

default public String sessionPhase(String sessionId)
default

设置会话阶段。

Current phase string for command success responses.

参数Parameters
名称Name类型Type说明Description
sessionIdString会话标识(类型 `String`)。The session id.
返回Returns String
返回字符串结果。Returns a string.
源码Source io/agentscope/extensions/aistio/transport/ContractProvider.java:87–89

嵌套类详情Nested Class Detail

NotFoundException

class NotFoundException extends RuntimeException

未找到异常,表示执行过程中的错误。位于 io.agentscope.extensions.aistio.transport 包,继承自 RuntimeException。核心成员包括 NotFoundException。

Signals that the requested session or resource does not exist on this instance.

BusyException

class BusyException extends RuntimeException

Busy 异常,表示执行过程中的错误。位于 io.agentscope.extensions.aistio.transport 包,继承自 RuntimeException。核心成员包括 BusyException。

Signals the session is busy and the caller should wait until idle.

UnauthorizedException

class UnauthorizedException extends RuntimeException

Unauthorized 异常,表示执行过程中的错误。位于 io.agentscope.extensions.aistio.transport 包,继承自 RuntimeException。核心成员包括 UnauthorizedException。

Signals a missing or invalid internal token on a write endpoint.

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