Introduction
ProposeFlow generates structured objects from natural language and lets users approve, edit, or refine them before they reach your database. Build AI features your users can trust.
Quickstart
Install the SDK, register a schema, and generate your first proposal.
Schemas
Define your data structure with Zod and get type-safe generation.
Why Human-in-the-Loop?
LLMs are powerful but imperfect. They hallucinate, miss context, and make mistakes. For many use cases—content creation, data entry, configuration—you need AI assistance without sacrificing accuracy.
ProposeFlow solves this by treating AI output as a proposal rather than a final result. Users review what the AI generates, make edits if needed, and approve it into your system. If the output isn't right, they reject it with feedback and the AI tries again.
How It Works
Define your schema
Use Zod to describe the structure of objects you want to generate. ProposeFlow validates all AI output against your schema.
Generate a proposal
Call generate() with a natural language prompt. The AI returns a typed proposal containing the generated object.
User reviews in your UI
Display the proposal in your application. You control the review experience—it integrates seamlessly into your existing interface.
Approve, edit, or reject
When the user approves, you get the final object. If they reject with feedback, the AI regenerates incorporating their input. The cycle continues until they're satisfied.
Quick Example
Here's a simplified example showing the core workflow:
import { ProposeFlow } from '@proposeflow/sdk';
import { z } from 'zod';
// 1. Initialize the client with your schema
const pf = new ProposeFlow({
apiKey: 'pf_...',
schemas: {
blogPost: z.object({
title: z.string(),
summary: z.string(),
tags: z.array(z.string()),
}),
},
});
// 2. Generate a proposal from natural language
const { proposal } = await pf.generate('blogPost', {
input: 'Write a blog post about TypeScript generics',
});
// proposal.generatedObject is fully typed as { title, summary, tags }
// Display this in your UI for the user to review
// 3. When the user approves (with optional edits)
const decision = await pf.proposals.decide(proposal.id, {
action: 'approve',
edits: { title: 'A Practical Guide to TypeScript Generics' },
});
// 4. Use the approved data
console.log(decision.finalObject);
// { title: "A Practical Guide to TypeScript Generics", summary: "...", tags: [...] }Key Features
Iterative Refinement
When users reject a proposal with feedback, the AI regenerates incorporating their input. Each proposal builds on the conversation history until the user is satisfied.
Your UI, Your Experience
ProposeFlow is an API, not a widget. Display proposals however fits your application—inline forms, modals, dedicated review pages. Full control over the user experience.
Type-Safe Throughout
Define schemas with Zod and get full TypeScript inference. Generated objects, proposals, and decisions are all strongly typed.
Event-Driven Generation
Beyond explicit generation, ProposeFlow can react to domain events. When a user comments on a recipe, automatically propose updated cooking instructions.
Next Steps
Ready to get started?