Integrations
Semantic Kernel
Trace Microsoft Semantic Kernel applications in Muster via OpenLit instrumentation.
Semantic Kernel is an open-source SDK from Microsoft that integrates LLMs with C#, Python, and Java codebases. Muster captures Semantic Kernel runs through OpenLit instrumentation.
Setup
1. Install dependencies
pip install langfuse openlit semantic-kernel2. Configure credentials
import os
os.environ["LANGFUSE_PUBLIC_KEY"] = "pk-lf-..."
os.environ["LANGFUSE_SECRET_KEY"] = "sk-lf-..."
os.environ["LANGFUSE_BASE_URL"] = "https://app.getmuster.io"
os.environ["OPENAI_API_KEY"] = "sk-proj-..."from langfuse import get_client
langfuse = get_client()
if langfuse.auth_check():
print("Muster client is authenticated and ready!")3. Initialize OpenLit instrumentation
import openlit
openlit.init()OpenLit automatically instruments Semantic Kernel and exports OpenTelemetry spans to Muster.
4. Build and invoke a kernel
from semantic_kernel import Kernel
from semantic_kernel.connectors.ai.open_ai import OpenAIChatCompletion
from semantic_kernel.functions import KernelArguments
kernel = Kernel()
kernel.add_service(OpenAIChatCompletion(
service_id="default",
ai_model_id="gpt-4o-mini",
))
answer = await kernel.invoke_prompt("What is Muster?")
print(answer)Add user/session attributes
from langfuse import propagate_attributes
with propagate_attributes(user_id="user_123", session_id="sess_abc", tags=["semantic-kernel"]):
await kernel.invoke_prompt(...)Troubleshooting
- Enable debug mode and verify instrumentation runs before application code.
- Filter unrelated OTel spans from other libraries.
- Some attributes are stored in metadata rather than mapped fields.