What gets captured
Architecture
Python implementation
1
Install dependencies
2
Configure Cognisafe and patch OpenAI
Call
cognisafe.configure and cognisafe.patch_openai before constructing the SK kernel. The patch rewrites the OpenAI client’s base_url — SK’s OpenAIChatCompletion connector inherits this automatically.3
Add plugins and invoke the planner
Plugins and function invocations are captured as part of the LLM calls that SK makes to orchestrate them. The arguments and results are visible in
request_body and response_body in the Cognisafe dashboard..NET / C# implementation
SK for .NET usesHttpClient under the hood. Configure the proxy base URL on the HttpClient that the kernel’s OpenAI connector uses.
1
Install packages
2
Configure the kernel with Cognisafe proxy
3
Invoke with execution settings
Plugin and function call security
SK’s function-calling loop can invoke plugins repeatedly within a single plan. Each LLM call that includes function invocation instructions is logged separately. In the Cognisafe dashboard, filter byagent_name = "customer-support-agent" to see the full invocation chain for a single user request.
To detect dangerous function call patterns, configure a custom scorer in evals/scorers.yaml:
threat_detected webhook if any of the listed function names appear in the tool call arguments.
Planner patterns and observability
SequentialPlanner generates a complete plan before execution. In Cognisafe, you will see:- One LLM call for plan generation (typically a large
request_bodycontaining the goal and available plugin descriptions). - One LLM call per plan step during execution.
model and agent_name in the dashboard and sort by created_at to reconstruct the full reasoning chain for any agent execution.
Semantic Memory (embeddings)
When SK calls a vector store to retrieve memories, the embedding generation call goes through the patched OpenAI client and is therefore logged. Themodel field will be text-embedding-3-small (or whichever embedding model you configure). These calls are low-cost but high-frequency — use the Cognisafe cost dashboard to track embedding spend separately from completion spend.
Agent tagging
Setkernel.name in Python or kernel.Data["agent_name"] in .NET before any invocation. Cognisafe reads the X-Cognisafe-Agent-Name header (injected by the SDK) and writes it to llm_requests.agent_name. All dashboard groupings, alert rules, and cost breakdowns are keyed on this field.
For multi-agent systems (e.g. an orchestrator kernel that spawns specialist sub-kernels), use distinct names:

