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}
- You provide a connection string
- Flapjack introspects tables and columns
- Schema is cached for fast tool generation
- Agent receives
query_{table}andcount_{table}tools for each table
Adding an Integration
Via Dashboard
- Go to Integrations β Add Integration
- Choose Postgres or Supabase
- Enter your connection string
- Test the connection
- 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/integrationswith 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:
| Tool | Description |
|---|---|
query_customers | Query the customers table |
count_customers | Count rows in the customers table |
query_orders | Query the orders table |
count_orders | Count 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
| Kind | Connection Format |
|---|---|
postgres | postgresql://user:pass@host:5432/dbname |
supabase | postgresql://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
- Concepts: Tools β how tools work
- Concepts: Agents β agent configuration