In this tutorial, you’ll learn how to create an AI agent that can answer questions about data in a Postgres database using Azure AI Agent Service. Postgresql’s Agent-Driven Growth Creates a Data Control Challenge Now, let’s examine how we can set up a PostgreSQL database to further enhance our AI agent’s functionality for use in a sample travel booking application. Many LLMs are supported, such as those by Google, Anthropic, and Mistral, but we’ll default to using OpenAI in this example. We begin by walking through the steps required to create our first AI agent in LangChain. Large language models (LLMs) are able to provide text outputs from a message prompt, by predicting the next word or sentence based on those preceding.
For production, create a dedicated role plus an API or query service that validates statements, limits rows and execution time, and logs every request. Create a .env file in the root directory to store sensitive credentials. Is LangGraph better than standard LangChain for agents? The exact same architecture can run entirely offline using local LLMs through Ollama with models such as Llama 3 or Mistral. Production-ready AI systems require stateful orchestration, persistent memory, asynchronous execution, and reliable workflow routing from the beginning.
Together, these extensions let agents retrieve structured data instantly without leaving Postgres. For semantic search, we’ve improved our existing extension pgvectorscale, for higher-throughput indexing, better recall, and lower latency at scale than pgvector. The biggest takeaway here is that tool-based AI architecture gives LLMs structured access to databases without exposing unrestricted control. That separation is cleaner than granting a model write access just because a result may require follow-up.
SQL Server to Aurora PostgreSQL conversion with AI agents for AWS DMS – Amazon Web Services (AWS)
SQL Server to Aurora PostgreSQL conversion with AI agents for AWS DMS.
Posted: Tue, 01 Sep 2026 07:00:00 GMT source
Project environment setup
Connect a read-only role, inspect the detected schema, and test known business questions. Choose a fixed internal API when the allowed questions are few and high risk. It accepts a plain-English question, reads approved schema metadata, generates SQL, applies read-only controls, and returns structured results.
Support
By adding a native vector data type to PostgreSQL, it allows developers to store LLM-generated embeddings directly alongside relational data and run approximate nearest-neighbor (ANN) searches using HNSW or IVFFlat indexing — all in standard SQL. The pgvector extension has become the default choice for teams that don’t need a dedicated vector database. An LLM agent is more than a language model that answers questions.
This OpenAI tools agent uses LangChain, OpenAI, PostgreSQL and pgvector, with YugabyteDB as the underlying database. 💬 Internal Data Chatbots — embed in Slack or Microsoft Teams so product and ops teams can self-serve data questions. The questions of how it can be applied to solve Generative artificial intelligence business problems and boost productivity are still up in the air. For PostgreSQL professionals and developers building AI-powered applications, this is the moment to get ahead of the curve.
- Don’t assume SQL Server error number, severity, state, procedure, and line values have direct PostgreSQL equivalents, and don’t remove an XACT_STATE branch without preserving required business behavior.
- Dedicated API server for Retrieval-Augmented Generation using pgvector that turns your Postgres data into context for your agents instantly.
- For repeatable guidance, create an agent steering file (a project-specific instruction file that customizes the agent’s behavior).
- Scale from single-node Postgres to fully distributed architectures while maintaining security and data sovereignty.
Introducing Agentic Postgres
Ghost supports popular extensions including TimescaleDB, pgvector and PostGIS. “The idea is that all new applications are being built with coding agents,” Kulkarni said. Ask pgBot questions in plain English and get summaries, explanations, and Large language model recommendations based on real database signals. As programs capable of autonomous actions in their environment, AI agents analyze, make decisions, and execute actions that drive a myriad of applications. Join our Discord Server to ask questions or see what others are doing with Neon. “Your API usage increased by 250% on April 3rd due to increased traffic from users in the EU region.”
In-database AI: semantic operators (SQL that can generate, extract, validate, and rank)
They need to store state, retrieve context, log history, and query structured data — often all in the same transaction. Store document embeddings in Artificial neural network pgvector, use HNSW indexing for ANN search, and combine with BM25 keyword ranking (via VectorChord BM25 or pg_tokenizer) for hybrid retrieval. In the LangGraph ecosystem, for example, teams are replacing Redis checkpointers with Postgres-backed state graphs to get durable, queryable agent memory without introducing a second data store. In 2026, multiple production-ready Postgres MCP servers are available, including open-source options from pgEdge and the community Postgres MCP Pro project, with support for Claude, GPT models, and local models via Ollama.
🚨 Critical Features
It’s an architecture decision that determines whether your agents can operate autonomously at https://aicurated.com/ scale, or whether they’re one concurrent write away from a production incident. The MCP Server provides schema discovery, query execution with read-only transactions by default, EXPLAIN ANALYZE for diagnostics, and a built-in PostgreSQL knowledge base. They update records, log decisions, write intermediate state, trigger downstream workflows. The demos look great, but the architecture decisions at the database layer determine whether your agents run reliably at scale or whether you spend Monday mornings untangling a mess that autonomous processes made over the weekend. When you need AI agents to analyze the real-time state of your business, this architecture provides a unified foundation engineered for massive scale and high performance. For developers who care more about working applications than disposable demos.
LLM Agents and PostgreSQL in 2026: Building Intelligent, Data-Driven AI Systems