We're removing seat fees and making pricing better for fast-growing teams

Learn more

Flue with PostgreSQL

Deploy Flue Postgres on Render with this template. Build persistent AI agents with conversation history that survives restarts and deploys.

Why deploy flue postgres on Render?

Flue is a runtime-agnostic TypeScript framework for building headless, programmable AI agents. It provides a harness for creating webhook-triggered agents with features like typed outputs, session persistence, and conversation history management. This template pairs Flue with PostgreSQL to persist agent conversations across restarts and deploys.

This template pre-configures two Flue webhook agents with a Postgres-backed session store that persists conversation history across restarts and deploys—all wired together through environment variables so the database connection just works. Instead of manually setting up the session table, configuring the Node.js build target, and connecting a database, you get the full stack running with one Blueprint deploy and a single API key. Render's managed Postgres handles backups and connection pooling, while the Blueprint keeps your web service and database versioned together for reproducible deployments.

Architecture

What you can build

After deploying, you'll have two HTTP-accessible AI agents—a translation endpoint that returns structured JSON and a conversational assistant that remembers previous messages across requests. Conversation history persists in a managed Postgres database, so sessions survive service restarts and redeploys. You can immediately start calling POST /agents/translate/<id> or POST /agents/assistant/<id> to integrate these agents into your own application.

Key features

  • Postgres session persistence: Custom SessionStore implementation saves agent conversation history to a PostgreSQL table, allowing sessions to survive restarts, deploys, and scale events.
  • Webhook-triggered agents: Agents are exposed as HTTP endpoints at POST /agents// with session ID routing built into the URL path for conversation continuity.
  • Single-file Node.js bundle: The flue build --target node command produces a self-contained dist/server.mjs with an embedded Hono server ready for production deployment.
  • Valibot schema validation: The translate agent demonstrates typed structured outputs using valibot schemas to return validated response objects with defined fields like translation and confidence.
  • Blueprint infrastructure-as-code: The render.yaml provisions both the web service and PostgreSQL database together, automatically wiring the connection string via fromDatabase reference.

Use cases

  • Support engineer builds a translation bot with typed responses for tickets
  • Startup founder deploys a chatbot that remembers users across sessions
  • Developer adds multi-turn conversation memory to existing AI assistant
  • DevOps team ships stateful agents without managing session infrastructure

What's included

Service
Type
Purpose
flue-agents
Web Service
Application service
flue-db
PostgreSQL
Primary database

Prerequisites

  • Anthropic API Key: Your secret API key for authenticating with Anthropic's Claude AI models that power the Flue agents.

Next steps

  1. Test the translate agent with a curl request — Run curl -X POST https://<your-service>.onrender.com/agents/translate/demo -H "Content-Type: application/json" -d '{"text": "Hello world", "language": "French"}' and you should receive a JSON response with translation and confidence fields within a few seconds
  2. Send two messages to the assistant agent using the same session ID — Post a question to /agents/assistant/session-1, then post a follow-up to the same URL; the second response should reference context from your first message, confirming conversation history is persisted in Postgres
  3. Open the Render dashboard and check the flue-db database logs — Navigate to your PostgreSQL service, click the Logs tab, and verify you see connection activity; query the flue_sessions table to confirm your test sessions were saved

Resources

Stack

nodejs
typescript

Tags

ai-agent

For AI agents

Drop into your coding agent to explore and deploy this template.