AS AgentScopeAPI 手册 / API Reference

TelemetryTracer

public class TelemetryTracer implements Tracer
源码Source io/agentscope/core/tracing/telemetry/TelemetryTracer.java:67–322

遥测追踪器,对智能体行为进行评测、追踪与可观测性分析。位于 io.agentscope.core.tracing.telemetry 包,实现 Tracer。核心成员包括 callAgent、callModel、callTool、callFormat、runWithContext、shutdown。

A class in io.agentscope.core.tracing.telemetry that evaluates agent behaviour and records tracing and telemetry data. Declared in io.agentscope.core.tracing.telemetry. Implements Tracer.

嵌套类摘要Nested Class Summary

类Class类型Kind说明Description
Builder类class
构建器,用于构建并配置目标实例。
A class in io.agentscope.core.tracing.telemetry that evaluates agent behaviour and records tracing and telemetry data.

构造器摘要Constructor Summary

构造器Constructor说明Description
public TelemetryTracer(io.opentelemetry.api.trace.Tracer tracer)
初始化 `TelemetryTracer` 实例。
Creates a new instance.

方法摘要Method Summary

方法Method说明Description
public Mono<Msg> callAgent(AgentBase instance, List<Msg> inputMessages, Supplier<Mono<Msg>> agentCall)
调用智能体。
Calls the agent.
public Flux<ChatResponse> callModel(ChatModelBase instance, List<Msg> inputMessages, List<ToolSchema> toolSchemas, GenerateOptions options, Supplier<Flux<ChatResponse>> modelCall)
调用模型。
Calls the model.
public Mono<ToolResultBlock> callTool(Toolkit instance, ToolCallParam toolCallParam, Supplier<Mono<ToolResultBlock>> toolKitCall)
调用工具。
Calls the tool.
public TReq TResp TParams List<TReq> callFormat(AbstractBaseFormatter<TReq, TResp, TParams> formatter, List<Msg> msgs, Supplier<List<TReq>> formatCall)
调用格式。
Calls the format.
public TResp TResp runWithContext(ContextView reactorCtx, Supplier<TResp> inner)
运行使用上下文。
Runs the with context.
public void shutdown()
关闭资源并释放连接。
Releases resources and connections.
public static Builder builder()
static
返回构建器实例。
Returns the builder.

构造器详情Constructor Detail

TelemetryTracer

public TelemetryTracer(io.opentelemetry.api.trace.Tracer tracer)

初始化 TelemetryTracer 实例。

Creates a new instance.

参数Parameters
名称Name类型Type说明Description
tracerio.opentelemetry.api.trace.Tracer追踪器(类型 `io.opentelemetry.api.trace.Tracer`)。The tracer.
源码Source io/agentscope/core/tracing/telemetry/TelemetryTracer.java:72–74

方法详情Method Detail

callAgent

public Mono<Msg> callAgent(AgentBase instance, List<Msg> inputMessages, Supplier<Mono<Msg>> agentCall)

调用智能体。

Calls the agent.

参数Parameters
名称Name类型Type说明Description
instanceAgentBase实例(类型 `AgentBase`)。The instance.
inputMessagesList<Msg>输入消息(类型 `List`)。The input messages.
agentCallSupplier<Mono<Msg>>智能体调用(类型 `Supplier >`)。The agent call.
返回Returns Mono<Msg>
返回Mono。Returns mono.
源码Source io/agentscope/core/tracing/telemetry/TelemetryTracer.java:82–114

callModel

public Flux<ChatResponse> callModel(ChatModelBase instance, List<Msg> inputMessages, List<ToolSchema> toolSchemas, GenerateOptions options, Supplier<Flux<ChatResponse>> modelCall)

调用模型。

Calls the model.

参数Parameters
名称Name类型Type说明Description
instanceChatModelBase实例(类型 `ChatModelBase`)。The instance.
inputMessagesList<Msg>输入消息(类型 `List`)。The input messages.
toolSchemasList<ToolSchema>工具模式(类型 `List`)。The tool schemas.
optionsGenerateOptions选项(类型 `GenerateOptions`)。The options.
modelCallSupplier<Flux<ChatResponse>>模型调用(类型 `Supplier >`)。The model call.
返回Returns Flux<ChatResponse>
返回Flux。Returns flux.
源码Source io/agentscope/core/tracing/telemetry/TelemetryTracer.java:116–158

callTool

public Mono<ToolResultBlock> callTool(Toolkit instance, ToolCallParam toolCallParam, Supplier<Mono<ToolResultBlock>> toolKitCall)

调用工具。

Calls the tool.

参数Parameters
名称Name类型Type说明Description
instanceToolkit实例(类型 `Toolkit`)。The instance.
toolCallParamToolCallParam工具调用参数(类型 `ToolCallParam`)。The tool call param.
toolKitCallSupplier<Mono<ToolResultBlock>>工具包调用(类型 `Supplier >`)。The tool kit call.
返回Returns Mono<ToolResultBlock>
返回Mono。Returns mono.
源码Source io/agentscope/core/tracing/telemetry/TelemetryTracer.java:160–201

callFormat

public TReq TResp TParams List<TReq> callFormat(AbstractBaseFormatter<TReq, TResp, TParams> formatter, List<Msg> msgs, Supplier<List<TReq>> formatCall)

调用格式。

Calls the format.

参数Parameters
名称Name类型Type说明Description
formatterAbstractBaseFormatter<TReq, TResp, TParams>格式化器(类型 `AbstractBaseFormatter`)。The formatter.
msgsList<Msg>消息列表(类型 `List`)。The msgs.
formatCallSupplier<List<TReq>>格式调用(类型 `Supplier >`)。The format call.
返回Returns List<TReq>
返回列出。Returns list.
源码Source io/agentscope/core/tracing/telemetry/TelemetryTracer.java:203–226

runWithContext

public TResp TResp runWithContext(ContextView reactorCtx, Supplier<TResp> inner)

运行使用上下文。

Runs the with context.

参数Parameters
名称Name类型Type说明Description
reactorCtxContextViewreactor Ctx(类型 `ContextView`)。The reactor ctx.
innerSupplier<TResp>inner(类型 `Supplier`)。The inner.
返回Returns TResp
返回TResp。Returns t resp.
源码Source io/agentscope/core/tracing/telemetry/TelemetryTracer.java:228–234

shutdown

public void shutdown()

关闭资源并释放连接。

Releases resources and connections.

源码Source io/agentscope/core/tracing/telemetry/TelemetryTracer.java:236–241

builder

public static Builder builder()
static

返回构建器实例。

Returns the builder.

返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/core/tracing/telemetry/TelemetryTracer.java:243–245

嵌套类详情Nested Class Detail

Builder

public static class Builder

构建器,用于构建并配置目标实例。位于 io.agentscope.core.tracing.telemetry 包。核心成员包括 enabled、endpoint、addHeader、headers、tracer、build。

A class in io.agentscope.core.tracing.telemetry that evaluates agent behaviour and records tracing and telemetry data. Declared in io.agentscope.core.tracing.telemetry.

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