Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 3 additions & 13 deletions website/content/en/docs/config/ai/inside/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,7 @@ title: AI agents inside Lima
weight: 10
---

Lima is useful for running AI agents (e.g., Codex, Claude, Gemini) so as to prevent them
from directly reading, writing, or executing the host files.
Lima is useful for running AI agents (e.g., Claude Code, Codex, Gemini)
inside a VM, so as to prevent agents from directly reading, writing, or executing the host files.

Lima v2.0 is planned to be released with built-in templates for well-known AI agents.

For Lima v1.x, you can install AI agents in Lima manually.

e.g.,

```bash
lima sudo apt install -y npm
lima sudo npm install -g @google/gemini-cli
lima gemini
```
See [Examples » AI](../../../examples/ai.md).
121 changes: 121 additions & 0 deletions website/content/en/docs/examples/ai.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
---
title: AI agents
weight: 5
---

Lima is useful for running AI agents inside a VM, so as to prevent agents
from directly reading, writing, or executing the host files.

For running AI agents, it is highly recommended to only mount your project directory (current directory)
into the VM:

{{< tabpane text=true >}}
{{% tab header="Lima v2.0+" %}}
```bash
limactl start --mount-only .:w
```

Drop `:w` for read-only mode.
{{% /tab %}}
{{% tab header="Lima v1.x" %}}
```bash
limactl start --set ".mounts=[{\"location\":\"$(pwd)\", \"writable\":true}]"
```

Set `writable` to `false` for read-only mode.
{{% /tab %}}
{{< /tabpane >}}

<!--
AI agents are sorted alphabetically.

Node.js is installed via snap, not apt, as AI agents often require a very recent release of Node.js.
-->
{{< tabpane text=true >}}
{{% tab header="Aider" %}}
```
lima sudo apt install -y pipx
lima pipx install aider-install
lima sh -c 'echo "export PATH=$PATH:$HOME/.local/bin" >>~/.bash_profile'
lima aider-install
lima aider
```

Follow the guide shown in the first session for authentication.

Alternatively, you can set environmental variables via:
```
lima vi "/home/${USER}.linux/.bash_profile"
```

See also <https://github.com/Aider-AI/aider>.
{{% /tab %}}
{{% tab header="Claude Code" %}}
```
lima sudo snap install node --classic
lima sudo npm install -g @anthropic-ai/claude-code
lima codex
```

Follow the guide shown in the first session for authentication.

Alternatively, you can set `export ANTHROPIC_API_KEY...` via:
```
lima vi "/home/${USER}.linux/.bash_profile"
```

See also <https://github.com/anthropics/claude-code>.
{{% /tab %}}
{{% tab header="Codex" %}}
```
lima sudo snap install node --classic
lima sudo npm install -g @openai/codex
lima codex
```

Follow the guide shown in the first session for authentication.

Alternatively, you can set `export OPENAI_API_KEY...` via:
```
lima vi "/home/${USER}.linux/.bash_profile"
```

See also <https://github.com/openai/codex>.
{{% /tab %}}
{{% tab header="Gemini" %}}
```
lima sudo snap install node --classic
lima sudo npm install -g @google/gemini-cli
lima gemini
```

Follow the guide shown in the first session for authentication.

Alternatively, you can set `export GEMINI_API_KEY...` via:
```
lima vi "/home/${USER}.linux/.bash_profile"
```

See also <https://github.com/google-gemini/gemini-cli>.
{{% /tab %}}
{{% tab header="GitHub Copilot" %}}
```
lima sudo snap install node --classic
lima sudo npm install -g @github/copilot
lima copilot
```

Type `/login` in the first session for authentication.

Alternatively, you can set `export GH_TOKEN=...` via:
```
lima vi "/home/${USER}.linux/.bash_profile"
```

See also <https://github.com/github/copilot-cli>.
{{% /tab %}}
{{< /tabpane >}}

## See also

- [Config » AI](../config/ai/)