Skip to main content
Available for: Python only.

Installation

Usage

Build your kernel, then call instrument_semantic_kernel(kernel, zespan.get_client()) to register Zespan’s tracing filters on it. This patches Semantic Kernel’s function-invocation and prompt-rendering filters to forward spans to Zespan — it takes both the Kernel instance and the active Zespan client explicitly, so call it after zespan.init() and after the kernel is constructed.
All kernel invocations, plugin function calls, and LLM completions are traced automatically after calling instrument_semantic_kernel().

What gets captured

Semantic Kernel connectors vary in whether they populate token usage metadata on the invocation context. If input/output tokens show as 0, check whether your connector (e.g. OpenAIChatCompletion) surfaces usage on the result — this is a Semantic Kernel connector limitation, not something instrument_semantic_kernel() controls.