The AI Loadout

How to run an Agent Locally with Ollama with an AI agent

Install Ollama, pull a model that supports tool calling, then run ollama launch claude or ollama launch codex. Ollama points the agent at the local model for you. Smaller local models handle simple edits well but struggle with long multi-step tasks, so start small and check its work.

Checked against official docs on Oct 26, 2026.

Get the free starter kit. One short email a day when our setups change.

Free starter kit on signup: 2 Claude Code skills and 1 agent persona from our paid packs. By subscribing you agree to get The AI Loadout Daily, one email each morning. No spam, we never sell your email, and every email has a one-click unsubscribe link.

Claude Code

  1. Install Ollama from ollama.com and pull a tool-capable model
  2. ollama launch claude
  3. Or set it up by hand: export ANTHROPIC_BASE_URL to your Ollama server, ANTHROPIC_AUTH_TOKEN=ollama and ANTHROPIC_API_KEY="", then run claude --model <model>
  4. Run /status inside Claude Code to check the connection

Codex

  1. ollama launch codex
  2. Type /model inside Codex to switch between installed tool-capable models
  3. ollama launch codex --config to change settings

Cursor

  1. We did not find official Cursor docs for running its agent on a local Ollama model as of Oct 26, 2026
  2. For a fully local setup, use Claude Code or Codex through ollama launch

Grok Bot

  1. Grok Bot runs on its own cloud computer, so it is not a local option
  2. Use it for tasks that need your connected apps, and a local agent for private code

Gotchas

  • The model must support tool calling or the agent cannot edit files.
  • Claude settings files can override the environment variables. Check them if the connection fails.
  • Local models need a lot of RAM or VRAM. Check the model size before pulling it.

The loadout for this job

FAQ

Can Claude Code run on a local model?

Yes. Ollama documents ollama launch claude, which points Claude Code at a model Ollama serves.

Ollama or LM Studio for agents?

Both can serve local models. Ollama has documented one-command launch for Claude Code and Codex.

Related how-tos

Sources

Commands change. Check the linked docs before you run anything. All how-to guides

Want tested skills and personas installed in one command? See the AI Loadout packs, from $9.