home / skills / andrelandgraf / fullstackrecipes / ai-agent-workflow
This skill helps build resumable multi-agent workflows with durable execution and automatic stream recovery across client reconnections.
npx playbooks add skill andrelandgraf/fullstackrecipes --skill ai-agent-workflowReview the files below or copy the command above to add this skill to your agents.
---
name: ai-agent-workflow
description: Build resumable multi-agent workflows with durable execution, tool loops, and automatic stream recovery on client reconnection.
---
# Multi-Agent Workflows
Build resumable multi-agent workflows with durable execution, tool loops, and automatic stream recovery on client reconnection.
## Prerequisites
Complete these recipes first (in order):
### Type-Safe Environment Configuration
Type-safe environment variable validation using Zod with a Drizzle-like schema API. Supports server/public fields, feature flags, either-or constraints, and client-side protection.
```bash
curl -H "Accept: text/markdown" https://fullstackrecipes.com/api/recipes/config-schema-setup
```
### Neon + Drizzle Setup
Connect a Next.js app to Neon Postgres using Drizzle ORM with optimized connection pooling for Vercel serverless functions.
```bash
curl -H "Accept: text/markdown" https://fullstackrecipes.com/api/recipes/neon-drizzle-setup
```
### Better Auth Setup
Add user authentication using Better Auth with Drizzle ORM and Neon Postgres. Base setup with email/password authentication.
```bash
curl -H "Accept: text/markdown" https://fullstackrecipes.com/api/recipes/better-auth-setup
```
### AI Chat Persistence with Neon
Persist AI chat conversations to Neon Postgres with full support for AI SDK message parts including tools, reasoning, and streaming. Uses UUID v7 for chronologically-sortable IDs.
```bash
curl -H "Accept: text/markdown" https://fullstackrecipes.com/api/recipes/ai-chat-persistence
```
### Pino Logging Setup
Configure structured logging with Pino. Outputs human-readable colorized logs in development and structured JSON in production for log aggregation services.
```bash
curl -H "Accept: text/markdown" https://fullstackrecipes.com/api/recipes/pino-logging-setup
```
## Cookbook - Complete These Recipes in Order
### Workflow Development Kit Setup
Install and configure the Workflow Development Kit for resumable, durable AI agent workflows with step-level persistence, stream resumption, and agent orchestration.
```bash
curl -H "Accept: text/markdown" https://fullstackrecipes.com/api/recipes/workflow-setup
```
### Resumable AI Response Streams
Add automatic stream recovery to AI chat with WorkflowChatTransport, start/resume API endpoints, and the useResumableChat hook.
```bash
curl -H "Accept: text/markdown" https://fullstackrecipes.com/api/recipes/resumable-ai-streams
```
### Custom Durable Agent
Build a custom durable AI agent with full control over streamText options, provider configs, and tool loops. Compatible with the Workflow Development Kit.
```bash
curl -H "Accept: text/markdown" https://fullstackrecipes.com/api/recipes/custom-durable-agent
```
### Working with Workflows
Create and run durable workflows with steps, streaming, and agent execution. Covers starting, resuming, and persisting workflow results.
```bash
curl -H "Accept: text/markdown" https://fullstackrecipes.com/api/recipes/using-workflows
```
This skill builds resumable, multi-agent AI workflows with durable execution, tool loops, and automatic stream recovery when clients reconnect. It provides step-level persistence, streaming resumption, and orchestration primitives so long-running or interactive flows survive restarts and network drops. The goal is reliable, production-ready agent orchestration for full-stack web AI apps.
The skill wires a Workflow Development Kit into your TypeScript stack to persist workflow steps and agent state to a database. It captures streaming output and saves offsets so chat or agent streams can resume automatically on reconnect. Custom durable agents and tool loops run under durable execution semantics, and APIs/hooks let the client start, pause, resume, and monitor workflows.
Do I need a specific database?
You should use a transactional database that supports connection pooling in serverless environments; Neon Postgres with Drizzle is the recommended pattern here.
How does stream recovery work on reconnect?
The system saves stream offsets and partial outputs to the workflow store. When a client reconnects, the hook or API resumes the stream from the saved offset so the user sees continuity.