9 Safeguarding the Kernel Functions with Filters

 

This chapter covers

  • What are a semi-autonomous agent and a copilot? Comparison.
  • Introduction to filters
  • Filter types: function invocation filters, prompt render filters, and auto function invocation filters
  • OpenTelemetry with Semantic Kernel using Console Exporter

Imagine Robby the robot car driving through a challenging environment. To keep Robby safe and on the right track, we sometimes need to tweak his actions or even stop him for a quick human check. Semantic Kernel filters work the same way for your AI models: they step in when taking actions, such as when a function is called, or when a request is about to be sent to the AI. This is especially useful for scenarios like human-in-the-loop validation, where a person reviews the AI’s actions before they proceed. Filters also help you monitor function calls, collect telemetry, and add custom logic for logging, error handling, or blocking unsafe content, just like Robby’s sensors warn him about obstacles ahead.

In this chapter, we will learn how to build semi-autonomous agents and copilots.

9.1 What is a Semi-Autonomous Agent

9.2 What is a Copilot

9.3 Comparing Chatbots, Copilots, and Agents

9.4 Introducing Filtering

9.4.1 Filter Pipeline Architecture

9.5 Types of filters

9.5.1 Function Invocation Filters

9.5.2 Prompt Rendering Filters

9.5.3 Auto Function Invocation Filters

9.6 Implementing Telemetry for Monitoring and Debugging

9.6.1 OpenTelemetry using Console Exporter

9.7 Other Use Cases

9.7.1 Conclusions

Summary