Tech Blog

Agentic Engineering 環境を構築する

Gemma 4 がリリースされたので、 llama.cppOpenCodeAgent Client Protocol を利用して Zedagentic engineering を試せる環境を構築した

今回の環境

TL;DR

llama.cpp のインストール
brew install llama.cpp
✔︎ JSON API cask.jws.json                                                              Downloaded  15.4MB/ 15.4MB
✔︎ JSON API formula.jws.json                                                           Downloaded  32.0MB/ 32.0MB
==> Fetching downloads for: llama.cpp
==> Installing llama.cpp
...
==> Installing llama.cpp
==> Pouring llama.cpp--8640.arm64_tahoe.bottle.tar.gz
🍺  /opt/homebrew/Cellar/llama.cpp/8640: 61 files, 144.2MB
==> Running `brew cleanup llama.cpp`...
Gemma 4 26B のサーバー構築
llama-server -hf ggml-org/gemma-4-26B-A4B-it-GGUF -c 16384
ggml_metal_device_init: tensor API disabled for pre-M5 and pre-A19 devices
ggml_metal_library_init: using embedded metal library
ggml_metal_library_init: loaded in 0.009 sec
...
srv          init: init: chat template, thinking = 1
main: model loaded
main: server is listening on http://localhost:8080
main: starting the main loop...
srv  update_slots: all slots are idle

open http://localhost:8080

llama.cpp = AI Chat Interface

opencode のインストール
brew install anomalyco/tap/opencode
==> Fetching downloads for: opencode
✔︎ Bottle Manifest pcre2 (10.47_1)                  Downloaded  11.7KB/ 11.7KB
✔︎ Bottle pcre2 (10.47_1)                           Downloaded   2.4MB/  2.4MB
✔︎ Bottle Manifest ripgrep (15.1.0)                 Downloaded   8.8KB/  8.8KB
✔︎ Bottle ripgrep (15.1.0)                          Downloaded   2.2MB/  2.2MB
✔︎ Formula opencode (1.3.13)                        Verified    34.7MB/ 34.7MB
==> Installing opencode from anomalyco/tap
...
🍺  /opt/homebrew/Cellar/ripgrep/15.1.0: 14 files, 6.4MB
==> Installing anomalyco/tap/opencode
🍺  /opt/homebrew/Cellar/opencode/1.3.13: 4 files, 119.9MB, built in 3 seconds
==> Running `brew cleanup opencode`...
opencode の設定
  // ~/.config/opencode/opencode.json
+ {
+   "$schema": "https://opencode.ai/config.json",
+   "provider": {
+     "llama-server": {
+       "npm": "@ai-sdk/openai-compatible",
+       "name": "llama-server",
+       "options": {
+         "baseURL": "http://localhost:8080/v1"
+       },
+       "models": {
+         "ggml-org/gemma-4-26B-A4B-it-GGUF": {
+           "name": "Gemma 4 26B"
+         }
+       }
+     }
+   }
+ }
opencode 実行
opencode ~/workspaces

Ghostty

Zed のインストール
brew install zed 
✔︎ JSON API cask.jws.json                           Downloaded  15.4MB/ 15.4MB
✔︎ JSON API formula.jws.json                        Downloaded  32.0MB/ 32.0MB
==> Fetching downloads for: zed
...
==> Installing Cask zed
==> Moving App 'Zed.app' to '/Applications/Zed.app'
==> Linking Binary 'cli' to '/opt/homebrew/bin/zed'
🍺  zed was successfully installed!
Agent Client Protocol の設定
opencode acp
  // ~/.config/zed/settings.json
+ {
+   "agent_servers": {
+     "opencode": {
+       "type": "registry"
+     }
+   }
+ }
Zed の実行
zed ~/workspaces
agent: new external agent thread

Command Palette

Zed

参考にしたページ