Interacting with PostgreSQL in natural language thanks to AI

We’re still accomplishing remarkable feats with AI. A testament to this is an open-source project, currently in the experimental stage, utilizing a multi-agent AI system. This system allows users to pose questions to a PostgreSQL database using natural language.

Fueled by a combination of OpenAI, AutoGen, Postgres, Guidance, Aider, Poetry, and Python, this project stands among the first of its kind capable of leveraging LLMs (Large Language Models) to make decisions with reduced or less explicit instructions.

To familiarize yourself with this tool, grandiosely named “Multi-Agent Postgres Data Analytics,” the creator has produced a series of instructional videos available in a playlist.

To get started, you can position yourself on a branch of the project corresponding to a specific video by following these steps:

  1. Clone the repository:
   git clone
  1. View all branches corresponding to videos in the playlist:
   git branch -a
  1. Choose a branch and switch to it:
   git checkout <branch_name>
  1. Install dependencies:
   poetry install
  1. Copy the sample environment file:
   cp .env.sample .env
  1. Edit the .env file with your PostgreSQL URL and OpenAI key.

Once set up, you can run a prompt on your database like this:

poetry run start --prompt "<ask the AI agent a question>"

Start with simple questions to gauge the system’s response and gradually increase complexity.

Building systems that mimic human decision-making is the goal, but it’s important to note that the realm of AI multi-agent systems has its challenges. Clearly defining the roles and functions of your agents is an art, and costs can escalate, especially during the testing phase. Despite the complexities, the potential rewards make it a worthwhile endeavor. Dive in and explore, and you won’t be disappointed.

"Because of the Google update, I, like many other blogs, lost a lot of traffic."

Join the Newsletter

Please, subscribe to get our latest content by email.

Mohamed SAKHRI
Mohamed SAKHRI

I'm the creator and editor-in-chief of Tech To Geek. Through this little blog, I share with you my passion for technology. I specialize in various operating systems such as Windows, Linux, macOS, and Android, focusing on providing practical and valuable guides.

Articles: 1415

Newsletter Updates

Enter your email address below and subscribe to our newsletter

Leave a Reply

Your email address will not be published. Required fields are marked *