Canso - ML Platform
  • 👋Introduction
  • 🏛️Canso Architecture
  • 💻Getting Started
    • 🏁Overview
    • 🌌Provison K8s Clusters
    • 🚢Install Canso Helm Charts
    • 🐍🔗 Canso Python Client & Web App
    • 📊Health Metrics for Features in the Data Plane
  • 💡Feature Store
    • Data Sources
      • Data Spans
    • Data Sinks
    • ML Features
      • Raw ML Batch Feature
      • Derived ML Batch Feature
      • Raw ML Streaming Feature
      • Custom User Defined Function
  • 💡AI Agents
    • Introduction
    • Getting Started
    • Quickstart
    • Use Cases
      • Fraud Analyst Agent
      • Agent with Memory
      • Memory command examples
    • Concepts
      • Task Server
      • Broker
      • Checkpoint DB
      • Conversation History
      • Memory
    • How Tos
      • Update the AI Agent
      • Delete the AI Agent
    • Toolkit
      • SQL Runner
      • Kubernetes Job
      • Text-to-SQL
    • API Documentation
      • Agent
      • Memory
  • 💡Risk
    • Overview
    • Workflows and Rules
    • Real Time Transaction Monitoring
    • API Documentation
  • 💡Fraud Investigation
    • API Documentation
  • 📝Guides
    • Registry
    • Dry Runs for Batch ML Features
    • Deployment
Powered by GitBook
On this page
  • Usage
  • Tool Tips

Was this helpful?

  1. 💡AI Agents
  2. Toolkit

SQL Runner

PreviousToolkitNextKubernetes Job

Last updated 6 months ago

Was this helpful?

The SQL Runner Tool (CansoSQLRunnerTool) is a tool in Canso toolkit that enables AI agents to execute SQL queries against databases. It delegates the execution of the SQL queries to the , where the queries are executed, and results are returned to the AI Agent.

Usage

The constructor for the CansoSQLRunnerTool has following parameters:

Parameter
Description
Example

db_host

Database hostname

"db.example.com"

db_port

Database port

"5432"

db_username

Database username

"db_user"

db_password

Database password

"password123"

db_name

Target database name

"my_database"

The input parameters for the tool, provided at runtime by the workflow or the agent, include:

Parameter
Description
Example

query

Query to be executed

"select * from table"

The following code snippet illustrates how the CansoSQLRunnerTool can be integrated with your AI Agent.

from gru.tools import CansoSQLRunnerTool
from langchain_openai import ChatOpenAI
from langgraph.prebuilt import ToolNode

sql_tool = CansoSQLRunnerTool(
    db_host="db.example.com",
    db_port="5432",
    db_username="db_user",
    db_password="password123",
    db_name="my_database"
)

tools = [sql_tool]
tool_node = ToolNode(tools)

model = ChatOpenAI(model="gpt-4o", temperature=0,  max_tokens=None, timeout=None, max_retries=2,)
model = model.bind_tools(tools)

Tool Tips

  • See Kubernetes Job Tool ➡️

Go to ⬅️

Learn about ➡️

Explore ➡️

Task Server
Toolkit
Task Server
Examples