AS AgentScopeAPI 手册 / API Reference

AgentscopeDrainEndpoint

@Endpoint(id = "agentscope-drain") public class AgentscopeDrainEndpoint
源码Source io/agentscope/spring/boot/admin/endpoint/AgentscopeDrainEndpoint.java:42–95

Agentscope Drain 端点,承载智能体的部署、调度与服务化运行。位于 io.agentscope.spring.boot.admin.endpoint 包。核心成员包括 currentDrainStatus、drain、AgentscopeDrainEndpoint。

POST /actuator/agentscope-drain: stop accepting new agent requests, wait for in-flight ones to finish, but do NOT terminate the JVM.

This is the production-friendly "let me bring this node out of the load balancer" knob: health probes (e.g. /actuator/health) can flip to red, in-flight reasoning completes naturally, and the process stays alive for log collection.

Drain is idempotent — second invocation is a no-op. Because Actuator's @WriteOperation does not surface raw HTTP headers, the token check is enforced via the confirm parameter; production deployments should layer Spring Security on top of /actuator/**.

构造器摘要Constructor Summary

构造器Constructor说明Description
public AgentscopeDrainEndpoint(AdminProperties properties, AdminAuditLogger audit)
初始化 `AgentscopeDrainEndpoint` 实例。
Creates a new instance.

方法摘要Method Summary

方法Method说明Description
public Map<String, Object> currentDrainStatus()
返回 `currentDrainStatus` 结果。
Returns the current drain status.
public Map<String, Object> drain(String confirm, String token)
执行 `drain` 方法。
Performs the drain operation.

构造器详情Constructor Detail

AgentscopeDrainEndpoint

public AgentscopeDrainEndpoint(AdminProperties properties, AdminAuditLogger audit)

初始化 AgentscopeDrainEndpoint 实例。

Creates a new instance.

参数Parameters
名称Name类型Type说明Description
propertiesAdminProperties属性(类型 `AdminProperties`)。The properties.
auditAdminAuditLoggeraudit(类型 `AdminAuditLogger`)。The audit.
源码Source io/agentscope/spring/boot/admin/endpoint/AgentscopeDrainEndpoint.java:50–53

方法详情Method Detail

currentDrainStatus

public Map<String, Object> currentDrainStatus()

返回 currentDrainStatus 结果。

Returns the current drain status.

返回Returns Map<String, Object>
返回映射。Returns map.
源码Source io/agentscope/spring/boot/admin/endpoint/AgentscopeDrainEndpoint.java:55–63

drain

public Map<String, Object> drain(String confirm, String token)

执行 drain 方法。

Performs the drain operation.

参数Parameters
名称Name类型Type说明Description
confirmString确认(类型 `String`)。The confirm.
tokenString令牌(类型 `String`)。The token.
返回Returns Map<String, Object>
返回映射。Returns map.
源码Source io/agentscope/spring/boot/admin/endpoint/AgentscopeDrainEndpoint.java:65–94
基于官方固定版本源码静态生成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.