Creating a Smart SQL Agent with Mastra Framework and Peaka Tools
peaka_schema_retriever
: Retrieves metadata and schema infopeaka_query_golden_sqls
: Queries question/SQL pairs from Peaka’s storepeaka_execute_sql_query
: Executes SQL queries on PeakaTechnology | Description |
---|---|
Peaka | A zero-ETL data integration platform with single-step context generation capability |
OpenAI | An artificial intelligence research lab focused on developing advanced AI technologies. |
Mastra | A modular framework for building AI agents with composable tools, natural language interfaces, and multi-channel deployment support. |
Vercel | A cloud platform for frontend frameworks and serverless functions, enabling fast and scalable web app deployments. |
Next.js | The React Framework for the Web. Next.js was used for building the chatbot app. |
assistant-ui | An open-source chat interface designed to connect easily with Mastra agents. |
.env
file:
peakaAgent
. It uses OpenAI’s gpt-4o-mini model, connects to the tools exposed by the Peaka MCP server, and stores memory in a local SQLite database.
Here’s how the agent is instantiated:
Import required packages in agent.ts file: