From 25beaf6c68844539c3ef1eaafada9e38951debf3 Mon Sep 17 00:00:00 2001 From: Rohit Ghumare Date: Sat, 7 Nov 2026 00:21:29 +0530 Subject: [PATCH] fix(deploy): pass the provider selectors to Docker workers Since 0.9.32 a provider key alone does not turn on LLM features; the worker also needs AGENTMEMORY_LLM_PROVIDER. The root Docker Compose file, the Coolify Compose file and the runtime worker-compose forwarded the provider keys but not this selector, so Docker installs ran zero-LLM even with a key set. The native CLI compose already forwarded it. All three files now forward it. A new test checks that every selector and gate, plus the provider model and base-URL settings, reaches the worker in the native compose and in each Docker compose file. The deploy README now says which selectors turn providers on. --- deploy/README.md | 4 ++++ deploy/coolify/docker-compose.yml | 1 + deploy/runtime/worker-compose.yaml | 1 + docker-compose.yml | 1 + test/compose-project.test.ts | 29 +++++++++++++++++++++++++++++ 5 files changed, 36 insertions(+) diff --git a/deploy/README.md b/deploy/README.md index 7f6d503d3a..611128662a 100644 --- a/deploy/README.md +++ b/deploy/README.md @@ -38,6 +38,10 @@ docker run -d --name agentmemory \ Keep `/data` on a persistent volume: it holds the memories, the generated secret (`docker exec agentmemory cat /data/secret`) and the worker cache. The container fetches the pinned `state` and `http` registry workers on first start, so it needs network access then. Set `AGENTMEMORY_SECRET`, `EMBEDDING_PROVIDER` and the other variables from the sections above with `-e`. The `latest` tag points at the image for the highest stable release version (semver order, prereleases and drafts excluded), so an older, backported or prerelease build never replaces it. Pin a version tag for deployments. +## LLM and embedding providers + +A provider key alone turns nothing on. To use LLM summaries and compression, set `AGENTMEMORY_LLM_PROVIDER` (`anthropic`, `openai`, `gemini`, `openrouter` or `minimax`) and that provider's key. To use cloud embeddings, set `EMBEDDING_PROVIDER` and its key. All the Compose files above forward both selectors to the worker. + ## Local embeddings Set `EMBEDDING_PROVIDER=local` to generate embeddings without an API key. The shared image includes `@huggingface/transformers` and its runtime dependencies; the image build checks that the package loads after pruning development dependencies. Only ONNX native binaries for the image's platform and architecture are retained; other runtime dependencies remain installed. Model weights are not bundled: the first embedding request downloads `Xenova/all-MiniLM-L6-v2` from Hugging Face and requires network access. diff --git a/deploy/coolify/docker-compose.yml b/deploy/coolify/docker-compose.yml index a229cb7692..05da0fe676 100644 --- a/deploy/coolify/docker-compose.yml +++ b/deploy/coolify/docker-compose.yml @@ -15,6 +15,7 @@ services: VIEWER_ALLOWED_HOSTS: "${VIEWER_ALLOWED_HOSTS:-localhost:3113,127.0.0.1:3113,[::1]:3113}" VIEWER_ALLOWED_ORIGINS: "${VIEWER_ALLOWED_ORIGINS:-http://localhost:3113,http://127.0.0.1:3113}" EMBEDDING_PROVIDER: "${EMBEDDING_PROVIDER:-}" + AGENTMEMORY_LLM_PROVIDER: "${AGENTMEMORY_LLM_PROVIDER:-}" OPENAI_API_KEY: "${OPENAI_API_KEY:-}" OPENAI_API_KEY_FOR_LLM: "${OPENAI_API_KEY_FOR_LLM:-}" OPENAI_BASE_URL: "${OPENAI_BASE_URL:-}" diff --git a/deploy/runtime/worker-compose.yaml b/deploy/runtime/worker-compose.yaml index c1c1092887..f6acd3f27e 100644 --- a/deploy/runtime/worker-compose.yaml +++ b/deploy/runtime/worker-compose.yaml @@ -74,6 +74,7 @@ containers: VIEWER_ALLOWED_HOSTS: "${VIEWER_ALLOWED_HOSTS:-localhost:3113,127.0.0.1:3113,[::1]:3113}" VIEWER_ALLOWED_ORIGINS: "${VIEWER_ALLOWED_ORIGINS:-http://localhost:3113,http://127.0.0.1:3113}" EMBEDDING_PROVIDER: "${EMBEDDING_PROVIDER:-}" + AGENTMEMORY_LLM_PROVIDER: "${AGENTMEMORY_LLM_PROVIDER:-}" OPENAI_API_KEY: "${OPENAI_API_KEY:-}" OPENAI_API_KEY_FOR_LLM: "${OPENAI_API_KEY_FOR_LLM:-}" OPENAI_BASE_URL: "${OPENAI_BASE_URL:-}" diff --git a/docker-compose.yml b/docker-compose.yml index cd236d8243..3dd887e42c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -21,6 +21,7 @@ services: VIEWER_ALLOWED_HOSTS: "${VIEWER_ALLOWED_HOSTS:-localhost:${AGENTMEMORY_VIEWER_PORT:-3113},127.0.0.1:${AGENTMEMORY_VIEWER_PORT:-3113},[::1]:${AGENTMEMORY_VIEWER_PORT:-3113}}" VIEWER_ALLOWED_ORIGINS: "${VIEWER_ALLOWED_ORIGINS:-http://localhost:${AGENTMEMORY_VIEWER_PORT:-3113},http://127.0.0.1:${AGENTMEMORY_VIEWER_PORT:-3113}}" EMBEDDING_PROVIDER: "${EMBEDDING_PROVIDER:-}" + AGENTMEMORY_LLM_PROVIDER: "${AGENTMEMORY_LLM_PROVIDER:-}" OPENAI_API_KEY: "${OPENAI_API_KEY:-}" OPENAI_API_KEY_FOR_LLM: "${OPENAI_API_KEY_FOR_LLM:-}" OPENAI_BASE_URL: "${OPENAI_BASE_URL:-}" diff --git a/test/compose-project.test.ts b/test/compose-project.test.ts index 621a246667..5809e2da4e 100644 --- a/test/compose-project.test.ts +++ b/test/compose-project.test.ts @@ -165,6 +165,35 @@ describe("Worker Compose project", () => { expect(text.slice(0, text.indexOf("containers:")).concat(text.slice(text.indexOf(" state:"), text.indexOf(" agentmemory:")))).not.toContain("fake-gate-key"); }); + it("forwards every provider selector and gate wherever provider keys are forwarded", () => { + const selectors = { + AGENTMEMORY_LLM_PROVIDER: "anthropic", + EMBEDDING_PROVIDER: "openai", + AGENTMEMORY_ALLOW_AGENT_SDK: "true", + AGENTMEMORY_INJECT_CONTEXT: "true", + ANTHROPIC_MODEL: "model-a", + ANTHROPIC_BASE_URL: "http://127.0.0.1:4556", + OPENAI_MODEL: "model-b", + OPENAI_BASE_URL: "http://127.0.0.1:4555", + GEMINI_MODEL: "model-c", + OPENROUTER_MODEL: "model-d", + MINIMAX_MODEL: "model-e", + MINIMAX_BASE_URL: "http://127.0.0.1:4557", + }; + const native = parse(renderWorkerCompose(options({ workerEnvironment: selectors }))); + expect(native.containers.agentmemory.environment).toMatchObject(selectors); + const files = { + "deploy/runtime/worker-compose.yaml": parse(readFileSync(new URL("../deploy/runtime/worker-compose.yaml", import.meta.url), "utf8")).containers.agentmemory.environment, + "docker-compose.yml": parse(readFileSync(new URL("../docker-compose.yml", import.meta.url), "utf8")).services.agentmemory.environment, + "deploy/coolify/docker-compose.yml": parse(readFileSync(new URL("../deploy/coolify/docker-compose.yml", import.meta.url), "utf8")).services.agentmemory.environment, + }; + for (const [file, environment] of Object.entries(files)) { + for (const key of Object.keys(selectors)) { + expect(environment[key], `${file} forwards ${key}`).toBe("${" + key + ":-}"); + } + } + }); + it("preserves memory policy, provider and durability overrides in native and Docker workers", async () => { const settings = { FALLBACK_PROVIDERS: "openai,gemini",