# Databases with your AI agent

> Your agent creates a PostgreSQL database for your app in one step and changes its schema with versioned migrations.

## What your agent can do

- Create a PostgreSQL database hosted by Galon, in one step.
- Receive its connection address once, to store as an environment secret.
- List and read the project's databases: status, size and limits, address masked.
- Queue versioned SQL migrations and follow them until they are applied.

## Ask your agent

Paste a request like these in your AI once it is connected. It calls the tools in this order.

| You ask | Your agent calls |
|---|---|
| “Create a Postgres database for this app and store its address as a secret.” | `list_databases` → `create_database` |
| “Add a notes table (id, body) with a migration.” | `get_database` → `apply_migrations` → `get_database_operation` |
| “Which databases does this project have?” | `list_databases` |

## Tools and routes

Every tool is a call to the REST route next to it, with the same permissions, limits and idempotency. `tools/list` shows only the tools your connection can call.

| Tool | What it does | Scope | Same through the REST API |
|---|---|---|---|
| `list_databases` | List the Galon Backend databases of this project. | `database:read` | `GET /v1/backend/databases` |
| `create_database` | Create a hosted PostgreSQL database in one step. | `database:create` | `POST /v1/backend/hosted/databases` |
| `get_database` | Read a database: status, size and limits, address masked. | `database:read` | `GET /v1/backend/databases/{database_id}` |
| `apply_migrations` | Queue versioned SQL migrations on a database. | `database:create` | `POST /v1/backend/databases/{database_id}/migrations` |
| `get_database_operation` | Read a migration or backup operation. | `database:read` | `GET /v1/backend/operations/{operation_id}` |

## Limits, free tier and pricing

Read from the platform code each time this page is served.

| Limit | Value |
|---|---|
| Hosted databases per project (default) | **3** |
| Hosted database storage, in MB (default) | **500** |
| Connections per hosted database (default) | **20** |

Billed per started hour from the prepaid balance, in US dollars, read from the platform each time this page is served. Creating a database needs 24 hours of balance.

| Plan | Database | Per hour | About per month |
|---|---|---|---|
| `micro` | hosted by Galon | 0.01302 USD | 9.5046 USD |
| `byo` | your own database | 0.002742 USD | 2.00166 USD |

Beyond what a plan includes: disk 0.11 USD per GB-month, up to 8 GB per database.

When the balance no longer covers one hour, the database becomes read-only; after 72 hours it is paused (no connection, data kept). A database hosted by Galon is deleted 30 days after the pause, never earlier, and only after notices to the administrators at the pause, 7 days and 1 day before; a top-up that covers what is due reopens it before then.

Your agent reads the current prices with `get_pricing` and the spending limits with `get_limits`.

## Good to know

- The connection address is returned once, at creation: the agent must store it as a secret and never print it.
- On a live database, migrations run only after your yes (the agent sends the confirmation).
- A database belongs to the environment of the connection: test or live.

## Next

- [Full service documentation](/cloud/docs/services/backend)
- [Connect your AI](/cloud/docs/ai-assistants)
- [All capabilities](/cloud/docs/agents)
- [API reference](/cloud/docs/api)
