Jump to content

Connect Leeroopedia MCP: Equip your AI agents to search best practices, build plans, verify code, diagnose failures, and look up hyperparameter defaults.

Principle:Microsoft Semantic kernel Function Choice Behavior

From Leeroopedia
Knowledge Sources
Domains AI_Orchestration, Function_Calling, Tool_Use
Last Updated 2026-02-11 19:00 GMT

Overview

Function choice behavior governs how an AI model selects and invokes registered functions, ranging from fully autonomous selection to constrained or informational modes.

Description

Function Choice Behavior is the principle that defines the contract between the AI orchestration framework and the AI model regarding which functions are available and how the model may use them. When function calling is enabled, the framework must communicate to the AI model not just what functions exist, but also the rules of engagement for calling them. This is captured by the function choice behavior configuration.

The Semantic Kernel framework defines three distinct behavior modes:

  • Auto: The model is free to decide whether to call any function and, if so, which ones. This is the most flexible mode, enabling fully autonomous tool use. When autoInvoke is true (the default), the framework automatically executes the functions the model requests and feeds the results back to the model for continued reasoning. When autoInvoke is false, the framework returns the function call requests to the caller for manual execution.
  • Required: The model is forced to call at least one of the provided functions. After the first invocation round, the framework stops advertising functions to prevent infinite loops of function calling. This mode is useful when a specific action must be taken before the model generates its final response.
  • None: The model is shown the available functions but instructed not to call them. Instead, the model may describe which functions it would call and with what arguments. This mode is useful for validation scenarios where a human must approve function calls before execution.

The behavior is configured through the PromptExecutionSettings and travels with the request, allowing different behaviors for different prompts within the same kernel.

Usage

Use function choice behavior whenever you need to control how the AI model interacts with registered plugins. Use Auto for general-purpose conversational agents that should be able to call tools on their own. Use Required when a specific function must be called as part of the workflow. Use None for auditing, previewing, or human-in-the-loop scenarios where function calls need approval before execution.

Theoretical Basis

Function Choice Behavior implements a Policy Pattern that governs the tool-use decision space of an AI model. The behavior acts as a policy object that constrains the model's action space at each turn of the conversation.

Formal model:

Let F be the set of all registered functions across all kernel plugins. A function choice behavior B defines a policy function:

B: (F, Turn) -> (AdvertisedFunctions, InvocationMode)

Where:

  • AdvertisedFunctions is the subset of F presented to the model at a given turn.
  • InvocationMode is one of {auto_invoke, manual_invoke, no_invoke}.

For each behavior type:

Auto(F, t):
  AdvertisedFunctions = filter(F) or F    (all functions or a specified subset)
  InvocationMode = auto_invoke | manual_invoke (based on autoInvoke parameter)

Required(F, t):
  AdvertisedFunctions = filter(F) or F    if t == first_turn
  AdvertisedFunctions = {}                if t > first_turn  (prevents loops)
  InvocationMode = auto_invoke | manual_invoke

None(F, t):
  AdvertisedFunctions = filter(F) or F
  InvocationMode = no_invoke

Key invariants:

  • Auto-invoke requires kernel: If autoInvoke is true, a kernel must be provided so the framework can execute the functions. Without a kernel, a KernelException is thrown.
  • Function resolution: When specific functions are named in the behavior, they must exist either in the kernel's plugins or in the behavior's provided function list.
  • Loop prevention: The Required behavior automatically stops advertising functions after the first invocation round to prevent the model from infinitely calling the same functions.

Related Pages

Implemented By

Uses Heuristic

Page Connections

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