Documentation
Guides

Guide: Postgres Integration

Connect a Postgres or Supabase database to Flapjack so agents can query your data during conversations.

Connect a Postgres or Supabase database and your Flapjack agent gets auto-generated query tools for every table.

How It Works

Connect database β†’ Flapjack introspects schema β†’ Agent gets query tools
                                                  query_{table}, count_{table}
  1. You provide a connection string
  2. Flapjack introspects tables and columns
  3. Schema is cached for fast tool generation
  4. Agent receives query_{table} and count_{table} tools for each table

Adding an Integration

Via Dashboard

  1. Go to Integrations β†’ Add Integration
  2. Choose Postgres or Supabase
  3. Enter your connection string
  4. Test the connection
  5. Attach to one or more agents

Via API

curl -X POST https://api.flapjack.dev/api/integrations \
  -H "Authorization: Bearer fj_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Production DB",
    "kind": "postgres",
    "connectionString": "postgresql://user:pass@host:5432/dbname"
  }'
πŸ“‹ Copy as prompt

Add a Postgres integration to my Flapjack organization. POST to /api/integrations with a name, kind "postgres", and connection string.

Attaching to an Agent

curl -X POST https://api.flapjack.dev/api/agents/{agentId}/integrations \
  -H "Authorization: Bearer fj_live_..." \
  -H "Content-Type: application/json" \
  -d '{"integrationId": "int-001"}'

Auto-Generated Tools

For a database with a customers table and an orders table, the agent gets:

ToolDescription
query_customersQuery the customers table
count_customersCount rows in the customers table
query_ordersQuery the orders table
count_ordersCount rows in the orders table

The agent can use these tools to answer questions like "How many orders did customer X place last month?"

Supported Databases

KindConnection Format
postgrespostgresql://user:pass@host:5432/dbname
supabasepostgresql://user:pass@db.project.supabase.co:5432/postgres

Security

  • Connection strings are encrypted at rest
  • Queries are read-only by default
  • The agent sees table schemas but not raw connection credentials
  • Use a read-only database user for maximum safety

Next Steps

Docs last updated May 11, 2026