AS AgentScopeAPI 手册 / API Reference

AgentscopeUsageEndpoint

@Endpoint(id = "agentscope-usage") public class AgentscopeUsageEndpoint
源码Source io/agentscope/spring/boot/admin/endpoint/AgentscopeUsageEndpoint.java:33–58

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

GET /actuator/agentscope-usage: process-cumulative token usage, sliced both by agent name and by model name.

Counters reset on JVM restart (in-process only). For long-horizon billing, forward the derived io.agentscope.spring.boot.admin.audit.AdminAuditEvents into your data warehouse instead of relying on this endpoint.

构造器摘要Constructor Summary

构造器Constructor说明Description
public AgentscopeUsageEndpoint(MetricsRecorder recorder)
初始化 `AgentscopeUsageEndpoint` 实例。
Creates a new instance.

方法摘要Method Summary

方法Method说明Description
public Map<String, Object> usage()
返回用量。
Returns the usage.
public UsageStats forAgent(String agentName)
设置用于智能体。
Convenience for callers asking only about a single agent.

构造器详情Constructor Detail

AgentscopeUsageEndpoint

public AgentscopeUsageEndpoint(MetricsRecorder recorder)

初始化 AgentscopeUsageEndpoint 实例。

Creates a new instance.

参数Parameters
名称Name类型Type说明Description
recorderMetricsRecorder记录器(类型 `MetricsRecorder`)。The recorder.
源码Source io/agentscope/spring/boot/admin/endpoint/AgentscopeUsageEndpoint.java:38–40

方法详情Method Detail

usage

public Map<String, Object> usage()

返回用量。

Returns the usage.

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

forAgent

public UsageStats forAgent(String agentName)

设置用于智能体。

Convenience for callers asking only about a single agent.

参数Parameters
名称Name类型Type说明Description
agentNameString智能体名称(类型 `String`)。The agent name.
返回Returns UsageStats
返回UsageStats。Returns usage stats.
源码Source io/agentscope/spring/boot/admin/endpoint/AgentscopeUsageEndpoint.java:52–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.