Building an AI Agent in n8n for Structured Data Queries in Airtable

I’m developing an AI agent in n8n that can answer questions about structured data stored in Airtable. My database consists of several interconnected tables (similar to an SQL database structure). I’ve found that traditional RAG approaches with text embeddings aren’t ideal for this use case since I’m working with structured data and need to handle both descriptive queries and calculations.

Approaches I’m Considering:

  1. Airtable Formula Generation: Have the AI agent generate Airtable formulas based on the base schema. However, I’m concerned about limitations in Airtable’s formula capabilities and whether LLMs have sufficient training on this syntax.
  2. SQL Translation Layer: Extract data from Airtable into an SQL database and have the agent generate SQL queries. This would be powerful and efficient for complex queries, but maintaining synchronization between Airtable and SQL could be costly and complex.
  3. OpenAI Assistant: Implement with OpenAI Assistant with dual tools:
  • A “File Search” capability for handling text-based queries (for descriptive content and feedback)
  • A “Code Interpreter” capability for processing structured data, calculations, grouping, and aggregation

I believe the third approach would be most effective—potentially using both capabilities together where the agent could query CSV exports for calculations while using embeddings for text-based information.

My Question:

Has anyone implemented a similar system in n8n? I’m particularly interested in how to build this dual-capability agent that can effectively handle structured data queries while maintaining connection with Airtable. Any examples, approaches, or suggested workflows would be greatly appreciated.

Thank you in advance for your insights!