agentscope.tracing

The tracing interface class in agentscope.

setup_tracing(endpoint)[源代码]

Set up the AgentScope tracing by configuring the endpoint URL.

参数:

endpoint (str) -- The endpoint URL for the tracing exporter.

返回类型:

None

trace(name)[源代码]

A generic tracing decorator for synchronous and asynchronous functions.

参数:

name (str) -- The name of the span to be created.

返回:

Returns a decorator that wraps the given function with OpenTelemetry tracing.

返回类型:

Callable

trace_llm(func)[源代码]

Trace the LLM call with OpenTelemetry.

参数:

func (Callable) -- The function to be traced, which should be a coroutine that returns either a ChatResponse or an AsyncGenerator of ChatResponse.

返回:

A wrapper function that traces the LLM call and handles input/output and exceptions.

返回类型:

Callable

trace_reply(func)[源代码]

Trace the agent reply call with OpenTelemetry.

参数:

func (Callable[..., Coroutine[Any, Any, Msg]]) -- The agent async reply function to be traced.

返回:

A wrapper function that traces the agent reply call and handles input/output and exceptions.

返回类型:

Callable[..., Coroutine[Any, Any, Msg]]

trace_format(func)[源代码]

Trace the format function of the formatter with OpenTelemetry.

参数:

func (Callable[..., Coroutine[Any, Any, list[dict]]]) -- The async format function to be traced.

返回:

An async wrapper function that traces the format call and handles input/output and exceptions.

返回类型:

Callable[..., Coroutine[Any, Any, list[dict]]]

trace_toolkit(func)[源代码]

Trace the toolkit call_tool_function method with OpenTelemetry.

参数:

func (Callable[[...], Coroutine[Any, Any, AsyncGenerator[ToolResponse, None]]])

返回类型:

Callable[[...], Coroutine[Any, Any, AsyncGenerator[ToolResponse, None]]]

trace_embedding(func)[源代码]

Trace the embedding call with OpenTelemetry.

参数:

func (Callable[[...], Coroutine[Any, Any, EmbeddingResponse]])

返回类型:

Callable[[...], Coroutine[Any, Any, EmbeddingResponse]]