type
status
date
slug
summary
tags
category
icon
password
I’ve always been fascinated by how we can make technology work better for us, and improving our assistant bot’s structure feels like a step toward that goal.
Why We Needed a Better System
When we first built our bot, it was pretty straightforward: a research agent would pull information from a vector store, and the assistant would craft a final response. It worked, but it had flaws. What if someone posed as the user and asked for sensitive information, like login credentials or financial details? And how could we ensure the retrieved data was relevant enough to provide accurate, professional answers every time? These questions pushed us to rethink the bot’s internal structure and make it smarter, safer, and more user-friendly.
A Quick Look at the Bot in Action
To give you a clearer picture of how this all comes together, we’ve put together a short demo video showcasing the current version of the bot. It walks through the agent workflow in real time, and for review purposes, we’re printing out each stage of the process to highlight how the Safety, Query, Ranking, and PR Agents collaborate. Check it out to see the bot in action.
Introducing the New Agent Workflow
To tackle these challenges, we revamped the bot’s architecture by introducing three new agents: the Safety Agent, the Ranking Agent, and the PR Agent. Each one plays a specific role to ensure the bot is secure and delivers high-quality responses.

Step 1: The Safety Agent
The process starts with the Safety Agent, which acts like a gatekeeper. It reviews every incoming question to determine if it’s safe to answer. If someone asks for sensitive information—like passwords or personal financial data—the Safety Agent flags it and hands it off to the PR Agent, which responds politely, explaining that the bot can’t provide that information. This step is critical because, as it stands, the bot can’t verify who’s typing. Whether it’s the actual user or someone else, we need to protect private data.
Step 2: The Query and Ranking Agents
If the question passes the safety check, it moves to the Query Agent. This agent crafts a precise query based on the user’s question and searches the vector store for relevant information. But here’s where we added another layer of quality control: the Ranking Agent. This agent evaluates the retrieved data to ensure it’s actually useful. If the information isn’t relevant enough, the Ranking Agent sends it back to the Query Agent for another try. This back-and-forth continues until we either find high-quality data or exhaust our attempts. This process ensures we’re not just throwing out random answers but aiming for accuracy.
Step 3: The PR Agent
Finally, the PR Agent steps in to polish the response. Whether we’ve found great information or come up empty-handed, this agent ensures the answer is clear, professional, and easy to understand. It’s like having a skilled communicator who makes sure the bot’s hard work shines through in a way that feels approachable to the user.
The Power of an Agentic Framework
What I love about this setup is how it breaks down a complex task into smaller, manageable pieces. Instead of relying on a single language model to do everything, we’re using multiple agents, each handling a specific part of the process. It’s like assembling a team where everyone has their own expertise. The Safety Agent focuses on security, the Query Agent on research, the Ranking Agent on quality, and the PR Agent on communication. By guiding these agents with clear criteria, we let the language model focus on what it does best at each stage, while the overall workflow allows for flexibility—like looping back if the data isn’t good enough.
This agentic framework feels like a smarter way to work with AI. It’s not about handing over one massive task and hoping for the best; it’s about breaking things down, emphasizing quality at every step, and letting human-designed criteria guide the process.
What’s Next: Refining and Expanding
While we’ve made big strides with this new structure, there’s still room to grow. We haven’t fully explored advanced techniques like parent document retrievers, where information is stored as a main document with detailed sub-pieces, or re-ranking retrieved documents for better accuracy. These could add value, but without a solid agent framework in place, they’d be like putting fancy tires on a car with no engine.
Beyond the technical side, we’re also thinking about the user experience. The Safety Agent was a direct response to privacy concerns, ensuring we don’t accidentally leak sensitive data. Moving forward, we’re planning to add advanced caching for frequently asked questions. This will save on processing costs (and, yes, a bit of money too) while making the bot faster. We’re also working on a better interface to make interactions smoother and more intuitive.
Want to Explore the Code?
If you’re curious about how I built this assistant or want to try creating your own, I’ve shared all the code and details in my GitHub repository. Feel free to check it out, tinker with it, or even adapt it to fit your own notes and ideas—it’s a fun way to make AI work for you!