Solutions · AI agents · Single function calling

One prompt. One method.

Not every workload needs a full agent loop. Many real interactions reduce to "the user said something; pick the right method and call it." SingleFunctionCall is the focused, low-overhead path for exactly that: a registry of C# methods, a natural-language prompt, an LLM-driven selection with typed argument extraction, and an optional auto-invoke. No planning, no orchestration, no agent state.

One selected method Typed parameters Confidence scored

Plugin registry

Register classes whose methods carry [LMFunction]. The caller discovers candidates by reflection.

Single selection

The model picks exactly one method per prompt. Returns the choice, the extracted parameters, and a confidence score.

Optional auto-invoke

Run the chosen method immediately, or hand the result back for the caller to invoke. Both flows supported.

Why a lightweight path

Agents are not always the answer.

Agent frameworks are powerful and heavy. Planning loops, tool policies, memory, orchestration, observability all add up. Many use cases do not need any of that. A search box that maps to a method. A voice command that triggers an action. An admin form that interprets a freeform instruction. SingleFunctionCall serves those without paying the agent tax.

Lower latency

No planning loop, no tool-iteration loop, no orchestration round-trips. One inference pass, one selected method, one set of parameters.

Smaller mental model

Two concepts: a plugin (a class with annotated methods) and a call. Reads like a function-router, behaves like one.

Same attribute system

[LMFunction] annotations work for both single function calling and agent tools. Investments in method metadata transfer when you graduate to full agents.

Confidence aware

Every call returns a confidence score. Below your threshold, fall back to a clarifying question. Above it, run.

Force-mode

When you know the user must hit one of N methods, force selection: the model chooses among the registered set rather than refusing.

Graduates cleanly

Outgrowing the lightweight path? Lift the same plugins into Agent.Tools. The annotations and signatures transfer; nothing wasted.

Shape of the API

Three things to know.

SingleFunctionCall

The caller

Constructed with an LM. Holds a Plugins collection. Exposes Invoke and InvokeAsync. Configurable for force-mode, force-method, and auto-invocation.

[LMFunction]

The annotation

Marks a method as callable. Optional Name and Description fields. Method parameters become typed extraction targets; XML doc comments become parameter descriptions.

FunctionCallResult

The result

Method (the selected MethodInfo), Parameters (extracted, typed), Result (the return value if auto-invoked), and Confidence (0 to 1).

Three patterns

From prompt to method.

One inference pass picks the right method on a plugin and extracts its parameters from the prompt.

QuickRoute.cs
using LMKit.FunctionCalling;
using LMKit.Agents.Tools;

// Annotate methods with [LMFunction]. The class is the plugin.
public class BookPlugin
{
    [LMFunction(Description = "Search the catalogue by author and genre")]
    public List<Book> SearchBooks(string author, string genre) => ...

    [LMFunction(Description = "Reserve a copy of a known book")]
    public Reservation Reserve(string isbn, string patronId) => ...
}

// One inference pass picks the right method and extracts the parameters.
var caller = new SingleFunctionCall(model);
caller.Plugins.Add(new BookPlugin());

FunctionCallResult r = await caller.InvokeAsync(
    "Find me a thriller written by an author whose surname starts with K.");

Console.WriteLine(r.Method.Name);     // SearchBooks
Console.WriteLine(r.Confidence);      // 0.92
Where this fits

Real workloads.

In-app search box

A power-user search input that maps freeform queries to one of a dozen actions. No agent needed; one method runs per query.

Voice commands

Speech-to-text feeds a registry of voice handlers. Force-mode plus a confidence threshold gives a clean "I did not understand" branch.

Admin command palette

An ops engineer types a freeform request; the right management endpoint runs. No tool-call loop, no agent log noise.

Slack / Teams bots

Single message, single intent, single action. The bot replies with the result rather than continuing a conversation.

Form pre-fill

Paste a freeform request into a "describe what you want" field. The right form opens with the right fields populated.

Onboarding before agents

Teams new to AI start here. Same [LMFunction] attributes, same C# methods, lower mental model. Graduate to Agent.Tools when the workflow demands it.

Versus the alternatives

Two heavy options, or this one.

Roll your own router

Hand-written keyword matching, regex, fuzzy search, plus a fallback when none match. Brittle. Breaks on phrasing the author did not anticipate. No typed parameters.

Full agent framework

Powerful, but the planning loop, tool policies, memory, and orchestration are overkill when one method needs to run. Latency and complexity for capability you do not use.

SingleFunctionCall

One inference pass. One method picked. Typed parameters extracted. Confidence scored. Lower latency than agents, smarter than handwritten routers, attribute-compatible with the agent tooling you grow into.

Related capabilities

Single calls plus the rest.

Tools & function calling

When the workflow needs more than one tool call, graduate to the agent path. Same attributes, more orchestration.

Tools & function calling

Structured content creation

Grammar-constrained generation backs the parameter extraction so the model cannot emit malformed arguments.

Structured generation

Prompt templates

Compose dynamic prompts that flow into SingleFunctionCall. Templates plus single-call routing covers a surprising amount of UI surface.

Prompt templates

Conversation primitives

Stateless conversations pair naturally with single function calling for parallel-safe, deterministic invocation.

Conversation primitives

Demos & docs

Build it. Read it. Try it.

Working console demos on GitHub, step-by-step how-to guides on the docs site, and the API reference for the classes used on this page.

One inference. One method.

Get Community Edition Download