The first step, common to both the Docker and the source code setup approaches, is to clone the repository and access it:
git clone https://github.com/AstraBert/llamaindex-docs-agent.git
cd llamaindex-docs-agentOnce there, you can choose one of the two following approaches:
Required: Docker and docker compose
- Add the
openai_api_keyand thetavily_api_keyvariables in the.env.examplefile and modify the name of the file to.env. Get these keys:
mv .env.example .env- Launch the Docker application:
# If you are on Linux/macOS
bash start_services.sh
# If you are on Windows
.\start_services.ps1You will see the application running on http://localhost:8000/gradio and you will be able to use it. Depending on your connection and on your hardware, the set up might take some time (up to 30 mins to set up) - but this is only for the first time your run it!
Required: Docker, docker compose and conda
- Add the
openai_api_keyand thetavily_api_keyvariables in the.env.examplefile and modify the name of the file to.env. Get these keys:
mv .env.example .env- Set up LlamaIndex Docs Agent using the dedicated script:
# For MacOs/Linux users
bash setup.sh
# For Windows users
.\setup.ps1- Or you can do it manually, if you prefer:
docker compose up vector_db -d
conda env create -f environment.yml
conda activate llamaindex-docs
python3 scripts/loadData.py
cd scripts/
uvicorn main:app --host 0.0.0.0 --port 8000
conda deactivateYou will see the application running on http://localhost:8000/gradio and you will be able to use it.
Whenever the user asks a question from the Gradio chat interface running on http://localhost:8000/gradio, this question is processed by the /message endpoint of the FastAPI-managed API to which the Gradio app is attached. The /message endpoint passes the user message to the ReAct agent, which:
- Uses the query router to select an index (summary or vector database) from which to retrieve relevant information to the user's prompt. The vector database uses hybrid search.
- Once the retrieved information is sent to the agent, it thinks whether the context is sufficient or not: if yes, it formulates a solution and returns it to the user, if no it activates the Tavily search tool
- The Tavily search tool searches the web for a solution and returns an answer to the agent, which then decides if the answer is sufficient and, in that case, returns a solution to the user
Contributions are always welcome! Follow the contributions guidelines reported here.
The software is provided under MIT license.

