This project gives a fundamental introduction to LangGraph by using it to build a simple but powerful data analytics AI agent that can query your database, perform analyses, and generate visualizations. This is an end-to-end, full-deployed AI agent that will teach you core Langgraph concepts so that you can build amazing AI systems yourself. It's meant to be a starting point so add to this example to expand on the agent's capabilities and create your own full-deployed AI agents. Everything covered is free except for usage of the OpenAI API - however feel free to adopt the code to use any provider including local models for free.
Watch the Youtube video and Subscribe to my free community to get the accompanying cheat-sheet with in-depth notes and more advanced topics.
- Python 3.12
- OpenAI API key
- Supabase account (optional for persistance and deployment)
- Langsmith account (optional for tracing)
- Render account (optional for deployment)
Only steps 1 through 4 are required to get the agent up and running locally. Steps 5-7 are optional if you want to deploy the agent to the cloud to interact with from anywhere.
If you want to follow everything through deploying your agent, then you'll want to fork the repo. Forking is required to deploy because you'll need to publish the repo to your own Github for deployment on Render. If you don't plan to deploy, you can just clone this repo instead.
- 
To fork the repo, click the fork button in the top right corner of the repo page.  
- 
Navigate to the local directory on your machine where you want to clone the repo. 
git clone [YOUR REPO URL]- Enter the project directory
cd langgraph-introThe recommended way is to use the package manager uv as it's fast, efficient, and makes the whole process much easier! See uv for information on how to install uv.
If using uv, we can create a virtual environment in the project directory and install the required packages with two commands.
uv venvuv syncWe also want to install the local onlyvans package in editable mode so that we can import it to our frontend scripts, and so that any changes you make will be automatically reflected. Be sure to include the period at the end of the command.
uv pip install -e .- Rename or copy the .env.samplefile to.env. We will fill in the required environment variables in the next steps.
- Create an OpenAI account at platform.openai.com.
- Navigate to the Dashboard in the top Menu.
- From the side menu, select API Keys.
- Create an API key and save it in the .envfile.
We are using Supabase for our Postgresql database. Supabase is easy to set up and offers a generous free tier. You can optionally connect any database of your choosing by simply changing the SUPABASE_URL and DATABASE_URI in the .env file.
- 
Create a Supabase account at supabase.com. 
- 
Create a new project called OnlyVans. I recommend using the generate password tool that Supabase provides and SAVE the password in your .envfile. 
- 
At the top of the project page, click on the connect button and we're going to copy two connection strings to the .envfile. - Set the SUPABASE_URLto the connection string for the transaction pooler.
- Set the DATABASE_URIto the connection string for the session pooler.
- Make sure you replace the password in both connection strings with the password you saved in the .envfile.
- For context, the DATABASE_URI is only required for deployment. It's used exclusively by the Langgraph Server API for persistence. The SUPABASE_URL is used by our agent to query the database.
 
- Set the 
- 
Select the new project and navigate to the Table Editor in the side menu. 
- 
Click on the schema dropdown and create a new schema called onlyvans.
- Make sure the onlyvansschema is selected, sometimes it defaults back to public so check each time you create a new table that it's under theonlyvansschema.
- Create a new table called creators.
- You'll see a pop up and you can select the import data from CSV button to automatically load the data and set the schema. You'll have to set the idcolumn to be the primary key. Repeat this for the other tables by loading all of the data in the sample_data folder.
Langsmith is used for logging and monitoring. This is completely optional but highly recommended as it makes it easy to track and debug your LangGraph applications. You can create a free account at langsmith.com. Create a new tracing project, create an API key and save it in the .env file.
Render is used for deploying the LangGraph server. This is completely optional but highly recommended as it makes it easy to deploy your LangGraph applications. You can create a free account at render.com.
The deployment is going to leverage the Langgraph CLI which allows us to create a Dockerfile for our Langgraph server. This has already been done for you in the root directory. This Dockerfile will be used by the Render web service to build and deploy the Langgraph server. The web service will have a CI/CD pipeline that will automatically build and deploy the Langgraph server whenever you push to the main branch. To deploy your agent, first ensure you've published your project to Github and linked your Github to Render. Then you can simply follow along this YouTube Episode where we take the agent that we've built here and deploy the fully-featured Langgraph Server API to serve your agent from anywhere!


