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:Googleapis Python genai Tool Configuration

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

Overview

A configuration mechanism that controls how a language model interacts with declared tools, including automatic execution behavior and function calling modes.

Description

Tool Configuration governs the behavior of the function calling loop. It determines whether functions are called automatically (the SDK executes functions and feeds results back) or manually (the application handles function execution). It also controls function calling modes (AUTO: model decides, ANY: force a function call, NONE: disable) and safety limits (maximum number of automatic calls). This configuration is critical for balancing automation with control in tool-augmented generation.

Usage

Use automatic function calling (AFC) for simple tool-use scenarios where the SDK can handle the execution loop. Disable AFC and handle execution manually when you need custom logic (e.g., user confirmation, async execution, or result transformation). Set maximum_remote_calls to limit runaway loops. Use ToolConfig with function_calling_config mode to force or prevent function calls.

Theoretical Basis

Tool configuration addresses the agent loop control problem:

# Automatic Function Calling loop (pseudo-code)
while True:
    response = model.generate(contents, tools)
    if response.has_function_calls() and afc_enabled:
        results = execute_functions(response.function_calls)
        contents.append(response)
        contents.append(function_results)
        remote_calls += 1
        if remote_calls >= max_remote_calls:
            break
    else:
        return response  # Final text response

Modes:

  • AUTO: Model decides whether to call a function or generate text
  • ANY: Model must call one of the declared functions
  • NONE: Model cannot call functions (text-only generation)

Related Pages

Implemented By

Uses Heuristic

Page Connections

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