Products Marketplace Blog About Contact Sign in Download
lac-cli Offline: Running the Agent on Local Models

lac-cli Offline: Running the Agent on Local Models

You don't need an API key to use lac-cli. With Ollama running locally, the whole toolkit works offline — shell autocomplete, the coding agent, all of it. Here's how I set it up and when I actually reach for it.

The "no internet" problem is more common than you'd think

I was on a flight last month, mid-refactor, and I reached for lac agent out of habit. It failed immediately — no network, no API key, no response. I sat there for a second annoyed at myself for not setting up the offline path properly before boarding.

That was the push I needed to actually dig into the Ollama integration. I've been using it regularly since, and honestly it's become my default for anything sensitive too — not just travel situations.

What "offline mode" actually means in lac-cli

lac-cli supports four model providers: claude (Anthropic), openai (GPT), ollama (local), and any custom OpenAI-compatible endpoint. The ollama provider talks to a local Ollama server running on your machine — no outbound requests, no keys, nothing leaves your laptop.

That means lac shell, lac agent, and lac mind all work fully offline once you have Ollama set up. The only thing that changes is which model is answering you.

Step one: get Ollama running

If you haven't already, grab Ollama from ollama.com. It installs as a local server that runs on http://localhost:11434 by default. Then pull a model:

ollama pull llama3

Or if you want something lighter for a low-RAM machine:

ollama pull mistral

I use llama3 for most coding tasks — it handles file edits and shell commands well without being too slow. mistral is snappier if you're just using the shell autocomplete and don't need deep reasoning.

Once pulled, confirm it's running:

ollama list

You should see your model in the list. Ollama auto-starts a local server when you run any command, so you don't need to do anything extra.

Step two: install lac-cli

If you don't have it yet:

pip install lac-cli

Or with the install script:

curl -fsSL https://lacai.io/install.sh | bash

On Windows:

iwr -useb https://lacai.io/install.ps1 | iex

Step three: point lac-cli at Ollama

Run the setup wizard:

lac shell --setup

When it asks for a provider, pick ollama. It'll ask for the model name — type whatever you pulled, like llama3. It doesn't ask for an API key because there isn't one. The config gets written to ~/.lac/config.json.

If you want to peek at or edit it directly, it looks something like this:

{
  "provider": "ollama",
  "model": "llama3",
  "ollama_host": "http://localhost:11434"
}

The ollama_host field is there if your Ollama server is running on a different port or a remote machine on your local network. Most of the time the default is fine.

Using lac shell offline

Once configured, just open your terminal and run:

lac shell --offline

The --offline flag forces the Ollama provider regardless of what's in your config — useful if you normally use Claude but want to switch quickly without editing anything. Tab still accepts ghost text, confirmations still work the same way. The experience is identical, just local.

Type something like:

find all python files modified in the last 3 days

And you'll get back the find command with a confirm prompt before it runs. No internet required.

Using lac agent offline

This is the one that surprised me most. lac agent with a local model is genuinely usable for real coding tasks — reading files, writing edits, using project memory from .lac-memory.json. The agentic loop works the same way.

It's slower than hitting the Anthropic API, obviously. On my M2 MacBook Pro with llama3, a file read plus a short edit takes maybe 8 to 12 seconds. That's fine for most things. Where it breaks down is long multi-file refactors where GPT-4 or Claude 3.5 Sonnet's reasoning depth really shows. For targeted edits — fix this function, add this route, write a test for this file — local models hold up well.

PlanMode works too. Run lac agent, type /plan before your task, and the model will write out what it intends to do before touching anything. Great habit regardless of which provider you're using, but especially with local models where you want to catch bad plans before they cost you 20 seconds of inference time.

Switching between providers without re-running setup

If you work with multiple providers — say, Ollama at home and Claude at the office — you don't have to keep running --setup. Just edit ~/.lac/config.json directly. It's a plain JSON file, no lock format, no binary blob. Swap the "provider" and "model" fields and you're done. Restart lac shell and it picks up the new config immediately.

I keep a small shell alias for this:

alias lac-local='echo "{\"provider\":\"ollama\",\"model\":\"llama3\"}" > ~/.lac/config.json'
alias lac-cloud='echo "{\"provider\":\"claude\",\"model\":\"claude-3-5-sonnet-20241022\",\"api_key\":\"sk-ant-...\"}" > ~/.lac/config.json'

Rough, but it works. Takes about half a second to switch contexts.

Why I reach for Ollama beyond just offline situations

A few scenarios where local is actually my preference even with internet available:

  • Client work under NDA. When I'm working inside a codebase I'm not supposed to share, sending code to a third-party API is a grey area at best. Local model, no question.
  • Exploratory file reads on production configs. If lac agent is going to read files that contain secrets or environment variables, local feels cleaner.
  • Burning through token limits. Ollama is free and unlimited. If I'm doing 50 small shell commands in a session, I'd rather not burn API credits on trivial stuff.

One practical tip before you go

If Ollama is taking too long on your machine, try a quantized version of the model. For example:

ollama pull llama3:8b-instruct-q4_0

The q4_0 quantization cuts memory usage significantly with only a small quality drop for code tasks. On 16GB RAM machines it's the sweet spot. Pull it, update your config.json to use llama3:8b-instruct-q4_0 as the model name, and you'll notice the difference immediately.

lac-cli is open source and free — pip install lac-cli or check the full docs at lacai.io/lac-cli. The offline path is genuinely first-class, not an afterthought.

We use cookies to keep you signed in and to serve ads via Google AdSense. By continuing to use this site you agree to our Privacy Policy.