Skip to content

How do I configure the SQL agent node?#

An agent is used to extend the functionality of a Large Language Model or Chat Model with the use of additional nodes such as triggers, retrievers, loaders and output parsers. Agent nodes are distinct from Chain nodes in that they automatically determine the correct attached node to use for a given user input.

The SQL agent uses end-user input to query one of the following databases:

  • MySQL
  • Postgres
  • SQLite

Before you begin#

Step 1 - add the node#

  • Click + to open the nodes panel
  • Search for Agent in the node search field.
  • Click Ai Agent to open the node editor
  • Choose SQL agent from the Agent field.

Step 2 - choose the database type#

Choose a database type and a corresponding credential

  • MySQL
  • Postgres
  • SQLite (requires a database file for binary input)

Step 3 - choose how to handle prompts#

Prompt Description Additional information
Take from previous node automatically Looks for chatInput parameter supplied by the preceding node Execute previous nodes to load input data
Define below Define JSON parameters that will be sent to a child node such as a Model, Operator, Memory or Tool. These should be defined based on the outputs from a preceding node in the pathway Execute previous nodes to load input data

Step 4 - choose optional messages#

Click Add option then select any of the following:

Option Description Additional information
Prefix message String to insert before the list of tools
Suffix message for chat model Instruction for connected chat model Includes the user input and agent scratchpad

Step 5 - choose database options#

Click Add option then select any of the following:

Option Description Additional information
Ignored Tables A comma-separated list of tables in the chosen database to ignore No tables ignored when left blank or not added, which can increase the number of LLM Tokens used to retrieve results
Included Tables Specify a comma separated list of tables to include in any queries on the database All tables returned if left blank or not added.
Include sample rows Number of table rows the SQL agent can use to conceptualise the database schema Can increase the number of LLM Tokens used to retrieve results
Limit The number of database results the agent should keep

Next step#

Link the Agent to child nodes: