|
| 1 | +--- |
| 2 | +title: AI agents |
| 3 | +weight: 5 |
| 4 | +--- |
| 5 | + |
| 6 | +Lima is useful for running AI agents inside a VM, so as to prevent agents |
| 7 | +from directly reading, writing, or executing the host files. |
| 8 | + |
| 9 | +For running AI agents, it is highly recommended to only mount your project directory (current directory) |
| 10 | +into the VM: |
| 11 | + |
| 12 | +{{< tabpane text=true >}} |
| 13 | +{{% tab header="Lima v2.0+" %}} |
| 14 | +```bash |
| 15 | +limactl start --mount-only .:w |
| 16 | +``` |
| 17 | + |
| 18 | +Drop `:w` for read-only mode. |
| 19 | +{{% /tab %}} |
| 20 | +{{% tab header="Lima v1.x" %}} |
| 21 | +```bash |
| 22 | +limactl start --set ".mounts=[{\"location\":\"$(pwd)\", \"writable\":true}]" |
| 23 | +``` |
| 24 | + |
| 25 | +Set `writable` to `false` for read-only mode. |
| 26 | +{{% /tab %}} |
| 27 | +{{< /tabpane >}} |
| 28 | + |
| 29 | +<!-- |
| 30 | +AI agents are sorted alphabetically. |
| 31 | +
|
| 32 | +Node.js is installed via snap, not apt, as AI agents often require a very recent release of Node.js. |
| 33 | +--> |
| 34 | +{{< tabpane text=true >}} |
| 35 | +{{% tab header="Aider" %}} |
| 36 | +``` |
| 37 | +lima sudo apt install -y pipx |
| 38 | +lima pipx install aider-install |
| 39 | +lima sh -c 'echo "export PATH=$PATH:$HOME/.local/bin" >>~/.bash_profile' |
| 40 | +lima aider-install |
| 41 | +lima aider |
| 42 | +``` |
| 43 | + |
| 44 | +Follow the guide shown in the first session for authentication. |
| 45 | + |
| 46 | +Alternatively, you can set environmental variables via: |
| 47 | +``` |
| 48 | +lima vi "/home/${USER}.linux/.bash_profile" |
| 49 | +``` |
| 50 | + |
| 51 | +See also <https://github.com/Aider-AI/aider>. |
| 52 | +{{% /tab %}} |
| 53 | +{{% tab header="Claude Code" %}} |
| 54 | +``` |
| 55 | +lima sudo snap install node --classic |
| 56 | +lima sudo npm install -g @anthropic-ai/claude-code |
| 57 | +lima codex |
| 58 | +``` |
| 59 | + |
| 60 | +Follow the guide shown in the first session for authentication. |
| 61 | + |
| 62 | +Alternatively, you can set `export ANTHROPIC_API_KEY...` via: |
| 63 | +``` |
| 64 | +lima vi "/home/${USER}.linux/.bash_profile" |
| 65 | +``` |
| 66 | + |
| 67 | +See also <https://github.com/anthropics/claude-code>. |
| 68 | +{{% /tab %}} |
| 69 | +{{% tab header="Codex" %}} |
| 70 | +``` |
| 71 | +lima sudo snap install node --classic |
| 72 | +lima sudo npm install -g @openai/codex |
| 73 | +lima codex |
| 74 | +``` |
| 75 | + |
| 76 | +Follow the guide shown in the first session for authentication. |
| 77 | + |
| 78 | +Alternatively, you can set `export OPENAI_API_KEY...` via: |
| 79 | +``` |
| 80 | +lima vi "/home/${USER}.linux/.bash_profile" |
| 81 | +``` |
| 82 | + |
| 83 | +See also <https://github.com/openai/codex>. |
| 84 | +{{% /tab %}} |
| 85 | +{{% tab header="Gemini" %}} |
| 86 | +``` |
| 87 | +lima sudo snap install node --classic |
| 88 | +lima sudo npm install -g @google/gemini-cli |
| 89 | +lima gemini |
| 90 | +``` |
| 91 | + |
| 92 | +Follow the guide shown in the first session for authentication. |
| 93 | + |
| 94 | +Alternatively, you can set `export GEMINI_API_KEY...` via: |
| 95 | +``` |
| 96 | +lima vi "/home/${USER}.linux/.bash_profile" |
| 97 | +``` |
| 98 | + |
| 99 | +See also <https://github.com/google-gemini/gemini-cli>. |
| 100 | +{{% /tab %}} |
| 101 | +{{% tab header="GitHub Copilot" %}} |
| 102 | +``` |
| 103 | +lima sudo snap install node --classic |
| 104 | +lima sudo npm install -g @github/copilot |
| 105 | +lima copilot |
| 106 | +``` |
| 107 | + |
| 108 | +Type `/login` in the first session for authentication. |
| 109 | + |
| 110 | +Alternatively, you can set `export GH_TOKEN=...` via: |
| 111 | +``` |
| 112 | +lima vi "/home/${USER}.linux/.bash_profile" |
| 113 | +``` |
| 114 | + |
| 115 | +See also <https://github.com/github/copilot-cli>. |
| 116 | +{{% /tab %}} |
| 117 | +{{< /tabpane >}} |
| 118 | + |
| 119 | +## See also |
| 120 | + |
| 121 | +- [Config » AI](../config/ai/) |
0 commit comments