Tutorials ASP.NET Core with Agentic AI Tutorial
Tool Calling — Complete Guide
Tool Calling — Complete Guide: free step-by-step lesson with examples, common mistakes, and interview tips — part of ASP.NET Core with Agentic AI Tutorial on Toolliyo Academy.
On this page
ASP.NET Core with Agentic AI Tutorial · Lesson 33 of 100
Tool Calling
AI basics → Agents
AI basics · 1 — Setup · ~6 min · Module 4: AI Agents and Multi-Agent Systems
What is this?
Tool calling is the model-driven pattern where the LLM emits structured tool invocations your runtime executes. AgentNest enables automatic function choice in SK agent loops for CRM and ERP queries.
Why should you care?
Users ask natural questions; tool calling maps them to GetAccount or fetch_balance without brittle keyword routing.
See it live — copy this example
Paste into an ASP.NET Core 8+ / AgentNest project, then run with dotnet run (set your API keys in user-secrets).
// AgentNest.Agents/ToolCalling/CrmToolAgent.cs
public sealed class CrmToolAgent(Kernel kernel)
{
public async Task<string> AskAsync(string question, CancellationToken ct)
{
var settings = new OpenAIPromptExecutionSettings { ToolCallBehavior = ToolCallBehavior.AutoInvokeKernelFunctions };
var chat = kernel.GetRequiredService<IChatCompletionService>();
var result = await chat.GetChatMessageContentAsync(question, settings, kernel, cancellationToken: ct);
return result.Content ?? "";
}
}
What happened?
- AutoInvokeKernelFunctions lets SK execute CrmPlugin tools when the model requests them, then continue until a final answer.
- Follow the steps below — typing the code yourself is the fastest way to learn.
Practice next
- Register CRM plugins on kernel before enabling auto invoke.
- Set ToolCallBehavior only on trusted internal routes.
- Log tool name and arguments on each auto invocation.
- Switch to RequireApproval for tools that send email.
- Return tool call trace JSON to the client for debugging.
Remember
Tool calling connects NL questions to kernel functions. AutoInvokeKernelFunctions runs tools inside SK chat loops. Log and validate every tool invocation.
CRM natural language
Reps type questions instead of clicking through CRM reports.
Outcome: CrmToolAgent auto-invokes GetPipeline without custom intent classifiers.
Interview prep for this lesson
Practice these questions aloud after reading—each links to a full structured answer.
Sign in to ask a question or upvote helpful answers.
No questions yet — be the first to ask!