Local-first AI development with Veryfront Code and LM Studio

Guide
Local-first AI development with Veryfront Code and LM Studio article cover.
Guide
Kentaro Wakayama3 min read
Table of Contents

Overview

Run a Veryfront Code agent against a local model through LM Studio, keeping inference on your machine while preserving the same project structure you can use with hosted models later.

Local inference flow from Veryfront Code through LM Studio to Ministral 3 3B.
  • Veryfront Code — Holds the application, agent, tools, and knowledge, and calls the local API.
  • LM Studio — Exposes the OpenAI-compatible API for local inference.
  • Ministral 3 3B — Generates the agent's responses on your machine.

Start LM Studio

You need Node.js 22.3 or later and LM Studio. Install LM Studio, launch it once, then run:

Shell
lms get mistralai/ministral-3-3b --gguf lms load mistralai/ministral-3-3b \  --identifier mistral-local \  --context-length 8192 lms server start --port 1234 --bind 127.0.0.1curl http://127.0.0.1:1234/v1/models

The final command should list mistral-local. The server is now available only to applications on your machine.

Create and connect the app

Scaffold the AI agent starter:

Shell
npm create veryfront@latest local-assistant -- --template ai-agentcd local-assistant

Create .env.local in the project root:

env
OPENAI_API_KEY=lm-studioOPENAI_BASE_URL=http://127.0.0.1:1234/v1VERYFRONT_HOST_ALLOWED_INTERNAL_PROVIDER_ORIGINS=http://127.0.0.1:1234

LM Studio does not require a token by default, but the OpenAI-compatible provider expects a non-empty value. Veryfront also blocks loopback provider requests unless the exact origin is allowlisted. Keep this allowlist scoped to 127.0.0.1:1234 and use it only with trusted project code.

Update agents/assistant.ts:

TypeScript
import { agent } from "veryfront/agent"; export default agent({  id: "assistant",  name: "Local assistant",  model: "openai/mistral-local",  system: "You are a helpful local assistant.",  tools: { calculator: true },});

Run the app

Shell
npm run dev -- --port 3010

Open http://localhost:3010 and send a message. Requests now follow this path:

Text
Browser -> Veryfront Code -> LM Studio -> Ministral 3 3B Instruct

Evaluate the local model

Replace evals/assistant.eval.ts with this calculator smoke test. The agent and judge both use the local model:

TypeScript
import { datasets, evalAgent, judges, metrics } from "veryfront/eval"; export default evalAgent({  name: "Assistant smoke test",  target: "agent:assistant",  dataset: datasets.inline([    {      id: "calculator",      input: "Use the calculator to multiply 123 by 456. Return only the result.",      reference: "56088",    },  ]),  metrics: [    metrics.agent.calledTool("calculator").gate(),    metrics.agent.noFailedTools().gate(),    metrics.judge      .rubric({        rubric: "The answer must be exactly 56088.",        judge: judges.llm.rubric({ model: "openai/mistral-local" }),      })      .gate({ min: 0.8 }),  ],});

Run the eval:

Shell
npm run eval

The tested run passes all three gates:

Text
Eval:   Assistant smoke testTarget: agent:assistantResult: 1/1 passed (100%) ● Agent called tool "calculator": 1/1 passed (100%)● Agent had no failed tool calls: 1/1 passed (100%)● LLM as a judge passed: 1/1 passed (100%) Eval suite: 1/1 passed

Keep the inference layer replaceable

Local-first does not mean local-only.

The same project can use LM Studio during development and another model endpoint when deployed.

  • Local development: Veryfront Code → LM Studio → Local model
  • Production: Veryfront Code → Model provider → Production model

Agents, skills, knowledge, tools, evals, workflows, and application code stay in the same project. The inference configuration changes.

This makes it possible to choose where models run based on the requirements of each environment instead of coupling application behavior to one provider.

Know the privacy boundary

Local model inference keeps the model request on your machine, but that does not automatically make every part of an application local.

Tools can call external APIs. Applications can use remote databases. Logging and observability can send data to external services.

When privacy matters, inspect the complete path that data takes through the application. LM Studio gives you control over one important part of that path: model inference.

Run locally, ship anywhere

Veryfront Code gives agents, skills, knowledge, tools, evals, workflows, schedules, and webhooks one project structure from local development to deployment.

LM Studio adds a local inference option to that development loop.

Run the application locally. Run the model locally. Evaluate its behavior against your project. Then choose the inference environment that fits production without rebuilding the application around another model provider.

The model can change. The project stays the same.