Atomic Agent mascot working on a laptop in a snowy cabin at night, the wifi router unplugged on the shelf behind
How-to

How to Run an AI Agent Offline in 2026 (No Internet, No API Key)

Published
Updated
Reading time
9 min read
Tag

Run an AI agent offline on a 16 GB laptop: one Offline mode switch, a free local model, no API key. Tested: a real task in 6.5 min, zero outside connections.

Yes, you can run an AI agent offline. Download a free open-weight model once, then the agent plans, edits files, runs commands and commits to git with no internet, no API key and no token bill. Since v0.8.0, Atomic Agent has an Offline mode switch that refuses every connection to anything but your own machine, so you do not have to trust a promise: the agent itself cannot reach out.

We tested it on 25 November 2026 on a 16 GB MacBook Air (M4). With Offline mode and analytics off, the agent read three notes, wrote a checklist and committed it to git in 6.5 minutes. During the run, its processes connected to one address only: 127.0.0.1, the laptop itself.

Checked on 25 Nov 2026 with Atomic Agent v0.8.0 and the project README.

Looking for an offline chat app for your phone rather than an agent that does tasks? Our sister project Atomic Chat keeps a list of offline AI apps for iPhone and Android.

What “offline” means for an AI agent

An offline AI agent runs the whole reasoning loop on your hardware. The model is a file on your disk, a llama.cpp server runs it on 127.0.0.1, and the agent’s tools (files, shell, git, memory) are local too. No prompt goes to a provider, so there is nothing to authenticate against and no key to leak.

You need the internet twice: to install the agent and to download the model. After that, unplug.

Two honest limits:

  • Tasks that need the web still need it. A web search, a live website or a remote MCP server fails offline, and the agent tells you which step failed.
  • Offline mode covers the agent, not every program it starts. The configuration docs say shell commands and stdio MCP servers are not isolated. If you ask the agent to run curl, that command can still go out. Turn Wi-Fi off too if you need a hard guarantee.

New to the idea? What a local AI agent is covers the basics, and local vs cloud agents covers when cloud still wins.

Hardware: what you need

Memory decides everything. The model has to fit, and the agent needs room on top for its context, which grows with every tool result.

Your RAM (or VRAM)Model to runDownloadWhat to expect
8 GBqwen-3.5-4b2.7 GBRuns. Simple file and shell tasks, short context
16 GBqwen-3.5-9b5.3 GBEveryday tasks. This is what we tested
24 GBqwen-3.8-27b (4-bit)17.9 GBThe capable model, with room for context
32 GB and upqwen-3.8-27b with a long context17.9 GBMulti-step tasks with many tool calls

You do not have to read this table. Run atomic-agent models recommend and it reads your RAM, GPU memory and free disk and picks for you. On our MacBook Air it printed:

This machine: 16 GB RAM, 12.9 GB for the model on the GPU, 46 GB free on disk
fast qwen-3.5-4b 2.7 GB Small and quick to download, for 8 GB machines and up
balanced qwen-3.5-9b 5.3 GB Everyday mid-size Qwen, for 16 GB machines and up
quality qwen-3.5-9b 5.3 GB Everyday mid-size Qwen, for 16 GB machines and up

A CPU-only machine works, just slower. On Apple Silicon the figures are unified memory, and macOS gives the GPU only part of it (12.9 GB of 16 GB on our Air). For the 27B in depth, see how to run Qwen 3.8 27B locally.

The easy way: the desktop app

  1. Download Atomic Agent for Mac, Windows or Linux and open it.
  2. Go to Settings › Models › Local models and pick a model that fits your memory (see the table above). Let it download while you are online.
  3. Turn on Offline mode in Settings › Privacy (Atomic Agent Desktop v0.0.9 and newer).
  4. Start a chat and give it a task in a folder you choose.

Step by step in the terminal

Step 1. Install Atomic Agent

Terminal window
curl -fsSL https://atomicagent.io/install | sh

On Windows (PowerShell):

Terminal window
irm https://atomicagent.io/install.ps1 | iex

