Welcome to the CorsaiFlow Crew project, powered by crewAI. This project demonstrates a multi-agent AI system that integrates with Snowflake's Model Context Protocol (MCP) to intelligently route and execute data queries across multiple data repositories.
- Snowflake MCP Integration: Connect to Snowflake's managed MCP server to access Cortex Search, Cortex Analyst, SQL execution, and Cortex Agents
- Intelligent Query Routing: Automatically determine which data repository is best suited for a user's query
- Multi-Agent Workflow: Two specialized agents work together to route queries and retrieve data
- Flow-Based Architecture: Built on CrewAI's flow system for orchestrated task execution
Ensure you have Python >=3.10 <3.14 installed on your system. This project uses UV for dependency management and package handling, offering a seamless setup and execution experience.
First, if you haven't already, install uv:
pip install uvNext, navigate to your project directory and install the dependencies:
(Optional) Lock the dependencies and install them by using the CLI command:
crewai installAdd your API keys and Snowflake configuration to the .env file:
OPENAI_API_KEY=your_openai_api_key
# Snowflake MCP Configuration
SNOWFLAKE_MCP_SERVER_URL=https://your-account.snowflakecomputing.com
SNOWFLAKE_DATABASE=your_database
SNOWFLAKE_SCHEMA=your_schema
SNOWFLAKE_MCP_SERVER_NAME=your_mcp_server
SNOWFLAKE_ACCESS_TOKEN=your_oauth_access_tokenSee SNOWFLAKE_MCP_SETUP.md for detailed setup instructions.
- Modify
src/corsaiflow/crews/data_routing_crew/config/agents.yamlto customize agent behavior - Modify
src/corsaiflow/crews/data_routing_crew/config/tasks.yamlto customize task definitions - Update
src/corsaiflow/crews/data_routing_crew/data_routing_crew.pyto configure data repositories - Modify
src/corsaiflow/main.pyto add custom flows and inputs
To kickstart your flow and begin execution, run this from the root folder of your project:
crewai runThis command initializes the corsaiFlow Flow as defined in your configuration.
To run the Snowflake data query flow:
# Using Python directly
python -m corsaiflow.main query_snowflake_data
# Or with a trigger payload
python -m corsaiflow.main query_snowflake_with_trigger '{"user_query": "What products are in stock?"}'The default example will route a query about product inventory and retrieve data from the appropriate Snowflake repository.
The Data Routing Crew consists of two specialized agents:
-
Query Router Agent: Analyzes user queries and determines which Snowflake data repository (Cortex Search, Cortex Analyst, SQL database, or Cortex Agent) is most appropriate for answering the question.
-
Data Retriever Agent: Executes queries against the selected Snowflake repository using MCP tools, formats the results, and presents them to the user.
- Agents: Defined in
src/corsaiflow/crews/data_routing_crew/config/agents.yaml - Tasks: Defined in
src/corsaiflow/crews/data_routing_crew/config/tasks.yaml - Tools:
SnowflakeMCPTool: Wraps Snowflake MCP server interactionsDataRepositoryTool: Helps select appropriate data repositories
The DataQueryFlow orchestrates the query process:
- Receives user query
- Routes query to appropriate repository
- Retrieves data from Snowflake
- Formats and returns results
For support, questions, or feedback regarding the {{crew_name}} Crew or crewAI.
- Visit our documentation
- Reach out to us through our GitHub repository
- Join our Discord
- Chat with our docs
Let's create wonders together with the power and simplicity of crewAI.