Skip to content

skysqlinc/skysql-ai-crew

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SkySQL Semantic DB Crew

Description

SkySQL Semantic DB Crew enables natural language conversations with complex SQL databases by bridging the gap between language models and real-world schemas.
Unlike simple SQL generation tools, this crew incorporates semantic context, schema understanding, vector-based memory, and human guidance to achieve high-accuracy query generation.

Powered by SkySQL DB Agents, this crew provides a no-code approach to database context modeling. Once the agents are configured, they can be accessed through secure REST APIs and used as tools in CrewAI agent flows.

This crew is especially valuable when accuracy, schema complexity, and query reliability are essential.

Why use SkySQL DB Agents?

While it is possible to generate SQL given some schema description to a language model or use APIs in frameworks, it is rather challenging to generate accurate SQL for real-world databases with high complexity.

You need the correct context, the ability for humans to add missing semantic information (e.g., map common terms to columns), and a mechanism to store relevant context such as schema, categorical values, etc., in vector stores.

SkySQL DB Agents provide a no-code UI to autonomously learn the database context. It is also secure and reliable. Your application or CrewAI agent crews access these DB Agents as simple tools through REST APIs. Think of SkySQL Semantic DB Agents as the AI equivalent of DB stored procedures or a App 'Data Access Layer'.

Architecture Diagram

How do I create these DB Agents?

Well, there is no coding involved. You should know the specific problems you need solved and sufficient knowledge on the Data model.

Here are the steps:

  • Visit the SkySQL portal at https://app.skysql.com, sign up, and click on "SkyAI Agents".
  • You need a database to work with. You can launch a SkySQL free Serverless DB, which takes just a second. Click "Dashboard" → "Launch".
  • Alternatively, if you already have access to your database (MySQL or MariaDB only), add a data source by entering the DB credentials (these are securely managed by SkySQL).
  • Click "Agent → Create" and define the goal/objective for your DB Agent.
  • SkySQL will discover schema information, identify relationships, inspect data, and automatically select relevant tables to generate semantic context.
  • You can tweak this context (which is important for complex DBs or tables) — select or deselect columns, and stick to no more than 10 tables.
  • Use the playground to test and improve the agent iteratively.
  • Once finalized, the agent is accessible through a REST API and can be used as a tool in frameworks like LangChain or CrewAI.

Why a Crew on top of DB agents?

SkySQL provides "DB-level" agents that model semantic and structural database knowledge. However, your application may still need to:

  • Interact with multiple other sources
  • Orchestrate reasoning across various agents
  • Rewrite user queries into more precise forms
  • Synthesize multi-step answers or dashboards

A higher-level CrewAI agent can take the user query, clarify intent, manage flow, and invoke the appropriate SkySQL DB agent as a tool. This improves both accuracy and UX in end-to-end pipelines.

Example Use Cases

SkySQL DB Agents are most valuable when used within larger business workflows powered by multi-agent orchestration. Here are some powerful CrewAI-driven scenarios:

  • Customer Support Insights Agent An agent that analyzes support ticket data from a MySQL DB, identifies frequent complaint categories, and correlates them with customer churn or retention — enabling targeted improvements.

  • Revenue Intelligence Dashboard Builder A crew that receives high-level business questions like “What was revenue growth for top 3 product lines across North America last quarter?” and translates them into accurate, complex SQL against sales and customer data tables.

  • Product Feedback Analyzer An agent workflow that queries customer review databases to find common feature requests and automatically groups them by product version and customer segment.

  • Financial Risk Summarizer An agent crew that pulls transaction and account data, calculates KPIs such as debt-to-income or fraud risk scores, and provides compliance-focused summaries to analysts.

  • Chained Workflow Agent for Marketing Analytics A pipeline of agents: one rewriting the goal into sub-questions, one querying SkySQL agents for web traffic, conversions, and campaign data, and a synthesizer agent that summarizes marketing ROI — all without human-written SQL.

  • AI-Powered Data Access Layer for Applications Business apps (dashboards, CRMs, internal tools) use the crew as a backend interface to SkySQL agents — so users interact via natural language instead of SQL or filters.

Configuration Instructions

  1. Clone the repository:

    git clone https://github.com/skysqlinc/skysql-ai-crew.git
    cd skysql-ai-crew
  2. Create and activate a virtual environment (recommended):

    python3 -m venv .venv
    source .venv/bin/activate

    (On Windows, use .venv\Scripts\activate instead of source .venv/bin/activate)

  3. Install dependencies:

    pip install -r requirements.txt
  4. Copy the environment file and set your keys:

    cp .env.example .env

    Edit .env and fill in your API keys and configuration.

  5. Configure your agents and tasks:

    • Edit src/skysql_ai_crew/config/agents.yaml and tasks.yaml if you like.
  6. (Optional) Customize the crew:

    • Edit src/skysql_ai_crew/crew.py for advanced customization.
  7. Run the crew (CLI chat test app):

    PYTHONPATH=src python src/skysql_ai_crew/main.py

    This launches a command-line chat interface for testing and interacting with your crew.


Note:

  • The crew defined in this repository can also be imported and used as a component in other CrewAI-based applications, pipelines, or orchestration frameworks. The CLI app is provided for quick testing and demonstration purposes.

About

Custom SkySQL "crew" for CrewAI - a popular multi-agent AI framework

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages