Submind YouTube summaries
Thumbnail for The Open Source Approach: Building Production-Ready AI Apps with Postgres | Mike Josephson

The Open Source Approach: Building Production-Ready AI Apps with Postgres | Mike Josephson

Watch on YouTube

Video summary

Mike Josephson from PG Edge introduces the seamless integration of artificial intelligence and PostgreSQL, describing their relationship as a perfect match like peanut butter and jelly. While prototyping AI applications is straightforward, transitioning these projects into production-ready environments often presents significant challenges for many organizations. PG Edge addresses this by providing enterprise-grade capabilities built directly on top of Postgres, enabling easy deployment across various infrastructures such as virtual machines, bare metal, Kubernetes, or cloud platforms like AWS and Azure. The solution supports a scalable journey from single-node proof-of-concepts to mission-critical systems with high availability features, including active-active node configurations that allow for near-instantaneous failover and zero-downtime cluster expansion. To simplify the complex landscape of AI tooling, PG Edge offers an Agentic AI Toolkit designed for both developers and database administrators. This toolkit includes core extensions like PG Vector for semantic storage and automated vectorizers to streamline embedding workflows without requiring complex external systems. A central component is the Model Context Protocol (MCP) server, which provides a secure, centralized way for AI agents to interact with Postgres data while maintaining strict enterprise guardrails. Unlike generic approaches that might expose databases directly to large language models, the MCP server allows for granular control over permissions, such as enabling read-only access by default or restricting specific SQL commands like DELETE statements, thereby ensuring data safety and optimizing token usage through efficient data transfer formats like TSV. For database administrators, PG Edge has released the EDB AI DBA Workbench, a proactive tool that leverages deep expertise in managing large-scale Postgres estates to identify and resolve issues before they escalate. This workbench utilizes an MCP server with read-only access to analyze system health, monitor cache hit rates, and provide intelligent recommendations based on statistical baselines and embedding similarity checks. The system acts as a safety layer by preventing unauthorized data modifications while offering an AI assistant with memory and context to help troubleshoot problems efficiently. Furthermore, the solution incorporates a RAG server that handles document ingestion, anonymization, and hybrid search capabilities, allowing organizations to combine vector search with BM25 for comprehensive data retrieval in both internal and external use cases. Ultimately, PG Edge's approach emphasizes an open-source philosophy that avoids the fragmentation and high costs associated with proprietary AI stacks. By consolidating essential components like semantic caching, optimized tooling, and robust security controls into a cohesive platform, the company enables businesses to build powerful agentic applications without sacrificing data sovereignty or compliance. Whether operating in highly secure, air-gapped environments or standard cloud setups, users can leverage these tools to create flexible, cost-effective AI solutions that scale with their needs. The open-source nature of the toolkit allows developers to inspect, modify, and extend the code directly via GitHub, fostering a collaborative environment where enterprises can tailor their AI infrastructure to meet specific business requirements while maintaining full control over their data security.
Read the full video transcript
So, I'm very excited to talk to you all about it today. So, Mike Josephson, aka MJ, I lead the solution engineering and sales teams at PG Edge. And so, what I want to talk a little bit about how AI and Postgres go well together like peanut butter and jelly. But, before I jump into that, I want to talk a little bit about what PG Edge does. So, PG Edge has a lot of capabilities built right on top of we we provide a lot of capability, enterprise-grade capabilities on top of Postgres, right? So, the ability to easily deploy, the ability to easily run agentic workloads, and we're really that innovative Postgre- Postgres com- company. Looking at it from a perspective of how you can deploy PG Edge, you've got a variety of different manners. We really approach this from a perspective about making it easy for our customers and our prospects to to deploy PG Edge in a variety of different ways they they would like to, whether that's on VM and bare metal, whether that's through containers like Kubernetes as an example, or with our PG Edge Cloud, which can deploy into AWS, Azure, GCP. We make it easy, and we make it easy to evolve as you go from, say, like a single node, maybe a a POC idea to something that's more production grade, right? Or even mission critical. So, with every step of that journey of making that Postgres database as available and having the highest uptimes possible, PG Edge is really here for you, and we've built in those enterprise-grade capabilities. Some of those capabilities are are distributed capabilities. So, in that, you can have two active nodes running at the same time. If there's a failure on one, you can immediately continue writing on that second. So, it gives you a a near instantaneous failover versus that read-only promotion, which can take a little bit longer. We also have the ability to zero-downtime add nodes. So, you need to add another node to your cluster, even cross-versions, makes it easy from a maintenance and administration standpoint for for Postgres. And we have what we call as our active consistency engine, which sits across your cluster, validates that your all of your nodes are are in sync. And these are just some of the great capabilities that PG Edge has, and we have some that are releasing soon that you're going to be hearing about more. But with that said, let's jump into the really about how PG Edge makes AI seamless with Postgres. When it comes down to it, it's really easy to prototype with AI. It's a lot harder to be able to make it production-grade, right? And that's something that so many companies these days are are effectively struggling with. Even myself. I've I've built AI applications, but getting it to move through that production journey can be really hard. And what we've been done is really provide the tools for developers and DBAs to optimize their um optimize their en- engagement with Postgres, make it as simple and easy as possible. When you look at it from a perspective of what are those core enterprise requirements that you're looking for? High availability, right? With distributed, you've got some great capabilities there. Ensuring that you have the right security and compliance, right? Making sure you you're factoring in David a data sovereignty and uh residency requirements. So, all of that is very easily done with PG Edge Enterprise Postgres. A lot of our customers work in highly secure or even air-gapped environments, And so, we've built our solutions from the ground up with that in mind. Right? So, you don't necessarily have to have internet connection. So, if you're running in a highly secure data center, we can support that. Ultimately, Postgres has really become the dominant choice for AI. It's the world's most popular database, but it's also becoming the world's most popular database for AI as well. Given the hypergrowth that we've seen with with AI, how can we make Postgres as easy as possible to use the what we know and love about Postgres, but extend it so you can handle those agentic needs as well. And and PG Edge has really taken a practical perspective to that, really driven based on the feedback from our customers. We really pride ourselves in being a customer-centric company. So, we we hear something from our customers that are needed, we really try to find a way that we can make it highly applicable across as many people as possible and to deliver value immediately. And that's really a a core part and core tenant for how we approach things. From a perspective of one of the core challenges that I've seen with a lot of our customers and prospects is, you know, the there's a real sprawl in terms of AI tooling and software and all that. And wouldn't it be nice if you could centralize that as easy as possible, make it real easy to deploy agentic applications or interact with with your data in in that agentic way. And PG Edge has really done a lot to to simplify and make that um as easy as possible. And and as I mentioned, really from two different perspectives, two different lens, the the developer as well as the DBA. So, we have the PG Edge agentic AI toolkit, which really consists of a variety of different components. Right? So, it's a set of core extensions that sit right on top of Postgres, as well as some different tooling that you can use with those extensions specifically. So, as an example, we leverage PG Vector, industry standard for or key AI storage. If you need to interact with the actual data in natural language, right? Having the ability to do that through the BM25, as well as couple other components, makes it real easy. The PG Edge Vectorizers just make it so your embeddings are just automated, so you don't have to be building out these complex workflows and using all these different systems. You can really manage that all simply and easily, and then just making sure you're you're hitting your your cache, so you're you're maximizing your your token usage as well. So, we've got that semantic cache as well. And then you've got your MCP and Rag server, and just a way to to be able to get ingest your documents, and then embed them really quickly. And I'll go into that all in more depth. So, jumping into it, we'll start with the MCP server. To give a little bit of context on how we were designing it from kind of that high level. Really, schema-aware reasoning, having a a good set of of tools and prompts. Um all built in to that MCP server. And really, what it's been what how we created it is and and resources that are the three core tenants of of MCP. And how we created it was really being as focused as we could be, so that you One problem that you see with a lot of MCP servers is they have a tool sprawl, because they they throw everything in the kitchen sink in it. And what we found is that gives you worse results. Means that uh AI has a hard time reasoning on what it needs to use. It also is token inefficient because tools uh lead to descriptions and descriptions lead to tokens, which which effectively leads to higher costs. The nice thing is because of the way we've structured and designed this, doesn't actually have higher costs at all, right? And in fact, what it does is it allows you to solve problems quicker. Real key key value that you get through our our MCP server. So effectively, you can use your Quad, Cursor, wherever whatever supports you the MCP protocol. And you can then interact with your database, right? And this can be done to create applications, it can be done to just interact with the data itself. It gives you real flexibility in terms of how you need to be using your data effectively. And it all works really nicely across a wealth of different Postgres solutions. So you can use this for RDS, you could use this for Superbase, you can use this for PG Edge Cloud, you can use this for any of the versions of of of Postgres that that we support, right? So 14 14 plus. So makes it really easy and simple to use. And we've done it in a manner that's keeping your data secure, keeping it safe. Got enterprise guardrails in place, so you're not just um having your LLM interrogate your data without guardrails because that could lead to all kinds of problems, right? That that's the real challenge is if you just give direct access from Quad code or Cursor to your data. Um well, what what could happen there? There could be a lot of challenges there and and you don't have necessarily good enterprise controls. And so, that's really where that that MCP server can provide tremendous value. Optimized token usage, right? From a a perspective of two is what what as an example here, right? What we're able to do is use TSB for passing up data as opposed to say JSON or mini JSON, which again reduces your your token payloads. Just a great way that we're just thinking about how we're using AI and how we can make it so optimized that that your cost isn't increasing by using this. If anything, it's decreasing because you have optimization of the data transfer, you have optimization of your tools, you have um a small set of tools just makes it really easy to effectively use. So, um in this case, what I'm going to do is I've I've actually built my demo into my presentation here, and I've actually running this locally. So, we support both Claude as well as Ollama. In the case of Ollama, what I'm using here is Gemma 4 that 31B model. So, you can see here the reasoning that it's done in this is all running on my my computer directly here because as I mentioned, we have customers that are air-gapped, can't have their data leave. That's not a problem at all. We can support that. But hey, if you want to use Claude or you want to use, you know, OpenAI, um also uh effectively really uh easy to go ahead and do. So, when it comes down to it, from a perspective of, you know, MCP versus rag, why would you use one or the other? Now, for the MCP server, uh it's common for direct access in certain circumstances um where you want to build an application or you are in an internal network, and you um you have specific security requirements that you can move impose from an enterprise standpoint rag but doesn't open you to the wild internet, right? Because people can be creative in terms of um hacking prompts to try to exfiltrate data. And so that's where the rag server comes in place where you can really control the set of data that you make available for the LLM reasoning. And so you really those are your kind of like that internal versus external use case. If you're really interested in in playing around with these two uh that pge.com has some really great getting started information and actually the docs so docs.pge.com uses a rag server on the back end as in conjunction with MC P server to to answer questions that you may have on our capabilities. From a perspective of the rag server itself, just kind of walking through what a common workflow is there, right? You're going to load in a set of data. Some of that data may need may need to be anonymized, right? So you you have the ability to do that. We have an anonymization capability there. You want to then store that in your post crash database. You want it to be constantly embedding as new data is added in there and thus through that extension that we have, you're able to do that. And then as the agent is interacting with that rag server, it's doing that analysis of of the data and um providing, you know, here's the context that's used based on the specific search criteria that it's got. So as I said, one of that key things there is having that trigger so that when new data is added to the table, it's embedding it automatically. You don't have to have some external workflow to do that. It's able to to do that really easily. One of the key benefits too is that we're looking at hybrid search. So it's not just vector search, but it's vector search in conjunction to the BM25, which allows you to get kind of the full set of capabilities or the whole set of data that you might be looking for, right? If you have one or the other, you may miss certain responses by having both together getting the best of both worlds. And so, we've we've just kind of made it so it's nice and easy to use with the PII Agentech AI toolkit. Looking at this here, also have that rag server built in. Um I'm using in this case open AI for for the LLM. Uh you can see here how it's able to get source the information from the database, combine it together here to give me some um feedback on my query itself. So, it's doing that live. So, when you're really looking at it, fundamentally, one of that core benefits that you're getting is really around instead of having a fragmented expensive stack, you've got an open source free stack. And in effect, we've simplified all of these different pieces that might otherwise require a sprawl of different tooling. So, it just makes it nice and easy to effectively work with. One of the benefits too that you you get is that PII with with working with PII is where we have a variety of different innovative Postgres products, including our distributed capabilities, which allows you to take advantage of AI with distributed. So, you can replicate your embeddings and all that. You can embed in two different locations and it replicates across the cluster. Just interesting and creative ways you can combine these different toolings to meet your core business requirements. And it's open source, right? You go up to GitHub right now, you have full access to it. If you play around with it, you like it, uh you know, star it. We have really great tooling there, and we try to make it as easy and developer-friendly as possible. So, looking at it from a perspective of a different lens, so all of what we talked about is more on the developer side. But, from a perspective of the DBA side, how can you use AI to really make your life easier? And so, that's where EDB released the EDB AI DBA Workbench. And for this, what this is giving you is a deep understanding of your Postgres estate, allowing to proactively notify you in the case of issues based on extensive experience of the EDB team on working with large Postgres estates. This was originally invented from the pages of one of the Postgres core team members, also created pgAdmin. He knows quite a bit about large-scale estate management and some of the complexities of what goes into that. And so, what he did, he took all that knowledge and years of having worked into Postgres, and he put it into a tool that everybody can use. I I highly recommend taking a look at it because it could be applicable and useful to your estate today. It includes things like Again, with with the way we approached a lot of these things is we like to use our own tooling, um, because it not only does it give us continuous better understanding of the tooling we're creating, but they're really helpful and useful. And so, we've actually created MCP tools that the workbench is providing, so that you can get those deeper insights. And one thing, too, that's also really great about this is is that all has API API access, as well. So, while we have a a user interface that that is really tight and useful for any of our customers. You may find that you already have wonderful tooling and what you would like to do is just add in some of this data on top of that and that's all available. It's really a powerful part of our AI AI DBA workbench. It also [snorts] has different hearing of detections, so threshold and statistical baselines, embedding similarity, and then just being able to use that LLM reasoning. So, it kind of gives you a multi- faceted, multi-phased approach for identifying problems. It's always a good way to identify issues, right? That's not to just be reliant on a single one. You want to You want to really look across the different gamut of capabilities and tools that you have to to determine where there may be an issue with your system or your your estate. And so, this is a really fantastic way to to get that visibility. Thinking about it from a perspective of what is included as a part of that, it's got monitoring and dashboards. It's got the ability to provide alerts in the case that your cache hit rate is off or there is a uh some issue that has arisen. So, you have the ability to do that as well as you have an AI assistant with memory and context so that it it can be an asset for you when resolving these issues and it also provides you proactive recommendations on how to address issues or dig deeper into those issues as well. And it can do it in a reasoned and safe manner because we're using a MCP server with read-only access, it means that it's going to have minimal chance to actually do something negative to your system like some AI can do. It's really reining in the AI, so you're getting the best of it without the risks inherent to lev- leveraging AI unrestrained, right? It's really doing it, so you're getting the optimal experience with using it. PostgreSQL and AI via PG Edge. All of that is also created in a manner that some companies are not not at a point where they're want to take on AI, and that's fine. It's an optional capability for this. You still have a lot of different ways in which you can get value from the AI DBA workbench without that AI layer as a part of it. We also make it easy to deploy how you want it, and just like everything else that I've talked about, it's all open source. You can go to the Git GitHub repo right now and start playing around with that. And I highly recommend doing that. There is I'm not going to go too deeply into the comparison of the other tools out there. There are other options. Um most they're all mostly proprietary, but um you have a good a lot of capability here um with with PG Edge to to meet your your core needs. So, with that said, I'll go ahead and open it to any questions anybody might have. >> We actually have one. Let me see here. Do you use an MCP cluster for read-only operations and another one for performance use cases like investigating a slow query and query auditing? auditing? Perhaps a third MCP for permitted operations on the database. I am assuming only one agent might maybe I'm not correct. by Christian. >> Yeah, so it'd be kind of a combination of like how are we leveraging the MCP server in like a safe and secure manner. So, what we have uh in for performance analysis as well as a variety of different things. So, what what we do is we have for the MCP server by default, we set it to read-only because write has specific considerations you need to be cognizant to. Um so what what we what we do is we allow you to turn it on to a right mode if you want. I use that personally when I'm doing something like building an application with cloud code. I flip it on, right? But if I'm talking about interacting with production data, I'm not going to be using that in a in a right mode. And so those are those are important considerations. Now, when we're talking about the AIDB workbench, that's another story where where uh again, it's read-only versus write. It's read-only. Um and for a good reason, right? But it has tools that are designed specifically to provide, you know, optimal information on your state, your performance, and give you recommendations on what to do to address any potential issue that it's it's detected specifically. So, we're we're and also with our MCP server, you have the ability to add custom tools if if you want on top of that. So, we're just trying to make it easy to handle a couple different use cases. You may find that the Postgres piece, you have some unique nuance where you need to extend it. So, we're we're trying to make it sure that you can kind of handle the the average use case as well as your specific use case. And we use it kind of in a variety of different different manners and and different approaches. >> How do you prevent LLMs from deleting data? >> Yeah, so the the mission, it would be something you'd have to configure within the MCP server, right? So, you have to turn that right right mode on. So, that's really where your protection is. But that's one of the strong benefits that you get with an MCP server, right? Is you have the enterprise control of what the LLM can do within your database. You have you have the granular ability to basically say, even if you wanted write uh ability, maybe you want to do create statements. You could actually have it exclude delete statements. So, that's like your your assurance layer from your LLM interacting with with your Postgres database. You have that as a tool to validate what it's doing in in a programmatic and specific approach to ensure safety and security of your data. It's really really important um, factor when you're looking at productionization of of AI and LLMs within within a a a company and with within specific use cases. You want to just be assured with that you can be safe and secure and your knowledge is in that risk, right? And that's that's uh, core tenant of of how we've approached all of this. >> We have one more here is why use an MCP server versus a cloud code or similar data query? >> Yeah, this is this is a question I I hear all the time, right? Why why can't I just do this directly in cloud code? Well, if you're going to do cloud code, right? As an example or or cursor, whatever, the you're going to be based on the limitations that the model has put on itself, not the limitations that you're going to have as much of a granular control or yeah, you could maybe add something to your cloud project file, but the bottom line is you have a consistent enterprise tool that you can you can keep across all of your developers versus each person putting something together one-off and potentially creating it wrong, potentially having the wrong security, potentially not putting the right guardrails in place. An MCP server has all of that foundation and that enterprise capability, that enterprise security centrally located and centrally managed. And that's that's really powerful, especially at scale, right? You got one developer, is it such a big deal? Probably not, because that one developer is going to be the one using the MCP server or putting together the project files. But once you start to scale that out to a broader organization, having that in in a enterprise manner is really critically important. Absolutely. Uh so that that is something that it, you know, is absolutely important. And then there are things that we do do in terms of context management and token optimization. That's also important, right? Like so what I've mentioned in terms of like the TSV format for transfer of data, also the semantic caching, right? That's that's just like so you don't even have to go to back to the um, you know, Claude or Open AI or your your local model, you can handle it there. So we're we're also trying to reduce, you know, token usage and also context management. So it has ways in which it's able to optimize the interaction and overall memory usage, that type of thing. So it it it's like looking at all those different things. And then another thing too is it's with really like refined and focused tools, it's it's really providing like an optimized um plane for the the LLM to be able to interact with the Postgres. So what that should lead to is actually also less turns in terms of solving problems, because it has definitive specific tools that have been designed to provide it optimal access to your your data. So it's not just going out there and thinking it through its training model on uh maybe I should do this or maybe I should do that. It's saying, "Here are the the seven tools that I have available at my hand. How can I use these to meet my end objectives? And [clears throat] since that's been designed by the Postgres experts, that's that's giving you a really good and optimized way in which you can interact with your with your data in a safe and secure manner. >> Okay, thank you. We have a one last question that uh I think we can close up with this one is what MCP versus RAG? >> Yeah. So, that's that's a great question and again uh something that I was trying to touch on earlier, but but good to come back to it. Um the I think at the fundamental level internal versus external is is really good, but it's not the only delineation. Uh there's a lot of times where you might want to do similarity analysis, and RAG is is exceptionally good on that. I know that I use that personally a lot with with some AI usage that I have is being able to better understand and use your data is is so critically important, and I think that's an area that RAG really provides a lot of benefit. And I actually the our approach to it that kind of ultra simple simplification of it just makes it so easy and and intuitive to to spin up and and start using um versus like some of the other tools out there that are a little bit more more complicated. So, it's they're actually really good and and have specific use cases, but even work really great together as you can see with our AI DBA workbench. That's a great example of how you can combine the technology, but that's just like one way you can do that cuz there's multiple different ways you can kind of leverage the combination of that. So, you've got good embedded data, the AI likes that embedded data, and also like similar similarity analysis. You can kind of use it across a couple of different a couple of different use cases and combine them together to make just tremendously powerful applications and and address really important and critical use cases for for your business.