Inspiration

As students who navigated the shift to online learning, we've spent countless hours in Discord study groups. We saw a recurring pattern: sessions would start with great intentions but quickly devolve into chaos. Key information would get buried in endless scrolling, discussions would drift off-topic, and at the end of a multi-hour session, there was often no clear record of what was accomplished. This inefficiency was frustrating and felt like a missed opportunity for effective learning.

I was inspired by the idea of an AI assistant, but a single chatbot felt insufficient. The real challenge required a team. I envisioned a system of specialized AI agents that could act as the perfect moderator, a tireless research assistant, a diligent note-taker, and an engaging tutor—all working together to handle the organizational overhead so students could focus purely on collaboration and learning. This led to the creation of Synapse.

What it does

Synapse is a multi-agent AI system that transforms a standard Discord channel into a structured and highly effective collaborative learning environment. It creates a complete, closed-loop learning cycle through an intelligent, automated workflow:

  • Session Management: A user initiates a study session with a specific topic using the /start-session command.
  • On-Demand Research: During the session, any participant can use the /research command to call upon an AI agent that fetches, synthesizes, and presents information from the web directly in the chat.
  • Automated Summarization & Distribution: When the session concludes with /end-session, the Summarizer agent automatically reads the entire conversation, generates a concise, bulleted summary of the key points, archives it in a dedicated #session-notes channel, and emails it to the participants for their records.
  • Interactive Reinforcement: The moment the summary is posted, it triggers the Quizmaster agent. This agent uses the summary's content to generate a relevant multiple-choice question and posts it as an interactive quiz in the original study channel, providing immediate feedback and reinforcing the material just covered.

How I built it

Synapse was built with a focus on a modular, professional architecture, even within the tight constraints of a hackathon.

  • Backend: I used Python as the core language due to its robust and mature ecosystem for AI and web technologies.
  • AI Framework: LangChain was the heart of my project. I leveraged it to build and orchestrate my AI agents. The Researcher is a ReAct (Reasoning and Acting) agent equipped with tools, while the Summarizer and Quizmaster are implemented as more direct LLM Chains for specific, predictable tasks.
  • Language Model: I used the OpenAI API for its powerful reasoning, summarization, and structured data generation capabilities, which were essential for creating reliable quizzes in JSON format.
  • Discord Integration: I used the discord.py library, taking advantage of its modern async features. A key component was the discord.ui.View system, which allowed me to create the interactive buttons for the quiz, offering a much more engaging user experience than simple text commands.
  • External Tools: The Researcher agent was empowered by the Tavily Search API, chosen for its search results that are pre-optimized for AI consumption. For email distribution, I used Python's built-in smtplib library.
  • Architecture: I strictly followed the principle of Separation of Concerns. The Discord-facing logic (bot_class.py) is completely decoupled from the AI logic (agent_manager.py), making the system clean, scalable, and easy to maintain.

Challenges I ran into

Every project has its hurdles, and mine was no exception. My biggest challenge was not in the AI logic itself, but in the integration and event-handling:

  • The Self-Lockout Permissions Bug: My most significant challenge was a classic permissions issue. When the bot first created the #session-notes channel, it set permissions to be read-only for users but, in doing so, locked itself out, preventing it from posting the summary. This forced me to do a deep dive into Discord's permission overwrite system to craft a solution where the bot granted itself explicit send_messages and embed_links permissions upon channel creation.
  • The Silent Event Handler Bug: The Quizmaster initially failed to trigger, and there were no errors. After injecting diagnostic logs, I discovered a subtle logic flaw: our on_message event handler had a guard clause at the very top to ignore the bot's own messages (to prevent infinite loops). This clause was too aggressive and also blocked the handler from seeing the one message it needed to see—the summary post. Refactoring the event flow to check for this specific trigger condition before ignoring other bot messages was a critical fix.
  • Ensuring Reliable AI Output: Getting an LLM to consistently return data in a specific format can be tricky. For my Quizmaster, I needed a perfectly structured JSON object every time. I overcame this through careful prompt engineering, explicitly defining the required JSON schema in the prompt, and building a resilient parser with try-except blocks to handle any unexpected deviations.

Accomplishments that I'm proud of

  • Building a True Multi-Agent System: I didn't just build a single-purpose chatbot. I successfully created a team of distinct AI agents where the output of one (the Summarizer) serves as the automated input for another (the Quizmaster). Seeing this event-driven workflow come to life was incredibly rewarding.
  • The Closed-Loop Learning Cycle: I am extremely proud of creating a complete, end-to-end user experience that mirrors an ideal learning process: discussion, consolidation of knowledge, and immediate reinforcement.
  • A Professional Architecture: I successfully designed and implemented a clean, modular, and class-based architecture that promotes scalability and maintainability, all within the fast-paced hackathon environment.

What I learned

This project was a tremendous learning experience. I gained a much deeper appreciation for the nuances of event-driven programming and API permissions. I learned that the true challenge in building AI systems often lies not just in the prompts, but in the robust engineering required to handle their outputs and integrate them into a seamless workflow. Most importantly, I learned how powerful frameworks like LangChain are for rapid prototyping, allowing me to build a surprisingly complex and capable system in a matter of days.

What's next for Synapse

I believe Synapse has immense potential to grow beyond a hackathon prototype. My vision for the future includes:

  • Persistence and Analytics: Moving from in-memory session management to a persistent database (like PostgreSQL) to store session history, track participation, and provide students with analytics on their study habits.
  • Expanded Toolset: Integrating more tools for the Researcher agent, such as a WolframAlpha connector for complex calculations or the ability to read and summarize uploaded PDF documents.
  • LMS Integration: The ultimate goal is to integrate Synapse with Learning Management Systems like Canvas or Moodle, allowing it to automatically create and theme study sessions based on upcoming assignments, course materials, and lecture schedules.

Built With

  • discord
  • discord.py
  • langchain
  • openai
  • python
  • smtplib
  • tavily
Share this project:

Updates