Check it landed with atomic-agent --version. You should see atomic-agent 0.8.0 or newer. If the command is not found, open a new terminal window.

Step 2. Let it pick a model, then download it

Terminal window
atomic-agent models recommend
atomic-agent models pull qwen-3.5-9b

Use the name recommend gives you. pull downloads the GGUF file from Hugging Face and resumes if the download breaks. This is the last step that needs the internet. atomic-agent models list shows the whole catalog, from qwen-3.5-2b (1.3 GB) to models over 20 GB.

Step 3. Make it active and start it

Terminal window
atomic-agent models use qwen-3.5-9b
atomic-agent models start

use picks the model and switches the agent to managed mode, where it runs the model server for you. start loads it. On our Air it took 14 seconds and printed:

chat: started pid 48709, healthy on port 19091, ... ~16 tok/s single stream

Run atomic-agent models status to check. You want health: ok and a context size. The agent sized ours to 149,504 tokens by itself, so on 16 GB you no longer need to set it by hand.

Do not skip start. If the model is not running, the agent stops right away with: The local model isn't running. Start it with: atomic-agent models start.

Step 4. Turn on Offline mode

Pick one:

  • For every run: open ~/.atomic-agent/config.json, find the "network" block and set "offline": true.
  • For one run only: start the agent with the environment variable:
Terminal window
ATOMIC_AGENT_OFFLINE=1 atomic-agent tui

In the terminal UI you can also press o to switch Offline mode on and off. With it on, every outbound connection to a host other than your machine is refused, and local models keep working.

If you also want analytics off (it is on by default and never includes your messages, file paths or keys), set "analytics": { "enabled": false } in the same file, or type /privacy analytics off in the terminal UI.

Step 5. Give it a task

Go to the folder you want it to work in and start a chat:

Terminal window
cd ~/projects/my-notes
atomic-agent tui

Or send one task and get the answer back, which is what we did:

Terminal window
echo "Merge the notes-*.txt files into todo.md as a checklist, sorted alphabetically, then commit it to git" | atomic-agent run

Leave approvals on for your first runs. The agent asks before each file write and command, which is the quickest way to see exactly what it does.

Our test: a real task, zero outside connections

We gave the agent a small task in a fresh git folder: read three note files, merge them into todo.md as a sorted checklist and commit it. Setup: MacBook Air M4, 16 GB, Atomic Agent v0.8.0, qwen-3.5-9b, Offline mode on, analytics and the update check off, approvals off so it ran unattended. A script logged every network connection of the agent and model processes once a second.

Result
Task doneYes: todo.md written, sorted correctly, committed as Add todo list
Time6.5 minutes (389 seconds)
Steps and tool calls6 steps, 10 tool calls, all succeeded
Model speed~16 tokens per second
Connections outside the laptop0. Every connection was to 127.0.0.1

Atomic Agent terminal log of the offline run: six steps that find, read and merge three notes, write todo.md and commit it as Add todo list, finishing in 388,498 ms

The real run log on our MacBook Air, Offline mode on. Only the folder path is shortened to ~/notes-demo.

The file it wrote:

# Todo List
- [ ] buy groceries
- [ ] call the dentist
- [ ] meeting with design team

6.5 minutes for three notes is slow next to a cloud model. Most of that is the model thinking on a fanless laptop at 16 tokens per second. Offline agents suit work you hand over and come back to. A Mac with more memory, or a GPU, is the biggest speedup.

Try it on your own files: download Atomic Agent, let models recommend pick a model while you are online, then switch on Offline mode and give it a folder.

What works offline and what does not

Works with no internet:

  • Reading, writing and generating code and documents
  • Running shell commands and reading their output
  • Renaming and organizing files
  • Git: status, diff, stage, commit, branch
  • Memory across sessions, stored on your disk

Needs a connection, because the task does:

  • Web search, fetching a URL, browsing live sites
  • MCP servers that call a remote API
  • Downloading a new model or updating the agent

