npx skills add ...
npx skills add neondatabase/neon-for-agent-platforms --skill neon-postgres-agent-platforms
Build and operate multi-tenant AI agent platforms on Neon. Use this skill whenever the user is designing an agent/app builder, provisioning a Neon project or database per user/app/agent run, managing thousands of tenant projects, separating sponsored free users from paid customers, moving projects between orgs, choosing `@neon/sdk` vs `@neon/tools`, choosing personal vs organization vs project-scoped API keys, tracking fleet consumption or Agent Plan costs, creating compound checkpoints that combine DB snapshots with source revisions/secrets/deploy metadata, or orchestrating snapshot/restore flows for generated apps. Also use it for Neon Agent Program, Agent Plan, org/project limits, HIPAA, co-marketing, support, or neondatabase/neon-for-agent-platforms examples.
npx skills add neondatabase/neon-for-agent-platforms --skill neon-postgres-agent-platforms
Companion to **neon-postgres** (install that first). This skill covers
fleet-scale control plane for the Neon Agent Program: dual-org layout, project
transfer, per-tenant provisioning, compound checkpoints, consumption, commercial
terms, and when to give agents Management API access via @neon/tools.
For connection strings, drivers, ORMs, branching tutorials, Auth in apps, Data
API, and Neon's hosted MCP, use **neon-postgres** and
Neon docs.
Use **neon-postgres** for general Neon usage. Use this skill when the
question involves:
@neon/sdk for the control plane vs @neon/tools for agent-facing Management API accessWith **neon-postgres** and this skill loaded, you have enough context for
platform-level Neon work: dual-org layout, provisioning a project for a new
tenant, compound checkpoints, org-wide consumption polling, and
transfer/upgrade flows—without the user pasting long documentation.
Where runnable examples live: TypeScript samples run from this skill’s scripts/
directory (package.json, npm run …). The **references/** directory
keeps markdown guides beside the runnable examples;
MANAGEMENT_API_SAMPLES.md
is the script catalog and env map. The human Quick start is the root
README.
Your control plane should call
@neon/sdk. The sample scripts in
this repo do.
The Neon MCP server is a
custom agent-facing layer: MCP tool handlers written over @neon/sdk.
Use @neon/tools when you want to
give agents on your platform direct Neon management access without writing those
handlers. It publishes generated wrappers for a selected set of SDK methods as
agent tools, with adapters for MCP, Eve, and Mastra.
These public client methods are not tools: projects.create, branches.create,
operations.waitFor, postgres.roles.password, and storage.objects.get. Use
projects.createAndConnect and branches.createWithCompute for creates that
attach compute and return a connection string. Waiting is what the write tools
already do. Generated schemas are strict: a newly added API field is rejected
until you upgrade @neon/tools, or call @neon/sdk directly.
Selectors are SDK paths (projects.list). Call publishedId for the
model-facing id (projects.list → list_projects). toolIds lists every
selector. MCP 2.x uses @neon/tools/mcp; MCP 1.x uses @neon/tools/mcp-v1.
apiKey accepts a function so a short-lived token can be refreshed per
request. A remote MCP server that already authenticated the client can omit
apiKey at construction; registerNeonTools then sends authInfo.token.
MCP annotations are advisory. Hosts using @neon/tools/mcp must read
neon/requiresApproval in MCP _meta and enforce their own approval policy
before execution. The Eve and Mastra adapters map that flag to Eve's
approval hook and Mastra's requireApproval. Every non-read operation is
marked as requiring approval, as are reads that return connection credentials.
Select only the methods each agent needs. For a tenant-scoped agent, inject the
path project_id so the model cannot pick another project on tools that take
that path parameter:
inject.projectId fills URL path project_id only. It does not hide query or
body fields with that name, and it does not constrain tools that have no project
path (for example projects.list). Pair it with a project-scoped API key
when the agent must not see the rest of the org.
Full API: @neon/tools README.
Non-obvious facts agents often get wrong:
(old) branches
to avoid storage cost.GET /api/v2/consumption_history/v2/projects over legacy consumption
endpoints. The legacy account-level endpoint has been retired; use the v2
per-project endpoint
(legacy consumption guide).metrics parameter values (for implementers): compute_unit_seconds,
root_branch_bytes_month, child_branch_bytes_month,
instant_restore_bytes_month, snapshot_storage_bytes_month,
public_network_transfer_bytes, private_network_transfer_bytes,
extra_branches_month (consumption metrics).Partners run two Neon organizations:
| Org | Role |
|---|---|
| Sponsored free org | Free-tier end users (within program rules) |
| Paid org | Paying customers (metered per Agent Plan) |
Key points:
Links: Agent Plan · AI Agents · Project transfer · AI Agent integration
Link: HIPAA on Neon
Link: AI Agent integration guide
Use project- or org-level splits when tenant scope or trust needs go beyond branch- and snapshot-first staging and production in Fleet shape. Embedded products may isolate an end customer's production versus development databases across separate Neon orgs, not only branches—tighter billing, org API keys, and console boundaries while you still manage branches within each org.
Project-level isolation (multiple projects per tenant or workload):
Each extra project adds fleet surface area: more API keys, more consumption rows, more housekeeping, and higher operational cost—keep project-per-tenant as the default unless a boundary above clearly applies.
Org-level isolation (beyond sponsored free versus paid):
Embedding hygiene:
org_id with project_id / branch_id so jobs and restores target the correct
side.project_id, branch_id, org, checkpoint metadata)
aligned with the isolation layer you chose so restores, transfers, and audits
stay consistent.For snapshot semantics, active-branch patterns, and restore tutorials, defer to
**neon-postgres** and
AI database versioning.
Here, emphasize tenant fleets:
(old) branches
accumulate. Automate cleanup and update stored IDs.Typical platform-level checkpoint triggers:
Links: AI database versioning · Backup and restore · Snapshots-as-checkpoints demo
Use this when a partner needs per-tenant preview or sandbox databases for
generated apps. ("How do I create a branch?" for a single app goes to
**neon-postgres**.)
project_id / branch_id per customer / agent run when spinning
previews via the Management API.suspend_timeout_seconds on preview computes reduces cost.Link: AI Agent integration guide
GET /api/v2/consumption_history/v2/projects for billing-aligned fields.
Legacy endpoints differ. The legacy account-level endpoint has been retired;
use v2 per-project metrics instead
(legacy guide).metrics query strings are exactly: compute_unit_seconds,
root_branch_bytes_month, child_branch_bytes_month,
instant_restore_bytes_month, snapshot_storage_bytes_month,
public_network_transfer_bytes, private_network_transfer_bytes,
extra_branches_month.auth-users.ts meta from
scripts/
for a routing map (Neon Auth REST vs Postgres roles vs consumption APIs).Links: Agent Plan · Consumption metrics · Consumption limits · Cost optimization · Plans
Link: Agent Plan
Runnable Management API automation from neondatabase/neon-for-agent-platforms.
These scripts use @neon/sdk only. Shared
utils.ts
builds the client and resolves the default branch; the SDK polls async
operations (readiness) for you. For agent-facing Management API tools, see
SDK vs agent tools above. For SQL access from app code (drivers, pooling,
ORMs), use **neon-postgres**.
const tools = createNeonTools({
apiKey,
tools: ["projects.get", "branches.createWithCompute"] as const,
inject: {
projectId: tenantProjectId,
omitFromSchema: true,
},
});