Skip to content

Getting Started

This guide will help you set up the Cortex Agent Runtime and run your first agent.

Prerequisites

  • Python 3.9+
  • Snowflake Account: You need access to a specific database and schema.
  • SnowSQL (Optional): Useful for running setup scripts.

Installation

  1. Clone the repository:

    git clone https://github.com/BonifaceAlexander/cortex-agent-runtime.git
    cd cortex-agent-runtime
    

  2. Install the package (This installs the cortex CLI):

    pip install -e .
    

Running the Basic Agent Example

We have included a "Basic Agent" example in the examples/ directory.

1. Setup Snowflake Environment

Run the SQL setup script to create the necessary tables (AGENT_DEFINITIONS, AGENT_RUNS, etc.).

Option A: Using the CLI (Recommended)

cortex migrate

Option B: Manual Setup

cd src/cortex_runtime/migrations/sql
snowsql -f 001_initial_setup.sql -D database=YOUR_DB -s schema=YOUR_SCHEMA

2. Configure Credentials

Export your Snowflake credentials as environment variables:

export SNOWFLAKE_ACCOUNT="<your_account>"
export SNOWFLAKE_USER="<your_user>"
export SNOWFLAKE_PASSWORD="<your_password>"
export SNOWFLAKE_WAREHOUSE="<your_warehouse>"
export SNOWFLAKE_DATABASE="<your_database>"
export SNOWFLAKE_SCHEMA="<your_schema>"

3. Run the Agent

Execute the Python script:

python run.py

You should see logs indicating that the agent connected to Snowflake, registered itself, and executed the steps defined in agent.yaml.

4. Advanced Configuration (Optional)

You can tune the runtime performance using environment variables:

Variable Default Description
CR_MAX_WORKERS 10 Number of parallel threads for executing agents.
CR_FETCH_LIMIT 10 Number of jobs to fetch per polling cycle.
export CR_MAX_WORKERS=50
export CR_FETCH_LIMIT=50
cortex run

Next Steps

  • Explore the Architecture to understand how it works under the hood.
  • Check the Database Schema reference.
  • Try creating your own agent by modifying agent.yaml.