✨ LangChain Education Series: Post 1 In this post, I will show how...

@itsafiz
Afiz ⚡️@itsafiz
29 views Nov 03, 2025 ~1 min read
Advertisement
1
✨ LangChain Education Series: Post 1

In this post, I will show how to build your first SQL Agent fast using @langchain.

A step by step guide 🧵 👇
Media image
2
@langchain I am going to use OpenAI for LLMs, so get your OpenAI API if you don't have it already.

Here is the quick demo of SQL Agent:
0:17
3
@langchain Step 1:

Add your OpenAI API key to .env file and install all the required modules in virtual env using pip or uv.
Media image
4
@langchain Step 2: Connect to DB and define the Runtime context. (Don't worry about runtime context for now, in the next post I will explain that in detail)
Media image
5
@langchain Step 3: Define the tool along with runtime context to execute SQL queries. (more on this in future posts)
Media image
6
@langchain Step 4: Define system prompt to let the agent know what it needs to do.
Media image
7
@langchain Step 5: Create the Agent.

As you can see, what we have defined 4 steps are all passed to the agent.
Media image
8
@langchain That's all! Now you can interact with your SQL agent.
Media image
9
@langchain You can find all the steps in the following repo.

github.com/afizs/python-n…

Finally thanks to LangChain Academy for their amazing courses.
10
@langchain I hope you find this post useful.

Follow me @itsafiz for more ML, NLP and AI content.

Like and RT this post to share with your friends.


@itsafiz
Afiz ⚡️@itsafiz
✨ LangChain Education Series: Post 1

In this post, I will show how to build your first SQL Agent fast using @langchain.

A step by step guide 🧵 👇
Media image
Actions
What You Can Do
  • Export as PDF or Markdown
  • Batch Export to Notion
  • Bookmark & Highlight
  • Screenshot Tweet
Create Free Account

Includes 7-day Premium trial

Advertisement