AgentscopeDrainEndpoint
@Endpoint(id = "agentscope-drain") public class AgentscopeDrainEndpoint
io/agentscope/spring/boot/admin/endpoint/AgentscopeDrainEndpoint.java:42–95Agentscope 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.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
properties | AdminProperties | 属性(类型 `AdminProperties`)。The properties. |
audit | AdminAuditLogger | audit(类型 `AdminAuditLogger`)。The audit. |
io/agentscope/spring/boot/admin/endpoint/AgentscopeDrainEndpoint.java:50–53方法详情Method Detail
currentDrainStatus
public Map<String, Object> currentDrainStatus()
返回 currentDrainStatus 结果。
Returns the current drain status.
Map<String, Object>io/agentscope/spring/boot/admin/endpoint/AgentscopeDrainEndpoint.java:55–63drain
public Map<String, Object> drain(String confirm, String token)
执行 drain 方法。
Performs the drain operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
confirm | String | 确认(类型 `String`)。The confirm. |
token | String | 令牌(类型 `String`)。The token. |
Map<String, Object>io/agentscope/spring/boot/admin/endpoint/AgentscopeDrainEndpoint.java:65–94