Building AI Workflows with Tersa

The Problem

AI workflows are a mess. You’ve got APIs from 25+ providers, each with their own quirks, pricing, and limitations. Want to chain a text model with an image generator and then stream the output? Good luck manually wiring it all up without losing your mind. And even if you do, how do you make it visual, reusable, and not a spaghetti-code dumpster fire?

What This Does

Tersa is essentially a drag-and-drop playground for AI workflows. Think ReactFlow meets AI models. You build workflows visually by connecting "nodes" on a canvas. Each node represents a model or operation (e.g., components/nodes/image/index.tsx for image-related workflows or components/nodes/text/index.tsx for text).

The app is built on Next.js (App Router, not the old Pages API) and uses ReactFlow for the canvas. There’s a ton of reusable UI in components/ui, styled with Tailwind and shadcn/ui. Workflow state management is handled using browser local storage (lib/canvas-storage.ts), so no cloud nonsense required to get started.

Under the hood, it relies on the Vercel AI SDK Gateway to talk to AI providers, which means you get multi-model support out of the box. The app/actions/ folder is basically where the magic happens, with handlers for creating, describing, and editing images or videos.

Real-World Use

Say you want to generate an image based on text, add a caption, and then stream the result back. In Tersa, you can: Drag in a text input node (components/nodes/text/index.tsx). Add an image generation node (components/nodes/image/index.tsx) and connect it. Attach a reasoning node to see the model's thought process (components/reasoning.tsx). Hit run. Done.

The workflow persists thanks to lib/canvas-storage.ts, so you can reload the page and pick up where you left off.

Here’s an example of what it might look like programmatically:

The Bottom Line

Tersa is a solid tool if you’re building complex AI workflows and don’t want to deal with constant API management. The visual editor is slick, and the ReactFlow integration feels natural. That said, it’s definitely overkill for basic use cases (like calling GPT-4 and calling it a day). If you’re the type of dev who enjoys tinkering with AI models and needs a visual approach to chaining them, this is worth checking out. For everyone else? Stick to Postman and experiment later.