Local Setup
Fast-moving development ahead!
We strive to keep our documentation accurate and up to date. However, our development cycles move quickly, and occasionally the docs may fall slightly behind. If you run into any issues or something doesn’t work as expected, please don’t hesitate to reach out — we’re here to help!
Table of Contents
- Setup Instructions
- Local Startup Instructions
- Local Clean up Instructions
- Dev Startup Instructions
- Dev Clean up Instructions
Setup Instructions
- Install direnv.
- Install the latest version of uv using:
curl -LsSf https://astral.sh/uv/install.sh | sh - Run
git clone git@github.com:IDinsight/DiagnosticAgentGraphRAG.gitand cd into the root directory of the repo. - Copy the root
.template.envto.envand update the following environment variables in.env:GOOGLE_APPLICATION_CREDENTIALS: The absolute path to your Google Cloud service account key file.OPENAI_API_KEY: Your OpenAI API key.PATHS_PROJECT_DIR: The absolute path to the root directory of the project.
- Allow
direnvto load the root environment variables by runningdirenv allow. - [OPTIONAL (ONLY IF YOU WANT TO RUN IN DEV ENVIRONMENT)] cd into cicd/deployment/docker-compose directory of the repo and copy
docker-compose/.template.envtodocker-compose/.envand update:GOOGLE_APPLICATION_CREDENTIALS: The absolute path to your Google Cloud service account key file.OPENAI_API_KEY: Your OpenAI API key.PATHS_PROJECT_DIR: Set this to the absolute path of the root directory of the repo.
- cd into the backend directory of the repo and:
- Copy
backend/.template.envtobackend/.env. - Allow
direnvto load the backend environment variables by runningdirenv allow.
- Copy
- Contact Tony Zhao for data files for the graph database and put all data files under
PATHS_PROJECT_DIR/results.
Local Startup Instructions
- [OPTIONAL] If you started the dev environment first, then from the root directory, run
make down-devto stop all dev environment containers. - From the root directory, execute
make up-local. This will initialize the Docker containers for the local environment. - cd in the backend directory of the repo and:
- Run
make fresh-env. This will create a new virtual environment for the backend and install all dependencies. - Run
source .venv/bin/activate: This will activate the virtual environment created bymake fresh-env.
- Run
- Starting FastAPI
- From the backend directory, run
python src/dagrag/entries/main.py: This will start the FastAPI server onhttp://localhost:8000. - Go to http://localhost:8000/docs to view the backend API routes.
- From the backend directory, run
- Starting Frontend
- In another terminal window, cd into the frontend directory of the repo and:
- Run
pnpm i. This will install all dependencies for the frontend. - Run
pnpm run dev. This will start the frontend server onhttp://localhost:3000. - Go to http://localhost:3000 to view the frontend UI.
- Run
- In another terminal window, cd into the frontend directory of the repo and:
Local Clean up Instructions
- Ctrl-C to stop the FastAPI server and the frontend application in each of their respective terminal windows.
- In the backend directory, run
deactivate. This will exit out of the virtual environment created byuv. - cd back to the root directory and run
make down-local. This will stop all local containers. - [OPTIONAL] In the root directory, run
make clean-docker. This will remove all Docker images and containers created during the local testing setup. Use this command with caution as it will remove all Docker images and containers, not just those related to this project.
Dev Startup Instructions
- [OPTIONAL] If you started the local environment first, then from the root directory, run
make down-localto stop all local environment containers. - From the root directory, run
make up-dev. This will initialize the Docker containers for the dev environment using Docker compose. - cd into the backend directory of the repo.
- Run
make fresh-env. This will create a new virtual environment for the backend and install all dependencies. - Run
source .venv/bin/activate: This will activate the virtual environment created bymake fresh-env.
- Run
- Starting Frontend
- cd into the frontend directory of the repo and:
- Run
pnpm i. This will install all dependencies for the frontend. - Run
pnpm run dev. This will start the frontend server onhttp://localhost:3000. - Go to http://localhost:3000 to view the frontend UI.
- Run
- cd into the frontend directory of the repo and:
Dev Clean up Instructions
- In the backend directory, run
deactivate. This will exit out of the virtual environment created byuv. - cd back to the root directory and run
make down-dev. This will stop all dev containers. - [OPTIONAL] In the root directory, run
make clean-docker. This will remove all Docker images and containers created during the local testing setup. Use this command with caution as it will remove all Docker images and containers, not just those related to this project.
➡️ Next: Testing the Diagnostic Agent Flow