# Common Deployment Issues and Resolutions for the AI Hedge Fund Project

> Resolve common AI Hedge Fund deployment issues like missing env variables and Docker misconfigurations. Learn solutions for virattt/ai-hedge-fund success.

- Repository: [Virat Singh/ai-hedge-fund](https://github.com/virattt/ai-hedge-fund)
- Tags: how-to-guide
- Published: 2026-03-09

---

**The most frequent deployment failures in the virattt/ai-hedge-fund repository stem from missing environment variables, unconfigured API rate limits, and Docker service misconfigurations, all resolvable through proper `.env` setup, cache utilization, and GPU driver installation.**

The **AI Hedge Fund** is a modular Python application that orchestrates multiple LLM agents to simulate trading strategies. Successfully deploying this system requires coordinating environment variables, external financial data APIs, and optional local LLM inference via Ollama. Understanding these **common deployment issues and resolutions** ensures smooth setup whether running locally, via Docker, or in cloud environments.

## Missing or Incorrect Environment Variable Configuration

### The Problem

Running the application without a properly configured `.env` file causes immediate authentication failures. The system attempts to read API keys from the environment, receiving `None` values when variables are undefined, which results in incomplete HTTP headers being sent to external services.

### Root Cause in Source Code

In [`src/tools/api.py`](https://github.com/virattt/ai-hedge-fund/blob/main/src/tools/api.py), the function `_make_api_request` retrieves `FINANCIAL_DATASETS_API_KEY` using `os.environ.get("FINANCIAL_DATASETS_API_KEY")` at lines 70-74. Similarly, [`src/llm/models.py`](https://github.com/virattt/ai-hedge-fund/blob/main/src/llm/models.py) handles provider-specific keys including `OPENAI_API_KEY` and `ANTHROPIC_API_KEY` at lines 140-168. When these environment variables are absent, request headers remain incomplete, triggering 401 or 403 errors from remote APIs.

### Resolution Steps

1. **Initialize the environment file** – The [`docker/run.sh`](https://github.com/virattt/ai-hedge-fund/blob/main/docker/run.sh) wrapper automatically copies `.env.example` to `.env` if the file is absent at lines 44-48.

2. **Configure API credentials** – Edit `.env` to replace placeholder values with valid keys from Financial Datasets, OpenAI, Anthropic, or other providers as specified in `.env.example` at lines 1-38.

3. **Verify mounting** – Confirm variables are accessible inside containers by running `poetry run python -c "import os; print(os.getenv('OPENAI_API_KEY'))"`. The `docker run` command mounts the file via `-v $(pwd)/.env:/app/.env` at lines 65-66 in [`run.sh`](https://github.com/virattt/ai-hedge-fund/blob/main/run.sh).

## Financial Datasets API Rate Limiting and 429 Errors

### The Problem

The application encounters HTTP 429 (Too Many Requests) responses from the Financial Datasets API, causing data retrieval failures or empty results that propagate through the agent workflow.

### Backoff Implementation

The `_make_api_request` function in [`src/tools/api.py`](https://github.com/virattt/ai-hedge-fund/blob/main/src/tools/api.py) implements a linear backoff strategy at lines 43-55, beginning with a 60-second delay and incrementing by 30 seconds per retry. If the caller, such as `get_prices`, does not handle the final 429 after exhausting `max_retries=3`, the function returns an empty list, starving the analysis agents of price data.

### Mitigation Strategies

- **Configure retry limits** – Ensure `max_retries` is set sufficiently high in your configuration to accommodate your API tier.
- **Enable response caching** – Activate the cache layer in [`src/data/cache.py`](https://github.com/virattt/ai-hedge-fund/blob/main/src/data/cache.py) at lines 60-73 to store successful responses, significantly reducing redundant API calls during repeated backtesting.
- **Upgrade API quotas** – Contact Financial Datasets to increase rate limits, or implement request throttling to distribute load over longer intervals.

## Docker Image Build and Dependency Failures

### The Problem

Building the Docker image fails with dependency resolution errors, network timeouts, or permission issues, preventing container initialization.

### Build Process Overview

The `docker/Dockerfile` defines a multi-stage build that installs Poetry version `1.7.1` at lines 8-10, then copies [`pyproject.toml`](https://github.com/virattt/ai-hedge-fund/blob/main/pyproject.toml) and `poetry.lock` before executing `poetry install` at lines 11-16. This approach guarantees reproducible environments but requires reliable network access to PyPI and compatibility between the pinned Poetry version and the lockfile format.

### Fixing Build Issues

1. **Check network connectivity** – Ensure the build environment can reach PyPI to download packages; corporate proxies or offline environments require alternative registry configurations.

2. **Verify Poetry version compatibility** – The Dockerfile pins Poetry to `1.7.1`. When upgrading Poetry locally, regenerate the lockfile with the new version to prevent parsing errors.

3. **Debug verbose builds** – Run `docker build --no-cache -t ai-hedge-fund -f docker/Dockerfile ..` to identify the specific layer where installation fails.

## Ollama LLM Service Startup and Connectivity Issues

### The Problem

Activating the `--ollama` flag results in "Ollama is not running" errors or model pull failures, preventing local LLM inference.

### Embedded vs External Ollama

The [`docker/run.sh`](https://github.com/virattt/ai-hedge-fund/blob/main/docker/run.sh) script supports two operational modes. It can launch an embedded Ollama container via Docker Compose using the `embedded-ollama` profile at lines 69-73 and 122-124, or connect to an external instance specified via `--ollama-base-url`. The script polls `http://localhost:11434/api/version` at lines 76-82 to confirm service readiness before proceeding.

### Service Detection Logic

In [`src/utils/docker.py`](https://github.com/virattt/ai-hedge-fund/blob/main/src/utils/docker.py), utility functions check Ollama availability and manage model operations. The script waits for the service to respond with a valid JSON version object before executing `ollama pull` commands.

### Troubleshooting Steps

1. **Install Docker Compose** – The script explicitly checks for Docker Compose installation at lines 36-40 and aborts if the binary is missing. Install via `sudo apt-get install docker-compose` on Linux or use the built-in `docker compose` plugin on modern Docker installations.

2. **Start Ollama manually** – If the script fails to launch the service, execute `docker compose up -d ollama` directly from the project root.

3. **Verify connectivity** – Test the health endpoint with `curl http://localhost:11434/api/version`. A valid response contains a JSON version object.

4. **Pull models explicitly** – Use `./run.sh pull llama3` to download models; the script waits for Ollama startup and executes `ollama pull` inside the container at lines 96-104 and 124-126.

## GPU Configuration Not Detected in Containers

### The Problem

NVIDIA GPU acceleration fails to activate for Ollama inference, resulting in slower CPU-only processing despite available hardware.

### NVIDIA Container Toolkit Requirements

The [`docker/run.sh`](https://github.com/virattt/ai-hedge-fund/blob/main/docker/run.sh) script detects NVIDIA hardware by executing `nvidia-smi` at lines 58-61. When detection succeeds, it appends a GPU-specific compose file (e.g., [`docker-compose.nvidia.yml`](https://github.com/virattt/ai-hedge-fund/blob/main/docker-compose.nvidia.yml)) to enable GPU passthrough. However, this requires the NVIDIA Container Toolkit installed on the host system.

### Enabling GPU Support

1. **Install NVIDIA drivers and Container Toolkit** – Follow the official NVIDIA documentation to install the toolkit on your host operating system.

2. **Verify GPU access** – Run `docker run --gpus all nvidia/cuda:12.0-base nvidia-smi` to confirm Docker can access the GPU.

3. **Execute with automatic detection** – Run `./run.sh --ollama` without manual GPU flags; the script automatically adds the GPU profile when `nvidia-smi` is present on the host.

## Command-Line Argument Parsing and Validation Errors

### The Problem

Passing invalid date formats or omitting required flags like `--ticker` results in usage errors or empty portfolio simulations.

### Input Validation Logic

The [`src/cli/input.py`](https://github.com/virattt/ai-hedge-fund/blob/main/src/cli/input.py) module parses command-line arguments, enforcing ISO 8601 date formats (`YYYY-MM-DD`) for `--start-date` and `--end-date` parameters. The system does not validate ticker symbols against the Financial Datasets API before execution; providing invalid or delisted symbols results in empty price arrays that propagate through the LangGraph workflow without triggering analysis agents.

### Common Mistakes

- **Date format errors** – Using `01/01/2024` instead of `2024-01-01` causes parsing failures.
- **Missing tickers** – Omitting `--ticker` produces an empty watchlist, preventing agent execution.
- **Invalid symbols** – Non-existent ticker codes return empty price data from the Financial Datasets API.

### Resolution

- **Consult the help menu** – Run `./run.sh --help` to view available options and formatting requirements at lines 3-28 in [`run.sh`](https://github.com/virattt/ai-hedge-fund/blob/main/run.sh).
- **Validate date formats** – Use ISO 8601 format: `--start-date 2024-01-01 --end-date 2024-03-31`.
- **Verify ticker existence** – Confirm symbols like AAPL, MSFT, or NVDA are available on the Financial Datasets platform before execution.

## Missing Python Dependencies at Runtime

### The Problem

Executing the CLI directly via `poetry run python src/main.py` raises `ModuleNotFoundError` for critical packages like `langgraph` or `pandas`.

### Poetry Environment Issues

The repository uses Poetry for dependency management as defined in [`pyproject.toml`](https://github.com/virattt/ai-hedge-fund/blob/main/pyproject.toml). The `docker/Dockerfile` executes `poetry install` during the image build process at lines 11-16, but local development environments often skip this step or use system Python interpreters that lack the required packages.

### Resolution Steps

1. **Install project dependencies** – Execute `poetry install` from the project root to create the virtual environment and install all packages from the lockfile.

2. **Activate the environment** – Use `poetry shell` to enter the virtual environment, or prefix commands with `poetry run` to ensure correct package resolution.

3. **Verify critical imports** – Test the installation by running `poetry run python -c "import langgraph; import pandas; print('Dependencies OK')"` before executing the main application.

## Summary

- **Environment configuration** is the most frequent source of deployment failures; always verify `.env` contains valid `FINANCIAL_DATASETS_API_KEY` and LLM provider keys before starting containers.
- **API rate limiting** requires utilizing the built-in retry logic with caching enabled to handle HTTP 429 errors gracefully.
- **Docker builds** need reliable network access to PyPI and compatible Poetry versions to resolve dependencies correctly.
- **Ollama services** depend on Docker Compose availability and proper health checking at `localhost:11434` before model execution.
- **GPU acceleration** demands the NVIDIA Container Toolkit and successful detection via `nvidia-smi` to enable hardware-accelerated inference.
- **CLI arguments** must follow ISO date formats (`YYYY-MM-DD`) and valid ticker symbols to prevent empty agent workflows.
- **Python dependencies** require running `poetry install` before local execution to prevent `ModuleNotFoundError` exceptions.

## Frequently Asked Questions

### Why does the application fail immediately with authentication errors?

Authentication failures occur when the `.env` file is missing or contains placeholder API keys. The [`src/tools/api.py`](https://github.com/virattt/ai-hedge-fund/blob/main/src/tools/api.py) file attempts to read `FINANCIAL_DATASETS_API_KEY` via `os.environ.get()`, and [`src/llm/models.py`](https://github.com/virattt/ai-hedge-fund/blob/main/src/llm/models.py) retrieves provider-specific keys like `OPENAI_API_KEY`. If these return `None`, the application sends requests without proper headers, resulting in 401 or 403 errors. Resolve this by copying `.env.example` to `.env` and populating it with valid credentials.

### How do I resolve HTTP 429 errors from the Financial Datasets API?

HTTP 429 errors indicate rate limiting. The `_make_api_request` function in [`src/tools/api.py`](https://github.com/virattt/ai-hedge-fund/blob/main/src/tools/api.py) implements a linear backoff strategy, waiting 60 seconds initially and adding 30 seconds per retry. To resolve persistent 429 errors, ensure `max_retries` is set sufficiently high in your configuration, enable the caching layer in [`src/data/cache.py`](https://github.com/virattt/ai-hedge-fund/blob/main/src/data/cache.py) to reduce redundant calls, or contact your API provider to increase quota limits.

### Why is Ollama not starting when I use the --ollama flag?

The [`docker/run.sh`](https://github.com/virattt/ai-hedge-fund/blob/main/docker/run.sh) script attempts to launch Ollama via Docker Compose using the `embedded-ollama` profile, then polls `http://localhost:11434/api/version` to verify readiness. Failures typically occur when Docker Compose is not installed (the script checks for this at lines 36-40), when the Ollama container fails to start due to port conflicts, or when the health check times out. Resolve this by ensuring Docker Compose is available, starting the service manually with `docker compose up -d ollama`, and verifying connectivity with `curl http://localhost:11434/api/version`.

### How do I enable GPU acceleration for Ollama inference?

GPU acceleration requires the NVIDIA Container Toolkit installed on the host system. The [`docker/run.sh`](https://github.com/virattt/ai-hedge-fund/blob/main/docker/run.sh) script detects NVIDIA hardware by executing `nvidia-smi` at lines 58-61 and automatically appends the GPU-specific compose file when detected. If GPU acceleration fails, verify your installation by running `docker run --gpus all nvidia/cuda:12.0-base nvidia-smi`. If this command fails, install the NVIDIA Container Toolkit following the official NVIDIA documentation, then restart Docker and rerun the hedge fund script with the `--ollama` flag. </think># Common Deployment Issues and Resolutions for the AI Hedge Fund Project

**The most frequent deployment failures in the virattt/ai-hedge-fund repository stem from missing environment variables, unconfigured API rate limits, and Docker service misconfigurations, all resolvable through proper `.env` setup, cache utilization, and GPU driver installation.**

The **AI Hedge Fund** is a modular Python application that orchestrates multiple LLM agents to simulate trading strategies. Successfully deploying this system requires coordinating environment variables, external financial data APIs, and optional local inference via Ollama. This guide addresses the **common deployment issues and resolutions** encountered when running the application locally, via Docker, or in cloud environments, with specific references to the source code implementation.

## Environment Variable Configuration Errors

### The Problem

Running the application without a properly configured `.env` file causes immediate authentication failures. The system attempts to read API keys from the environment, receiving `None` values when variables are undefined, which results in incomplete HTTP headers being sent to external services.

### Root Cause in Source Code

In [`src/tools/api.py`](https://github.com/virattt/ai-hedge-fund/blob/main/src/tools/api.py), the function `_make_api_request` retrieves `FINANCIAL_DATASETS_API_KEY` using `os.environ.get("FINANCIAL_DATASETS_API_KEY")` at lines 70-74. Similarly, [`src/llm/models.py`](https://github.com/virattt/ai-hedge-fund/blob/main/src/llm/models.py) handles provider-specific keys like `OPENAI_API_KEY` and `ANTHROPIC_API_KEY` using the same pattern at lines 140-168. When these environment variables are absent, request headers remain incomplete, triggering 401 or 403 errors from remote APIs.

### Resolution Steps

1. **Initialize the environment file** – The [`docker/run.sh`](https://github.com/virattt/ai-hedge-fund/blob/main/docker/run.sh) wrapper automatically copies `.env.example` to `.env` if the latter is missing at lines 44-48.

2. **Configure API credentials** – Edit `.env` to replace placeholder values with actual keys from Financial Datasets, OpenAI, Anthropic, or other providers as specified in `.env.example` at lines 1-38.

3. **Verify visibility** – Run `poetry run python -c "import os; print(os.getenv('OPENAI_API_KEY'))"` to confirm variables are accessible inside the container, which mounts the file via `-v $(pwd)/.env:/app/.env` at lines 65-66 in [`run.sh`](https://github.com/virattt/ai-hedge-fund/blob/main/run.sh).

## Financial Datasets API Rate Limiting and 429 Errors

### The Problem

When the Financial Datasets API returns HTTP 429 (Too Many Requests), the application may abort or return empty datasets, causing downstream agents to generate no trading signals.

### Backoff Implementation

The `_make_api_request` function in [`src/tools/api.py`](https://github.com/virattt/ai-hedge-fund/blob/main/src/tools/api.py) implements a linear backoff strategy at lines 43-55, waiting 60 seconds initially and adding 30 seconds per subsequent retry. However, if the caller such as `get_prices` does not handle the final 429 after exhausting `max_retries=3`, an empty list propagates to the analysis agents.

### Mitigation Strategies

- **Allow sufficient retries** – Ensure the default `max_retries=3` parameter in `_make_api_request` meets your usage patterns.
- **Increase API quotas** – Contact the Financial Datasets provider to raise rate limits or distribute requests over time.
- **Enable caching** – The [`src/data/cache.py`](https://github.com/virattt/ai-hedge-fund/blob/main/src/data/cache.py) layer stores successful API responses, significantly reducing repeated calls during backtesting at lines 60-73.

## Docker Image Build and Dependency Failures

### The Problem

Executing `docker build` may fail with missing dependencies, network timeouts, or permission errors, preventing container creation.

### Build Process Overview

The `docker/Dockerfile` installs Poetry version `1.7.1` at lines 8-10, then copies [`pyproject.toml`](https://github.com/virattt/ai-hedge-fund/blob/main/pyproject.toml) and `poetry.lock` before running `poetry install` at lines 11-16. This approach ensures reproducible builds but requires network access to PyPI and compatibility between the pinned Poetry version and the lockfile.

### Fixing Build Issues

1. **Check network connectivity** – The build process must download packages from PyPI; corporate firewalls or offline environments will cause failures.

2. **Pin Poetry versions** – The Dockerfile already pins Poetry to `1.7.1`. If upgrading Poetry, update both the Dockerfile and regenerate `poetry.lock` using the new version.

3. **Debug verbose builds** – Run `docker build --no-cache -t ai-hedge-fund -f docker/Dockerfile ..` to identify the exact layer where installation fails.

## Ollama LLM Service Startup and Connectivity Issues

### The Problem

Using the `--ollama` flag results in "Ollama is not running" errors or model pull failures, preventing local LLM inference.

### Embedded vs External Ollama

The [`docker/run.sh`](https://github.com/virattt/ai-hedge-fund/blob/main/docker/run.sh) script supports two modes: launching an embedded Ollama container via Docker Compose with the `embedded-ollama` profile at lines 69-73 and 122-124, or connecting to an external instance via `--ollama-base-url`. The script polls `http://localhost:11434/api/version` at lines 76-82 to verify readiness before proceeding.

### Service Detection Logic

In [`src/utils/docker.py`](https://github.com/virattt/ai-hedge-fund/blob/main/src/utils/docker.py), utility functions check Ollama availability and manage model operations. The script waits for the service to respond with a valid JSON version object before executing `ollama pull` commands.

### Troubleshooting Steps

1. **Install Docker Compose** – Ensure the `docker-compose` binary or `docker compose` plugin is available; the script checks for this at lines 36-40 and aborts if missing.

2. **Start Ollama manually** – If the script fails, launch the service directly: `docker compose up -d ollama`.

3. **Verify connectivity** – Test the endpoint: `curl http://localhost:11434/api/version`. Expect a JSON response containing version information.

4. **Pull models explicitly** – Use `./run.sh pull llama3` to download models; the script waits for Ollama startup and executes `ollama pull` inside the container at lines 96-104 and 124-126.

## GPU Configuration Not Detected in Containers

### The Problem

GPU-accelerated inference fails to activate, causing slower CPU-only LLM processing despite available NVIDIA hardware.

### NVIDIA GPU Configuration

The [`docker/run.sh`](https://github.com/virattt/ai-hedge-fund/blob/main/docker/run.sh) script detects NVIDIA GPUs by executing `nvidia-smi` at lines 58-61. When detected, it appends an additional compose file (e.g., [`docker-compose.nvidia.yml`](https://github.com/virattt/ai-hedge-fund/blob/main/docker-compose.nvidia.yml)) to enable GPU passthrough. However, this requires the NVIDIA Container Toolkit installed on the host.

### Verification Commands

1. **Install prerequisites** – Follow the official NVIDIA Container Toolkit installation guide to enable GPU support in Docker containers.

2. **Verify GPU access** – Run `docker run --gpus all nvidia/cuda:12.0-base nvidia-smi` to confirm the GPU is visible inside containers.

3. **Enable automatic detection** – Execute `./run.sh --ollama` without additional flags; the script automatically adds the GPU profile when `nvidia-smi` is present on the host system.

## Command-Line Argument Parsing and Validation Errors

### The Problem

Passing invalid date formats or omitting required parameters causes immediate script termination or empty portfolio results.

### Input Requirements

The [`src/cli/input.py`](https://github.com/virattt/ai-hedge-fund/blob/main/src/cli/input.py) module parses command-line arguments, expecting ISO-format dates (`YYYY-MM-DD`) for `--start-date` and `--end-date` parameters. The system does not validate ticker symbols against the data provider; supplying invalid symbols results in empty data sets that propagate through the agent workflow without generating trading signals.

### Common Mistakes

- **Date format errors** – Using `01/01/2024` instead of `2024-01-01` causes parsing failures.
- **Missing tickers** – Omitting `--ticker` produces an empty watchlist, preventing agent execution.
- **Invalid symbols** – Non-existent ticker codes return empty price data from the Financial Datasets API.

### Resolution

- **Consult the help menu** – Run `./run.sh --help` to view available options and formatting requirements at lines 3-28 in [`run.sh`](https://github.com/virattt/ai-hedge-fund/blob/main/run.sh).
- **Validate date formats** – Use ISO 8601 format: `--start-date 2024-01-01 --end-date 2024-03-31`.
- **Verify ticker existence** – Confirm symbols like AAPL, MSFT, or NVDA are available on the Financial Datasets platform before execution.

## Missing Python Dependencies at Runtime

### The Problem

Executing the CLI directly via `poetry run python src/main.py` raises `ModuleNotFoundError` for packages like `pandas`, `langgraph`, or `openai`.

### Poetry Environment Issues

The repository uses Poetry for dependency management defined in [`pyproject.toml`](https://github.com/virattt/ai-hedge-fund/blob/main/pyproject.toml). The `docker/Dockerfile` executes `poetry install` during image build at lines 11-16, but local development environments often skip this step or use incompatible Python versions.

### Resolution Steps

1. **Install dependencies** – Execute `poetry install` from the project root to create the virtual environment and install all packages from the lockfile.

2. **Activate the environment** – Use `poetry shell` to enter the virtual environment, or prefix commands with `poetry run` to ensure correct package resolution.

3. **Verify installation** – Run `poetry run python -c "import langgraph; import pandas; print('Dependencies OK')"` to confirm critical dependencies are available.

## Summary

- **Environment configuration** is the most frequent source of deployment failures; always verify `.env` contains valid `FINANCIAL_DATASETS_API_KEY` and LLM provider keys before starting containers.
- **API rate limiting** requires utilizing the built-in retry logic with caching enabled to handle HTTP 429 errors gracefully.
- **Docker builds** need reliable network access to PyPI and compatible Poetry versions to resolve dependencies correctly.
- **Ollama services** depend on Docker Compose availability and proper health checking at `localhost:11434` before model execution.
- **GPU acceleration** demands the NVIDIA Container Toolkit and successful detection via `nvidia-smi` to enable hardware-accelerated inference.
- **CLI validation** depends on ISO date formats (`YYYY-MM-DD`) and valid ticker symbols to prevent empty agent workflows.
- **Python dependencies** require running `poetry install` before local execution to prevent `ModuleNotFoundError` exceptions.

## Frequently Asked Questions

### Why does the application fail immediately with authentication errors?

Authentication failures occur when the `.env` file is missing or contains placeholder API keys. The [`src/tools/api.py`](https://github.com/virattt/ai-hedge-fund/blob/main/src/tools/api.py) file attempts to read `FINANCIAL_DATASETS_API_KEY` via `os.environ.get()`, and [`src/llm/models.py`](https://github.com/virattt/ai-hedge-fund/blob/main/src/llm/models.py) retrieves provider-specific keys like `OPENAI_API_KEY`. If these return `None`, the application sends requests without proper headers, resulting in 401 or 403 errors. Resolve this by copying `.env.example` to `.env` and populating it with valid credentials.

### How do I resolve HTTP 429 errors from the Financial Datasets API?

HTTP 429 errors indicate rate limiting. The `_make_api_request` function in [`src/tools/api.py`](https://github.com/virattt/ai-hedge-fund/blob/main/src/tools/api.py) implements a linear backoff strategy, waiting 60 seconds initially and adding 30 seconds per retry. To resolve persistent 429 errors, ensure `max_retries` is set sufficiently high in your configuration, enable the caching layer in [`src/data/cache.py`](https://github.com/virattt/ai-hedge-fund/blob/main/src/data/cache.py) to reduce redundant calls, or contact your API provider to increase quota limits.

### Why is Ollama not starting when I use the --ollama flag?

The [`docker/run.sh`](https://github.com/virattt/ai-hedge-fund/blob/main/docker/run.sh) script attempts to launch Ollama via Docker Compose using the `embedded-ollama` profile, then polls `http://localhost:11434/api/version` to verify readiness. Failures typically occur when Docker Compose is not installed (the script checks for this at lines 36-40), when the Ollama container fails to start due to port conflicts, or when the health check times out. Resolve this by ensuring Docker Compose is available, starting the service manually with `docker compose up -d ollama`, and verifying connectivity with `curl http://localhost:11434/api/version`.

### How do I enable GPU acceleration for Ollama inference?

GPU acceleration requires the NVIDIA Container Toolkit installed on the host system. The [`docker/run.sh`](https://github.com/virattt/ai-hedge-fund/blob/main/docker/run.sh) script detects NVIDIA hardware by executing `nvidia-smi` at lines 58-61 and automatically appends the GPU-specific compose file when detected. If GPU acceleration fails, verify your installation by running `docker run --gpus all nvidia/cuda:12.0-base nvidia-smi`. If this command fails, install the NVIDIA Container Toolkit following the official NVIDIA documentation, then restart Docker and rerun the hedge fund script with the `--ollama` flag.