BUCKYVERSE

Date: 2025-05-16

Status

Accepted

Context

The Codexis project uses both OpenRouter and Ollama as LLM providers. The Ollama client requires a pool process (Codexis.LLM.OllamaClient.Pool) to be running. In server/OTP applications, this would typically be started in the supervision tree. However, most Codexis workflows are run via CLI commands (e.g., mix codexis.check_scannos ...), which do not always start the full supervision tree.

Decision

We decided to start the Ollama pool on demand, at the point of use, if the provider is set to :ollama and the pool is not already running. This logic is placed at the start of the scanno integration pipeline, ensuring that CLI commands work reliably without requiring a supervision tree or manual pool management.

if Application.get_env(:codexis, :llm_provider) == :ollama do
  case Process.whereis(Codexis.LLM.OllamaClient.Pool) do
    nil -> Codexis.LLM.OllamaClient.Pool.start_link([])
    _ -> :ok
  end
end

Consequences

Positive

Negative

References