Oh boy!
Back to all posts
development
June 13, 2025
5 min read

CodeSensei: An AI Programming Mentor

An AI agent designed to be a personal programming mentor

CodeSensei: An AI Programming Mentor

CodeSensei: An AI Programming Mentor

I've been working on CodeSensei, an AI agent designed to be a personal programming mentor. This all stems from the impact that LLM-based tools have had when it comes to learning anything. For those of us who have been learning things on the internet for years, before LLM-based tools emerged, the big challenge was how to organize a huge amount of information. The information was there, in incredible quantities. But the question was, --where do I start? What path should I follow? Is there something I'm skipping or not seeing? With Code Sensei we seek to simplify all this. We firmly believe that anyone interested in code can acquire functional knowledge in very little time. And we hope that Code Sensei helps to enhance potential talents.

What is the Project About?

CodeSensei is an intelligent conversational assistant built to help programmers of all levels. Its main objective is:

  • Resolve technical doubts: Stuck with a bug? Don't understand a concept?
  • Explain programming concepts: From variables in Python to loops in JavaScript, CodeSensei can offer clear and concise explanations.
  • Practice for technical interviews: CodeSensei can simulate being a technical interviewer, helping you prepare for common questions and improve your technical communication skills.

The idea is to create an accessible learning companion that's always available.

How Does It Work? The CodeSensei Flow

The internal workings of CodeSensei, especially with the introduction of LangGraph, follows a structured flow:

  1. User Input: The user sends a question or request to CodeSensei.
  2. Intent Routing (LangGraph): The first step is to determine the user's intent. Is it a general question? Do they want to practice an interview? About what topic? This node decides the path the conversation will follow.
  3. Knowledge Retrieval (RAG with FAISS): If the intent is a general question that could benefit from specific information, CodeSensei consults its knowledge base.
    • We use FAISS to create a vector index from text and markdown documents (for example, python_variables.txt, javascript_loops.md).
    • Embeddings are generated from the content of these documents using OpenAI models.
    • When the user asks a question, the most relevant fragments of the knowledge base are searched through similarity search in the FAISS index.
  4. Response Generation (LangChain and OpenAI):
    • With the intent identified and context retrieved (if applicable), an appropriate prompt is constructed.
    • This prompt, along with the conversation history, is sent to an LLM.
    • The LLM generates the response that is presented to the user.
  5. State Management (LangGraph): LangGraph handles maintaining the conversation state, including exchanged messages, current intent, retrieved context, operation mode (general or interview) and specific topics (like the interview topic).

Technologies Used and Why

We chose a specific technology stack to bring CodeSensei to life:

  • LangChain: It's the heart of the agent. It facilitates the creation of applications with LLMs, allowing components (like models, prompts, and external tools) to be chained together in a modular way. We use it for the main logic of the agent, prompt management and integration with OpenAI.
  • OpenAI API: Provides the advanced language models that power CodeSensei's text comprehension and generation, as well as creating embeddings for our knowledge base.
  • FAISS (Facebook AI Similarity Search): For RAG (Retrieval Augmented Generation) implementation. FAISS allows us to efficiently create and query vector indexes of our knowledge base, finding the most relevant information for user questions quickly.
  • LangGraph: As conversation logic becomes more complex (for example, multi-turn interview flows), LangGraph helps us define, compose and execute these flows as state graphs. This improves modularity, scalability and enables more intelligent and directed agent behavior.
  • Supabase: Cloud database

Conclusion

Is this something ChatGPT could do? Yes. However, the differential of CodeSensei lies in the specific documents that we load, vectorize and use to respond with greater precision. Beyond its functionality, the main objective of this project is not to become a mass-use tool, but to serve as an exploration laboratory to continue practicing and researching the potential of conversational agents and language models.

Share this post