---
title: Tool Call with Auto Invoke Kernel Functions
---
sequenceDiagram
    participant Client
    participant Plugin
    participant Kernel
    participant AI Service
    participant LLM
    Client->>+AI Service: Invoke Chat Completion with Auto Function Call
    AI Service->>+LLM: Chat Completion
    loop For Each Tool LLM Requires
    LLM->>-AI Service: Tool Call Request
    AI Service->>AI Service: Update Local Chat History
    loop For Each Tool in Tool Call Request
    AI Service->>+Kernel: Function Call
    Kernel->>+Plugin: Invoke Function
    Plugin->>-Kernel: Function Result
    Kernel->>-AI Service: Function Call Result
    end
    AI Service->>AI Service: Update Local Chat History
    AI Service->>+LLM: Tool Call Response
    end
    LLM->>-AI Service: Chat Completion Response
    AI Service->>AI Service: Update Local Chat History
    AI Service->>-Client: Chat Completion Response
