AS AgentScopeAPI 手册 / API Reference

Service

public interface Service
源码Source io/agentscope/runtime/engine/services/Service.java:40–58

服务的抽象基类。位于 io.agentscope.runtime.engine.services 包。核心成员包括 start、stop、health。

Abstract base class for services.

This class defines the interface that all services must implement. Services provide lifecycle management (start, stop, health check) and can be used with try-with-resources pattern for automatic cleanup.

Usage Example:

`Service service = new MyService();

// Manual lifecycle management
service.start().join();
try {
// Use service
boolean healthy = service.health().join();
} finally {
service.stop().join();
}
`

方法摘要Method Summary

方法Method说明Description
public void start()
执行启动相关操作。
Starts the service, initializing any necessary resources or connections.
public void stop()
执行停止相关操作。
Stops the service, releasing any acquired resources.
public boolean health()
检查健康状态的服务。
Checks the health of the service.

方法详情Method Detail

start

public void start()

执行启动相关操作。

Starts the service, initializing any necessary resources or connections.

源码Source io/agentscope/runtime/engine/services/Service.java:45

stop

public void stop()

执行停止相关操作。

Stops the service, releasing any acquired resources.

源码Source io/agentscope/runtime/engine/services/Service.java:50

health

public boolean health()

检查健康状态的服务。

Checks the health of the service.

返回Returns boolean
返回布尔值,表示判断结果。Returns a boolean result.
源码Source io/agentscope/runtime/engine/services/Service.java:57
基于官方固定版本源码静态生成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.