Documentation Index
Fetch the complete documentation index at: https://docs.waniwani.ai/llms.txt
Use this file to discover all available pages before exploring further.
Open source. Works without an API key. Connect the WaniWani Platform to add tracking, knowledge base, chat, and hosted state.
Flows are MCP funnels
Most apps people build with flows are funnels: a sales funnel, a lead generation flow, a booking flow, an insurance quote flow, a pricing quote flow. The two vocabularies map cleanly:| Funnel term | Flow term |
|---|---|
| Funnel step / page | Node |
| Drop-off / conversion | Edge taken vs. abandoned |
| Form field | Interrupt |
| Branching question | Conditional edge |
| Funnel state (lead data) | Flow state (typed) |
What you declare
- State. The fields the flow collects, as a map of Zod schemas. State is type-inferred.
- Nodes. Handlers that return state updates, an interrupt signal, or a widget signal.
- Edges. How nodes connect. Direct or conditional.
.compile() on the graph to get a RegisteredFlow, then register it on your MCP server.
Minimal flow
MemoryKvStore is fine for development and tests. For production, plug in a real backend (Redis, Upstash, Cloudflare KV, DynamoDB) or set WANIWANI_API_KEY to use hosted state. See KV store adapters.
Register it on your server:
Execution model
Every tool call drives the engine until it hits one of three outcomes:- Interrupt. Pause and ask the user one or more questions. The response carries
status: "interrupt". - Widget. Pause and delegate rendering to a display tool. The response carries
status: "widget". - Complete. The graph reached
END. The response carriesstatus: "complete"and server-side state is deleted.
_meta. You pick the store at .compile() time. See KV store adapters and the Platform overview for the hosted option.
Tool contract
A compiled flow registers itself as a single MCP tool. The model calls it with{ action: "start" | "continue", intent?, stateUpdates? } and receives one of four response statuses: interrupt, widget, complete, or error. You don’t usually parse responses yourself; the protocol is documented in the generated tool description so the model knows how to call it.
See Flow tool contract for the full input/output schema.
What to read next
Architecture
How a tool call drives the engine, and why the KV store is required.
State
Declare the fields the flow collects. Type inference flows from here.
Nodes
The three kinds of nodes and the context they receive.
Edges
Direct edges, conditional edges, loops, and compile-time validation.
Interrupts
Pausing, resuming, validation, and re-ask on error.
Register
Wire the compiled flow onto an MCP server end-to-end.