Run the Python intelligence layer as a Docker Compose service#8
Merged
Conversation
The NLP service (entity/relationship extraction -> knowledge graph) was built but never part of the stack, so its features were off by default and users had to start it by hand. Since Docker is already a prerequisite, make it a first-class compose service so `docker compose up -d` brings it up with everything else. - Add services/python-agent/Dockerfile: python:3.11-slim, CPU-only torch (keeps the image ~800MB instead of ~2.5GB CUDA build), spaCy and sentence-transformers models baked in so the first request is instant and offline-safe. - Add the python-agent service to docker-compose.yml with a healthcheck, wire PYTHON_SERVICE_URL=http://python-agent:8000 into the app container, and add it to depends_on (service_started — the agent already degrades gracefully if it's still warming up). - Note the larger first build + best-effort behaviour in SETUP.md. Standard Docker patterns; image build not run here (no Docker daemon in this environment). Model names match memory_intelligence.py (en_core_web_sm, all-MiniLM-L6-v2). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Makes the NLP knowledge-graph feature work out of the box. The Python intelligence layer (entity + relationship extraction) existed but was never part of the stack, so it was off by default and required a manual
uvicornstart. Since Docker is already a prerequisite, this makes it a first-class compose service —docker compose up -dnow brings it up with Qdrant/Ollama/the app.services/python-agent/Dockerfile:python:3.11-slim, CPU-only PyTorch (keeps the image ~800MB instead of the ~2.5GB CUDA build), with spaCy (en_core_web_sm) and sentence-transformers (all-MiniLM-L6-v2) models baked in so the first request is instant and offline-safe. Container healthcheck on/health.docker-compose.yml: adds thepython-agentservice, wiresPYTHON_SERVICE_URL=http://python-agent:8000into the app container, and adds it todepends_on(service_started— the agent already degrades gracefully while it warms up).SETUP.md: notes the larger first build and the best-effort behaviour.Test plan
PYTHON_SERVICE_URL+depends_onwiredmemory_intelligence.py(en_core_web_sm,all-MiniLM-L6-v2); uvicorn entrypoint path (app.main:app) matches the package layoutdocker compose up --buildwill build it🤖 Generated with Claude Code