Build Intelligent ChatbotsThat Remember, Reason & Act.
The complete .NET SDK for chatbot agents. Multi-turn conversations with persistent memory, agentic reasoning, function calling, MCP integration, vision, and agent skills. Run Qwen, Gemma, DeepSeek, GLM, GPT-OSS and more 100% on-device with zero cloud dependency.
From Simple Chat to Agentic Assistants
Building chatbots that maintain context, remember users, reason through problems, and take action has traditionally required stitching together multiple cloud services. LM-Kit unifies all of this into a single, on-device .NET SDK.
MultiTurnConversation
Full conversation context with history, tools, memory, vision, MCP, and skills in a single API.
AgentMemory
Three memory types with automatic extraction, consolidation, and multi-user isolation.
Agent Framework
Planning strategies, orchestrators, skills, resilience policies, and observability built in.
Everything You Need to Build Chatbot Agents
A complete SDK covering conversations, memory, reasoning, tools, skills, vision, and enterprise security.
Multi-Turn Context
Maintain conversation history across exchanges. The model references past turns for coherent, contextual responses.
RAG-Backed Memory Enhanced
Semantic, episodic, and procedural memory with automatic extraction, consolidation, and multi-user isolation.
Function Calling & MCP
4 execution modes, [LMFunction] attributes, ITool interface, built-in tools, and Model Context Protocol servers.
Agent Skills New
Drop-in SKILL.md files for zero-code domain expertise. Manual slash commands or model-driven activation.
Agentic Reasoning New
ReAct, Chain-of-Thought, Tree-of-Thought, and Plan-and-Execute planning strategies for complex tasks.
Vision & Multimodal
Process images alongside text at any turn with VLM-capable models. Build visual assistants that analyze and describe.
Streaming & Structured Output
Real-time token streaming for responsive UX. Constrain responses to valid JSON schemas with grammar enforcement.
On-Device & Secure Enhanced
All inference runs locally. Tool permission policies with risk levels, approval workflows, and category-based access control.
Conversation APIs
Choose the right conversation pattern for your use case, from fast Q&A to extended dialogues with memory, tools, and agentic reasoning.
Single-Turn Conversation
Fast question-answer interactions without history retention. Optimized for stateless queries, classification tasks, and one-shot completions.
Multi-Turn Conversation
Extended dialogues with full history tracking, memory, function calling, vision, and agent skills. The foundation for chatbot agents.
Smart Memories
Transform stateless chatbots into assistants that evolve with each interaction. Memory is RAG-backed, KV-cache aware, and designed for production multi-user deployments.
Agents That Remember What Matters
AgentMemory integrates with MultiTurnConversation to store and recall semantic, episodic, and procedural knowledge across sessions. Memory is KV-cache aware, injecting only missing context to keep outputs grounded without repetition.
Enable automatic memory extraction and the system learns from every conversation turn. Facts, events, and procedures are classified, deduplicated, and stored without manual intervention. Over time, memory consolidation merges similar entries into concise summaries.
Introducing AgentMemory Blog PostSemantic Memory
Store facts, definitions, and general knowledge. User preferences, product details, domain expertise.
Episodic Memory
Remember specific events and interactions. User history, support tickets, conversation milestones.
Procedural Memory
Retain learned procedures and workflows. Remember how users like things done.
Auto-Extraction New
LLM-based extraction classifies and stores memories automatically from every conversation turn.
Consolidation New
Merge semantically similar memories into concise summaries using LLM-powered clustering.
Multi-User Isolation New
UserScopedMemory namespaces data by user ID. Scoped retrieval and per-user cleanup.
KV-Cache Aware Recall
Memory injection is optimized for the model's key-value cache. Only missing context is added.
Time-Decay Scoring New
Exponential decay ensures recent memories rank higher. Configurable half-life and eviction policies.
Serialize & Restore
Persist memory to disk and reload across sessions. Share memory states between agents.
Agentic Reasoning & Orchestration
Go beyond simple Q&A. Equip chatbots with planning strategies that decompose complex tasks, and orchestration patterns that coordinate multiple specialized agents.
Planning Strategies New
Give chatbots the ability to think step-by-step before acting. Select the planning strategy that fits your task complexity.
Enterprise Resilience New
Production-grade reliability with built-in resilience policies and full observability via OpenTelemetry.
Multi-Agent Orchestration
Coordinate multiple specialized agents for complex workflows. Each orchestrator handles a different collaboration pattern with real-time streaming output.
Pipeline
Sequential agent chain. Each agent refines the output of the previous one.
Parallel
Run multiple agents concurrently and merge results.
Router
Intelligent routing to the best-fit specialist agent.
Supervisor
Supervisor delegates tasks to workers and synthesizes output.
Function Calling & Tool Use
Let chatbots call your code dynamically, connect to external services via MCP, and use 60+ built-in tools across 8 categories.
[LMFunction] Attribute
Decorate C# methods with [LMFunction] to expose them as callable tools. The SDK generates JSON Schema automatically from method signatures and XML documentation.
ITool, Built-in Tools & MCP
Use 60+ atomic built-in tools (file system, HTTP, web search, database, PDF), implement ITool for custom tools, or connect MCP servers for external tool catalogs.
Execution Modes
Simple
One function call per turn with sequential execution.
Multiple
Chain multiple calls in sequence within a single turn.
Parallel
Execute independent calls concurrently for speed.
Parallel + Multiple
Combine parallel and sequential chaining.
Agent Skills
Give chatbots domain expertise without writing code. Drop a SKILL.md file and your agent gains new capabilities instantly.
Zero-Code Expertise
Agent Skills are reusable instruction files that teach your chatbot how to handle specific domains or tasks. Define a skill once, share it across agents and projects.
Manual Mode
Users activate skills via slash commands like /explain or /pros-cons.
Model-Driven Mode
The model autonomously discovers and activates the right skill via function calling.
Skills support progressive loading, keyword and semantic matching, and multiple sources (filesystem, URLs, GitHub repositories).
Built for Developer Velocity
A single, unified API. No boilerplate. No rework when switching models. Five lines to a working chatbot agent.
using LMKit.Model; using LMKit.TextGeneration; // Instantiate a model by ID from the catalog var model = LM.LoadFromModelID("qwen3:8b"); // Create a multi-turn conversation with system prompt var chat = new MultiTurnConversation(model) { SystemPrompt = "You are a helpful customer support agent." }; // First turn var response1 = chat.Submit("What's your return policy?"); Console.WriteLine(response1.Completion); // Second turn - context is automatically maintained var response2 = chat.Submit("How long do I have?"); Console.WriteLine(response2.Completion);
using LMKit.Model; using LMKit.Agents; using LMKit.TextGeneration; // Load chat and embedding models var chatModel = LM.LoadFromModelID("qwen3:8b"); var embedModel = LM.LoadFromModelID("qwen3-embedding:0.6b"); // Create memory with automatic extraction enabled var memory = new AgentMemory(embedModel) { ExtractionMode = MemoryExtractionMode.LlmBased, ExtractionModel = chatModel }; // Create conversation - memory auto-learns from every turn var chat = new MultiTurnConversation(chatModel) { Memory = memory }; // Memory is extracted and recalled automatically var r1 = chat.Submit("I prefer concise answers. My name is Sarah."); var r2 = chat.Submit("Explain dependency injection."); // Agent recalls Sarah's name and preference for brevity
using LMKit.Model; using LMKit.TextGeneration; using LMKit.FunctionCalling; public class WeatherTools { [LMFunction("Get current weather for a city")] public static string GetWeather(string city) { return $"Weather in {city}: 72°F, sunny"; } } var model = LM.LoadFromModelID("qwen3:8b"); var chat = new MultiTurnConversation(model); // Register tools from a class chat.Tools.ImportFunctions(typeof(WeatherTools)); // Model calls GetWeather when appropriate var response = chat.Submit("What's the weather in Tokyo?");
using LMKit.Model; using LMKit.Agents; using LMKit.Agents.Planning; using LMKit.Agents.Tools.BuiltIn; var model = LM.LoadFromModelID("qwen3:8b"); // Build an agent with ReAct planning and web search var agent = Agent.CreateBuilder(model) .WithPlanning(PlanningStrategy.ReAct) .WithTools(tools => { tools.Register(BuiltInTools.WebSearch); tools.Register(BuiltInTools.Calculator); }) .Build(); // Agent reasons step-by-step, searches the web, and computes var result = await agent.ExecuteAsync( "Research the population of the 3 largest cities in France and calculate the total." );
Explore Usage Examples
Runnable samples covering every chatbot capability. Clone, build, and learn.
Multi-Turn Chat
Interactive chatbot with context retention, model selection, and response regeneration.
View Sample ConsolePersistent Session
Save and restore conversation state to disk. Resume sessions across app restarts.
View Sample ConsoleChat with Tools
Function calling in action. Register C# methods and let the model invoke them.
View Sample ConsoleChat with Vision
Process images alongside text using VLMs. Build visual assistants.
View Sample AgentResearch Assistant
ReAct planning with web search. The agent reasons, searches, and synthesizes answers.
View Sample AgentPersistent Memory
Long-term memory across sessions with auto-extraction and recall.
View Sample AgentSkill-Based Assistant
Agent Skills from SKILL.md files. Zero-code domain expertise with slash commands.
View Sample ConsoleRAG Chatbot
Chat with eBooks, PDFs, and documents using retrieval-augmented generation.
View Sample MAUI AppChat Playground
Full-featured chat UI with model switching, history management, and settings.
View SampleIntegrations & Ecosystem
LM-Kit chatbots plug into the .NET ecosystem you already use.
Microsoft Semantic Kernel
Use LM-Kit models as the LLM backend for Semantic Kernel plugins, planners, and agents.
Learn MoreMicrosoft.Extensions.AI
Drop-in IChatClient and IEmbeddingGenerator implementation. Compatible with the middleware pipeline.
Learn MoreModel Context Protocol
Connect to any MCP server (stdio and SSE transports). Full spec support with sampling, roots, elicitation, and subscriptions.
Learn MoreCommon Use Cases
Customer Support
Deploy chatbots that handle complex queries, remember customer history, call your ticketing APIs, and route to specialists when needed.
Healthcare Companions
Build virtual assistants for patient triage, scheduling, and follow-ups with HIPAA-compliant on-device processing.
Educational Tutors
Create intelligent tutoring systems that adapt to student level, remember progress, and use skills for different subjects.
E-commerce Assistants
Power product discovery, order tracking, and personalized recommendations with memory and function calling.
Legal & Compliance
Build document Q&A systems for contracts, policies, and regulations. RAG over your knowledge base, on-premises.
Enterprise Knowledge
Deploy agentic chatbots that answer questions from internal wikis, search the web, and orchestrate multi-step research tasks.
Start Building Chatbot Agents Today
From simple multi-turn chat to agentic assistants with memory, reasoning, and tools. Get started in minutes with our SDK.
Talk to an Expert
Need help with agent architecture, model selection, or memory workflows? Let's connect.
Speak with an expert