Build a semantic layer for agentic AI with EDB Postgres AI and Amazon Bedrock AgentCore
** This post demonstrates building a semantic layer for agentic AI by using EDB Postgres AI’s AIDB extension to create a Semantic Knowledge Base (SemKB) over a Postgres schema and exposing it through an Amazon Bedrock AgentCore MCP endpoint. Business meanings are stored in Postgres COMMENT statements, join paths are derived from foreign keys, and access is enforced via Postgres GRANT, column‑level grants, and row‑level security. The runtime uses Anthropic Claude on Amazon Bedrock as the planning model, while AgentCore handles inbound authorization and outbound credentials.
⚡ Key Takeaways
- **Semantic authoring:** `COMMENT ON` statements and the `aidb.create_semantic_alias` function are used to define business meanings directly in the database.
- **Join graph generation:** Foreign‑key relationships are automatically crawled to build join paths for the agent’s query planner.
- **Access control:** Postgres GRANT, column‑level grants, and row‑level security are enforced via the Model Context Protocol (MCP) endpoint, yielding different query results per role.
- **Observability:** OpenTelemetry traces for each SQL execution are stored as rows in the `aidb_otel` schema and can be queried with standard SQL.
- **Integration point:** The AIDB MCP endpoint is fronted by an Application Load Balancer and registered as an MCP target on the AgentCore Gateway, enabling external agents to invoke the semantic layer.
** Engineers can embed a fully governed, observable semantic layer inside their operational Postgres database, allowing agentic AI (e.g., Claude on Bedrock) to generate accurate, role‑aware queries without external knowledge graphs, simplifying deployment and reducing latency. **TechnicalLevel:** Advanced **TargetAudience:** ML Engineers, AI Platform Engineers **PracticalSteps:** - Use…
✅ Practical Steps
- Use `aidb.create_semantic_alias` together with `COMMENT ON` statements to author the semantic layer over your Postgres schema.
- Deploy the AIDB MCP endpoint behind an Application Load Balancer and register it as an MCP target on the AgentCore Gateway to expose the tool catalog to external agents.
- Configure Postgres roles, column‑level GRANT statements, and row‑level security policies to control which data each agent caller can access.
Want the full story? Read the original article.
Read on AWS ML Blog ↗