Quickstart

This guide provides an example of setting up various AI Agentic components, as well as developing and deploying an AI Agent using the Canso AI Agentic System.

We'll create a simple sql-agent that can execute SQL queries based on natural language prompts.

Prerequisites

Before Proceeding, ensure you have:

  1. Canso Helm charts installed on your cluster.

To get started, install Gru by following the instructions here

Setting up the components

Our sql-agent utilizes CansoSQLRunnerTool, which relies on a Task Server to execute the SQL queries. For orchestration between the agent and the Task Server, we also need a Broker. In addition, the agent uses Checkpoint DB to save its state. Let us set up these components.

To set up the components, we first define a YAML file with the configurations for the components. Save the YAML defined below in a file named config.yaml.

broker:
    type: redis
    name: my-redis
checkpoint_db:
    type: postgres
    name: my-postgres
    size: 4Gi
task_server:
    type: celery
    name: my-task-server
    replicas: 1
    concurrency_per_replica: 1
    broker_resource_name: my-redis

Now we run the gru command to setup the components

The Broker, Checkpoint DB and Task Server are now set up in your cluster.

Creating the project bootstrap

Set up the scaffold folder for our sql-agent project by executing the command:

This will prompt us with a set of configurations for deploying our AI Agent. Provide inputs as specified below:

Once done, we get a folder sql-agent with the following structure:

Developing the sql-agent

src/main.py serves a the entrypoint for our application. In this file, we define our AI Agent and wrap it with the CansoLangraphAgent wrapper.

This creates a simple ReAct Agent with Langgraph that uses gpt-4o as the model. Feel free to replace it with any other model of your choice.

Note that the details SQL DB are read as environment variables. We provide the values for these environment variables in the .env file.

Now we build the docker image for our Agent using the generated Dockerfile and push it to the repository.

Registering and Deploying the sql-agent

We run the below commands to register and deploy the sql-agent in your cluster.

sql-agent is now deployed in your cluster and ready to receive prompts!

Prompting the sql-agent

To prompt our sql-agent, we create a file prompt.json with the prompt.

Now we execute the gru command to prompt the agent.

A table name cars should be created in your database!

Congratulations! You have successfully created and deployed an AI Agent using Canso AI Agentic System!

Last updated

Was this helpful?