Skip to main content
The Semantic Kernel integration is available for Python only.

Installation

pip install zespan semantic-kernel

Usage

Call instrument_semantic_kernel() once after zespan.init(). It patches Semantic Kernel’s telemetry layer to forward spans to Zespan.
import asyncio
import zespan
from zespan import instrument_semantic_kernel
import semantic_kernel as sk
from semantic_kernel.connectors.ai.open_ai import OpenAIChatCompletion

zespan.init(api_key="zsp_your_api_key_here")
instrument_semantic_kernel()

kernel = sk.Kernel()
kernel.add_service(OpenAIChatCompletion(
    service_id="chat",
    ai_model_id="gpt-4o",
))

async def main():
    result = await kernel.invoke_prompt(
        "What is the capital of France?",
        service_id="chat",
    )
    print(result)

asyncio.run(main())
All kernel invocations, plugin function calls, and LLM completions are traced automatically after calling instrument_semantic_kernel().