Skip to main content

What it does

The Postgres SQL tool lets your agents run SQL queries directly on your PostgreSQL database. Perfect for data analysis, reporting, and retrieving specific information from your database.
Requires Postgres Integration: You need to set up a Postgres integration before agents can use this tool.

Key features

  • Execute any SQL query (SELECT, INSERT, UPDATE, DELETE)
  • Results are truncated to a 30,000-token budget, so a wide query returns as many whole rows as fit
  • Clean, structured results that agents can easily parse
  • Built-in error handling for common SQL issues

Parameters

There is no row-count parameter. If you need a specific number of rows, put LIMIT in the query itself.

Common use cases

Data analysis

User lookups

Performance monitoring

Security best practices

  • Use read-only database users when possible
  • Avoid querying sensitive data (passwords, API keys, PII)
  • Use WHERE clauses to limit data exposure
  • Monitor agent queries regularly

Troubleshooting

“Could not connect to database”
  • Check that your Postgres integration is configured and connected
  • Verify database server is running and accessible
“Permission denied for table”
  • Ensure your database user has SELECT permissions
  • Check that the table exists and is accessible
“Syntax error”
  • Validate your SQL syntax
  • Check table and column names for typos
  • Semantic Search Postgres (semantic_search_pg) - Search using natural language
  • Keyword Search Postgres (keyword_search_pg) - Full-text search across content

Tool Metadata

  • Name: postgres_sql
  • Display Name: Postgres SQL
  • Description: Execute a SQL query on Postgres
  • Required Integration: Postgres
  • Result limit: 30,000 tokens; rows past the budget are dropped and the response is flagged as truncated