Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Principle:Microsoft Semantic kernel Agent Plugin Equipment

From Leeroopedia

Overview

Agent Plugin Equipment is the principle of extending an agent's capabilities by attaching plugins that provide callable tools. In Microsoft Semantic Kernel, plugins are collections of functions that an agent can invoke during conversation to perform actions beyond pure text generation -- such as querying databases, calling APIs, performing calculations, or accessing real-time data.

This principle belongs to Workflow 3: Agent Conversation and Orchestration and represents the mechanism by which agents gain the ability to interact with the external world.

Description

Plugins as Agent Equipment

An agent without plugins can only generate text based on its training data and instructions. By equipping an agent with plugins, developers grant it the ability to:

  • Retrieve information -- Access real-time data such as current time, weather, stock prices, or database records.
  • Perform computations -- Execute mathematical operations, data transformations, or business logic.
  • Take actions -- Send emails, create records, trigger workflows, or modify external state.
  • Access domain knowledge -- Query specialized knowledge bases, search engines, or document stores.

The metaphor of equipment is intentional: just as a worker needs tools to perform tasks beyond basic reasoning, an agent needs plugins to perform tasks beyond text generation.

The Plugin Architecture

Semantic Kernel's plugin system is built on several key concepts:

  1. KernelPlugin -- A named collection of KernelFunction instances that represent related capabilities (e.g., a TimePlugin with functions like GetCurrentTime, GetDate).
  2. KernelPluginFactory -- A factory class that creates plugins from annotated C# classes using CreateFromType<T>(), automatically discovering methods decorated with [KernelFunction].
  3. Kernel.Plugins -- A collection on the Kernel instance where plugins are registered. Any plugin added here becomes available to agents that use this kernel.
  4. Function Calling -- When the underlying AI model supports function calling (tool use), the agent automatically advertises its available plugins as callable tools and handles the invoke-respond cycle.

How Plugin Equipment Works

The flow from plugin registration to agent tool use follows this sequence:

  1. Developer creates a plugin class with [KernelFunction]-annotated methods.
  2. Developer registers the plugin on the agent's Kernel via kernel.Plugins.Add(...).
  3. When the agent is invoked, Semantic Kernel serializes the plugin functions as tool definitions in the chat completion request.
  4. The AI model may choose to call one or more tools in its response.
  5. Semantic Kernel automatically invokes the corresponding KernelFunction and feeds the result back to the model.
  6. The model incorporates the tool results into its final response.

This entire cycle is transparent to the developer -- the agent handles tool calling internally.

Plugin Attachment Timing

Plugins can be attached to the kernel at different points:

  • Before agent creation -- Plugins added to the kernel before constructing the agent are available from the first invocation.
  • After agent creation -- Since the agent holds a reference to the kernel, plugins added to agent.Kernel.Plugins after construction are also available on subsequent invocations.
  • Shared kernel -- Multiple agents can share the same kernel (and thus the same plugins), or each agent can have its own kernel with a different plugin set, creating specialization.

Usage

Agent Plugin Equipment is used whenever an agent needs to:

  • Answer questions that require real-time or external data.
  • Perform actions with side effects (sending messages, writing files, calling APIs).
  • Execute deterministic computations that a language model should not approximate.
  • Access tools that are specific to the application domain.

Typical Plugin Attachment Pattern

// Define a plugin class
public class TimePlugin
{
    [KernelFunction, Description("Gets the current UTC time")]
    public string GetCurrentTime() => DateTime.UtcNow.ToString("o");
}

// Create the plugin and add to kernel
var plugin = KernelPluginFactory.CreateFromType<TimePlugin>();
kernel.Plugins.Add(plugin);

// Create agent — it automatically has access to TimePlugin
ChatCompletionAgent agent = new()
{
    Name = "TimeKeeper",
    Instructions = "You help users with time-related questions. Use your tools.",
    Kernel = kernel
};

Post-Creation Plugin Attachment

ChatCompletionAgent agent = new()
{
    Name = "Assistant",
    Instructions = "You are a helpful assistant.",
    Kernel = kernel
};

// Add plugins after agent creation
agent.Kernel.Plugins.Add(KernelPluginFactory.CreateFromType<WeatherPlugin>());
agent.Kernel.Plugins.Add(KernelPluginFactory.CreateFromType<CalculatorPlugin>());

Theoretical Basis

The Agent Plugin Equipment principle is grounded in the Tool Use paradigm in AI agent research. The seminal concept -- that language models can be augmented with external tools to overcome their inherent limitations (lack of real-time data, inability to perform precise computations, no access to external systems) -- has become a cornerstone of modern AI agent architectures.

This principle also reflects the Strategy Pattern from object-oriented design: the agent's behavior is extended not by modifying its core logic, but by composing it with interchangeable strategy objects (plugins) that provide specific capabilities.

Furthermore, the separation of reasoning (the language model) from action (the plugins) aligns with the ReAct pattern (Reasoning + Acting), where an agent alternates between thinking about what to do and executing tools to gather information or take action.

Related Pages

Implemented By

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment