← Back to Learn
sdkguardrailstutorialagent-safety

Semantic Kernel Safety Integration

Authensor

Microsoft Semantic Kernel provides a framework for building AI applications with plugins, planners, and memory. Its plugin system maps well to Authensor's tool-level policy enforcement. This guide covers integrating safety controls into Semantic Kernel applications.

Plugin Safety Wrapping

Semantic Kernel plugins expose functions that the AI can call. Wrap plugin functions with Authensor's safety layer to enforce policies on every invocation.

Create an Authensor filter that intercepts function calls before they execute. Semantic Kernel's filter pipeline supports pre-execution and post-execution hooks, which align with Authensor's evaluation and audit patterns.

In the pre-execution filter, construct an action envelope from the function name, arguments, and invoking agent identity. Submit it to Authensor's policy engine. If denied, short-circuit the function call and return an error result.

Planner Safety

Semantic Kernel's planners generate execution plans that chain multiple function calls. Safety checks on individual function calls are necessary but not sufficient. You also need to evaluate the plan as a whole.

Before executing a generated plan, submit it to Authensor for plan-level evaluation. The policy can enforce rules like maximum step count, forbidden function combinations, or required approval for plans that include sensitive operations.

Memory Safety

Semantic Kernel's memory abstraction stores and retrieves context. Apply the same RAG safety patterns described in the LlamaIndex guide: scan queries before retrieval, scan retrieved content for injection, and validate outputs against data access policies.

Prompt Rendering Safety

Semantic Kernel renders prompts from templates with variable substitution. Scan rendered prompts before sending them to the model. User-supplied variables might contain injection payloads that only become apparent after template rendering.

Cross-Plugin Policies

Define policies that govern interactions between plugins. A plugin that reads customer data should not be callable in the same plan as a plugin that sends emails, preventing data exfiltration through plugin chaining.

Authensor's policy language supports these cross-reference rules. The engine evaluates the full action context, including which other actions were recently approved for the same session.

Audit Integration

Log every plugin invocation, planner execution, and memory access to Authensor's receipt chain. This provides the audit trail needed for compliance and incident investigation in enterprise Semantic Kernel deployments.

Keep learning

Explore more guides on AI agent safety, prompt injection, and building secure systems.

View All Guides