> ## Documentation Index
> Fetch the complete documentation index at: https://praison.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Run Fully Offline

> Run PraisonAI agents on a model on your own computer, with no internet connection and no cloud API key.

Run an agent on a model that lives on your own computer. No internet connection and no cloud API key are needed. With the default local setup, your prompts stay on the machine.

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
from praisonaiagents import Agent

agent = Agent(instructions="You are a helpful assistant", model="ollama/llama3.2")
print(agent.start("Summarise this note in one sentence: ..."))
```

```mermaid theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
graph LR
    subgraph Computer["Your computer"]
        U[Your prompt] --> A[Agent]
        A --> M[Local model<br/>Ollama]
        M --> A
        A --> R[Answer]
    end
    A -.->|no connection needed| I[Internet]

    classDef agent fill:#8B0000,color:#fff
    classDef tool fill:#189AB4,color:#fff
    classDef off fill:#74756e,color:#fff

    class U,A,R agent
    class M tool
    class I off
```

The agent sends your prompt to the model on the same computer, and the answer comes back the same way. Your prompt never goes over the internet. The model connector may still try to fetch a price list at startup; see [Turn off telemetry](#turn-off-telemetry) to stop that.

## Quick Start

**1. Install Ollama and download a model**

Do this once, while you are still online. Get Ollama from [ollama.com](https://ollama.com), then download a model:

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
ollama pull llama3.2
```

The model is saved on your computer. After this, Ollama does not need the internet.

**2. Install PraisonAI**

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
pip install "praisonaiagents[llm]"
```

The `[llm]` extra adds the connector PraisonAI uses to talk to Ollama.

**3. Create the agent**

Save this as `agent.py`:

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
from praisonaiagents import Agent

agent = Agent(instructions="You are a helpful assistant", model="ollama/llama3.2")
print(agent.start("In one sentence, why might a hospital keep patient data on its own computers?"))
```

**4. Run it**

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
python agent.py
```

```text theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
A hospital might keep patient data on its own computers to maintain control over access, security, and confidentiality of sensitive patient information.
```

No `OPENAI_API_KEY` is needed. The `ollama/` prefix tells PraisonAI to use the local model.

> [!NOTE]
>
> Run the script from your own project folder. If the current folder has an `AGENTS.md` or `CLAUDE.md` file, the agent adds it to its instructions, which can change how it answers. Pass `rules=False` to `Agent(...)` to turn this off.

***

## Ollama on another computer

If Ollama runs on a different machine in your network, or on a port other than `11434`, tell the agent where it is.

> [!WARNING]
>
> With a remote host, your prompts leave this machine and are sent to that computer. Only use a host on a network you trust.

On the other computer, make Ollama listen on the network (not just `localhost`), then restart it:

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
OLLAMA_HOST=0.0.0.0:11434 ollama serve
```

Do not expose this port to the internet.

> [tab] In code
>
> ```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
> from praisonaiagents import Agent
>
> agent = Agent(
>     instructions="You are a helpful assistant",
>     model="ollama/llama3.2",
>     base_url="http://192.168.1.10:11434",
> )
> print(agent.start("Reply with the single word: ready"))
> ```

> [tab] Environment variable
>
> ```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
> export OLLAMA_API_BASE="http://192.168.1.10:11434"
> python agent.py
> ```
>
> The agent code stays the same: `model="ollama/llama3.2"`, no `base_url`.

> [!WARNING]
>
> Use `base_url=` or `OLLAMA_API_BASE`. Setting `OLLAMA_HOST` changes where the Ollama server itself listens, but the agent with `model="ollama/..."` does not use it to find the server.

***

## Check it is really offline

The simplest test: turn off Wi-Fi or unplug the network cable, then run `python agent.py` again. If you get an answer, the agent did not need the internet. This only works when Ollama is on the same computer: going offline also cuts you off from a remote Ollama host.

> [accordion] Block the network for one command (macOS)
>
> This blocks every outgoing connection except to Ollama on `localhost:11434`, without turning off your network. If Ollama runs on another computer, use `(remote ip "*:11434")` instead, since the sandbox only accepts `localhost` or `*` as the host.
>
> ```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
> cat > nonet.sb <<'EOF'
> (version 1)
> (allow default)
> (deny network-outbound)
> (allow network-outbound (remote ip "localhost:11434"))
> EOF
>
> # Should fail: the internet is blocked
> sandbox-exec -f nonet.sb curl -s -m 5 https://pypi.org || echo "internet blocked"
>
> # Should answer: only the local model is reachable
> sandbox-exec -f nonet.sb python agent.py
> ```

> [accordion] Install on a machine that has never been online
>
> Download the packages on a connected machine, copy them across, and install from the folder. See [Offline & CI Install](https://praison.ai/docs/features/offline-and-ci-install.md) for what PraisonAI does and does not fetch at install time.

***

## Turn off telemetry

Telemetry is off by default in `praisonaiagents`. It only turns on if someone sets `PRAISONAI_TELEMETRY_ENABLED=true`. To make sure it stays off on a machine, set:

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
export PRAISONAI_TELEMETRY_DISABLED=true
```

This wins over `PRAISONAI_TELEMETRY_ENABLED=true` and over `enable_telemetry()` in code. `DO_NOT_TRACK=true` and `PRAISONAI_DISABLE_TELEMETRY=true` work too. Each accepts `true`, `1` or `yes`.

The model connector also checks online for an updated model price list when it starts. If it cannot connect it uses the copy it ships with. To skip the check entirely:

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
export LITELLM_LOCAL_MODEL_COST_MAP=True
```

***

## Other local model servers

Ollama is the simplest start. PraisonAI also works with LM Studio, llama.cpp and vLLM running on your own hardware. These pages cover them:

> [card] [Local Models](https://praison.ai/docs/features/local-models.md)
>
> Ollama, LM Studio, llama.cpp and vLLM

> [card] [Local Model Resolver](https://praison.ai/docs/features/local-model-resolver.md)
>
> Find a running local server for you

> [card] [Ollama](https://praison.ai/docs/models/ollama.md)
>
> More Ollama options

***

## Best Practices

> [accordion] Download models before you go offline
>
> `ollama pull` needs the internet. Pull every model you plan to use while connected, then check with `ollama list`.

> [accordion] Name the model every time
>
> Always pass `model="ollama/<name>"`. Without it, PraisonAI falls back to a cloud default and asks for an API key.

> [accordion] Start small, then test on your own tasks
>
> A small model such as `llama3.2` runs on most laptops. Try your real tasks on it before moving to a larger model.

## Related

> [card] [Task handover (early access)](https://praison.ai/docs/guides/task-handover-early-access.md)
>
> Move tasks to your own AI only after they pass a test

> [card] [Single Agent Guide](https://praison.ai/docs/guides/single-agent.md)
>
> Build out your first agent


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.