Restructuring Masterclass: How We Built an AI Chatbot That Guides Learners Through Complex Legal Course Content

Overview

When a leading legal education platform wanted to make its course content more accessible and interactive, we built an AI-powered chatbot that acts as a knowledgeable course assistant embedded directly inside the platform. The system goes beyond a simple FAQ bot. It understands where a learner is within the platform, retrieves live course and speaker data on the fly, and answers in-depth questions about legal concepts using indexed course documents. The result is a seamless, context-aware experience that feels less like a search tool and more like having a knowledgeable guide sitting next to you as you learn.

About the client

Restructuring Masterclass is a specialized legal education platform focused on bankruptcy law, debt restructuring, and related financial legal concepts. The platform hosts structured courses, video content, and expert speaker sessions delivered to legal professionals looking to deepen their knowledge in a niche but high-stakes area of law. Content is managed through a Drupal CMS, with a library of courses, video lessons, speaker profiles, and supporting documents that grows as new material is published.

Goals

The client wanted learners to get immediate, accurate answers to their questions without leaving the course environment. They had a growing library of PDFs, speaker bios, and video content that was hard to navigate on its own. The goal was to build something that could understand the context of what a learner was currently watching or reading, pull in relevant information from that content, and still handle broader questions about legal theory and course material without requiring manual intervention every time a piece of content was updated.

Challenges

The biggest challenge was bridging two very different types of data. On one side, there was live, frequently updated content in Drupal, including course listings, video metadata, and speaker profiles. On the other, there were static documents like PDFs that needed to be indexed and made searchable. Getting both sources to work together intelligently, and to respond to questions in a way that felt natural and unified, required careful architecture.

Another challenge was context awareness. Learners move through the platform between course pages and individual video pages. The chatbot needed to know where the user was at any given moment and use that context to shape its answers, without the user having to explain it each time.

There was also the matter of keeping the knowledge base current. Manually re-indexing documents every time an editor updated a video or speaker profile was not sustainable. The system needed to handle that automatically in the background.

Solutions

We built the system on a FastAPI backend that orchestrates all the moving parts. For live Drupal data, we built a custom Drupal module called abi_chatbot_sync that exposes structured API endpoints for courses, videos, and speaker information. A Pydantic AI agent acts as the brain of the chatbot. It reads each user question and decides whether to fetch live data from Drupal or query the indexed document store in AWS Bedrock, without the user ever seeing how that routing works.

Documents, including uploaded PDFs and content synced from Drupal, are extracted, chunked, and stored in an AWS Bedrock Knowledge Base. When a learner asks a conceptual or theory-based question, the system retrieves the most relevant document chunks and generates a grounded answer.

To keep content fresh automatically, we hooked into Drupal’s entity lifecycle. Every time an editor saves a video node or updates a speaker profile, the module extracts the relevant metadata and pushes it to the chatbot backend, which re-indexes it in the knowledge base. Editors do not have to take any extra steps.

The chatbot widget is embedded directly into course and video pages via an iframe and picks up the page context, including the current course or video ID, automatically. This means a user asking “who is the speaker?” on a video page gets an immediate, accurate answer pulled from the live Drupal data for exactly that video.

Results

Learners now have a conversational interface they can use throughout their course experience without switching tabs or hunting through navigation menus. Questions about specific videos, speaker backgrounds, course overviews, and legal concepts are all handled in one place. Content updates made by editors in Drupal are reflected in the chatbot’s knowledge base automatically, keeping the experience accurate without any additional overhead. The platform now has a scalable foundation where adding new courses and content naturally extends what the chatbot can answer, with no manual re-indexing required.

Have a project like this?