Reuse One Ollama Service Across Local Agents
Reuse One Ollama Service Across Local Agents
Avoid duplicate model servers in Docker experiments. This is part two of the WAB ENGINE and AI Agents programming series, grounded in the V3.4 Testnet experiments.
What the experiment actually showed
The Testnet host already had Ollama serving qwen3:1.7b. A second Ollama container attempted to bind the same port and restarted repeatedly.
Engineering method
Keep Ollama as an independent service and point experimental agents to its reachable endpoint. When using host networking, 127.0.0.1 refers to the host namespace; with bridge networking it does not.
A repeatable local exercise
Use Repo/port_check.sh and verify GET /api/tags.
Use a recorded JSON response or a mock HTTP server. Run local unit tests, compare actual values with expected values, and inspect error paths. An AI response must not be used as evidence of a wallet transaction or its confirmation.
What can go wrong
Never assume the same URL works across all Docker network modes. Restrict exposure and test connectivity from inside the agent container.
Practical review questions
- Which facts came directly from WAB ENGINE, and which are generated prose?
- Can the experiment be repeated without broadcasting another transaction?
- What observation would falsify the diagnosis?
- Which error states are visible to the caller rather than hidden by a fallback?
Implementation boundary
WAB ENGINE remains the authoritative execution layer. The experimental agent is a separate client. Examples are intentionally scoped to Testnet and do not modify the Engine, Bitcoin Core, the signed fee law, or deployed wallet state.
Project references
- WAB ENGINE API: https://thamer.org/api
- WAB ENGINE overview: https://thamer.org/engine
- Educational code repository: https://thamer.org/repo/
Scope: experimental Testnet programming notes and preliminary SDK-style examples, not production-ready wallet software.