Small quantized models are reliable at tool calls because Atomic Agent constrains their output with a grammar, so a call cannot come out malformed. How grammar-constrained tool calling works explains the mechanism. A small model still plans less well than a large cloud model, so check its work on anything that matters.

Comparing agents that run local models? See our open-source Claude Code alternatives and OpenClaw alternatives. For every agent you can run for $0, see our list of free AI agents.

Troubleshooting

”The local model isn’t running”

Cause: the model server is not started. Fix: atomic-agent models start, then atomic-agent models status until health is ok.

The agent refuses to start with a context warning

WARN context window too small for the agent prompt

Cause: the agent’s instructions include every tool definition, which takes tens of thousands of tokens before any work starts. On a small GPU the server can size the window below that. Fix: pin it and restart:

Terminal window
atomic-agent config set '{"localModels":{"managed":{"contextSize":65536}}}'
atomic-agent models stop && atomic-agent models start

The machine slows to a crawl while the model loads

Cause: the model plus its context does not fit in memory. Fix: close heavy apps, switch to a smaller model with atomic-agent models use qwen-3.5-4b, or lower contextSize to 32768.

Each step takes a minute or more

Cause: normal for local models on a laptop, not a fault. Fix: a smaller model answers faster, and more memory or a GPU helps most. Give the agent a batch of work and come back later.

Something still reaches the network

Cause: Offline mode is off, or a shell command you asked for went out (Offline mode does not isolate shell commands). Fix: check that network.offline is true in config.json (or that you started with ATOMIC_AGENT_OFFLINE=1), and turn Wi-Fi off for a hard guarantee.

FAQ

Running an AI agent offline, with no internet and no API key.

  • Can AI agents work offline?

    Yes, if the model runs on your own computer. An agent like Atomic Agent keeps the model weights on your disk and runs them through a local llama.cpp server, so planning, file edits, shell commands and git all work with no internet. Only tasks that need the web, like a search or a live website, need a connection for that one step.

  • Is there a free offline AI agent?

    Yes. Atomic Agent is open source under the MIT license and free with local models: you download a free open-weight model once and there is no API key, account or token bill after that. You pay only in hardware: about 8 GB of memory for the smallest model and 16 GB for a comfortable everyday one.

  • How much RAM do I need to run an AI agent offline?

    8 GB runs the small qwen-3.5-4b model (2.7 GB). 16 GB is the comfortable start: on our 16 GB MacBook Air, atomic-agent models recommend picked qwen-3.5-9b (5.3 GB). 24 GB or more lets you run the larger qwen-3.8-27b (17.9 GB). A GPU is not required, only faster.

  • Which model should I use for an offline agent?

    Run atomic-agent models recommend and take its pick. It reads your RAM, GPU memory and free disk and names a fast, a balanced and a quality model that fit. On a 16 GB Mac that is qwen-3.5-9b. Switch later with atomic-agent models use.

  • Does Atomic Agent send any data when it runs offline?

    Not with Offline mode on: every outbound connection to a host other than your machine is refused. Without it, anonymous usage analytics is on by default and never includes your messages, file paths or keys. Turn it off with analytics.enabled: false in config.json. Shell commands you ask for are not isolated by Offline mode.

  • How do I turn on Offline mode?

    Set network.offline to true in ~/.atomic-agent/config.json, start the agent with ATOMIC_AGENT_OFFLINE=1 for a single run, press o in the terminal UI, or switch it on in Settings, Privacy in the desktop app. Local models keep working, and any tool that tries to reach the internet is refused instead of connecting.

Bottom line

An offline AI agent is now a ten-minute setup on a normal laptop: install, let models recommend pick a model, download it, start it, switch on Offline mode. On a 16 GB MacBook Air it finished a real file-and-git task in 6.5 minutes without a single connection leaving the machine. It is slower than the cloud and needs memory, but there is no API key, no bill and nothing to leak. Download Atomic Agent and try it on a folder of your own.


Get new posts
by email

One email when we post something new.

Share
Written by
Nadya Dudka Product, Atomic Agent
Andrew Dyuzhov SEO and growth

Run your local agent
in one click