cd /news/ai-agents/save-tokens-with-neon-function-templ… · home › topics › ai-agents › article
[ARTICLE · art-164721] src=neon.com ↗ pub= topic=ai-agents verified=true sentiment=↑ positive

Save tokens with Neon Function templates

Neon launched the Neon Function Registry, a collection of ready-made Node.js function templates that developers and AI agents can add to a Neon project with a single command, the company said. The registry includes templates built with Vercel's Chat SDK, Mastra, Context.dev and WorkOS, plus templates for Postgres, the Neon AI Gateway, Neon Object Storage and Managed Better Auth, and agents can list and install them via `neon functions templates list` and `neon functions new <id> -y` without a linked project or signed-in CLI. Neon positions the templates as a token and time saver, since agents otherwise spend tokens reading docs and picking package versions before writing code; deploying requires Neon CLI 8.11.0 or later and a directory linked to a Neon project.

by read4 min views1 publishedNov 5, 2026
Save tokens with Neon Function templates
Image: source

A few weeks ago we launched Neon Functions, Node.js functions that run in your Neon project in the same region as your Postgres database, with enough runtime for agents that stream for minutes or WebSockets that stay open.

Today we're introducing the Neon Function Registry, a collection of ready-made functions you add to a project with one command.

Agents can already bootstrap a function on their own, but before they write any code they read the docs, look up best practices, figure out neon.ts and pick package versions. All of that costs tokens and time.

With the registry, your agent starts from a working template and spends its time on something more useful like building your app.

Templates worth trying #

Here is a small collection of some of my favorite templates, built with Vercel's Chat SDK, Mastra, Context.dev and WorkOS:

  • First Party### Chat SDK bot for Slack, Telegram, and the webA Vercel Chat SDK bot that answers on Slack, Telegram, and useChat, streams replies from AI Gateway, and keeps conversations, subscriptions, and locks in Neon Postgres.

Mastra agent with Postgres memoryA Mastra agent that remembers users in Neon Postgres, streams chat for useChat on AI Gateway, and runs a resumable human-in-the-loop review workflow.

Context.dev web dataSearch the web and news, read pages, answer questions, and retrieve brand data with Context.dev.

Mirror WorkOS data into PostgresBackfill, tail the Events API, and reconcile drift on a cron, with a WorkOS webhook nudge. Join users, organizations, and memberships in SQL.

The rest of the collection uses the Neon services you may already use for your project:

Why templates work so well for agents #

A template hands an agent pre-built code it would otherwise have to write itself, in a form it can install without stopping to ask you questions:

  • neon functions templates list returns every available template's ID, so the agent can pick one without browsing the website.
  • neon functions new <id> -y installs the recommended setup and the pinned dependency versions without any prompts.
  • neon functions new doesn't need a linked project or a signed-in CLI, so an agent can add a template before anyone has logged in.

Each template comes with a README that lists the services it needs and how to make an example request, so the agent knows how to call the function once it's running.

How to get going #

This section walks through adding a template, from the first command to a deployed function. You need Neon CLI 8.11.0 or later and a directory linked to a Neon project to deploy:

After that, a template usually needs a few more steps:

  1. Let the CLI install the dependencies when it asks, or pass -y to skip the question. If you decline, run thenpm install lines it prints underNext: .
  2. Add the services the README lists, for example with neon config add ai-gateway .
  3. Put the values for the template's environment variables into your local .env.local or.env file.
  4. If you added services, deploy once with neon deploy --env .env.local so Neon provisions them and writes their credentials to your local env file.

You can then run the function locally with neon dev, make changes and deploy it again.

Keep --env .env.local on the deploy command for any template with its own variables, because the deploy fails when those variables are undefined. The function templates docs cover each step in more detail.

Once installed, the files are yours to edit. The CLI won't overwrite them with a newer version of the template. Also keep in mind that most templates don't check who is calling them, so add authentication before you share the URL of anything that calls a paid service.

Next steps #

Pick whichever of these fits where you are:

── more in #ai-agents 4 stories · sorted by recency
── more on @neon 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/save-tokens-with-neo…] indexed:0 read:4min 2026-11-05 · —