Skip to main content
TypeScript · Composable · Remixable

Unlock your agentic flow.

The TypeScript agent framework where every layer is composable, nothing is a black box, and every implementation is yours to remix.

Everything you need. Nothing you can't see inside.

01Composable primitives

Four block types — generator, sequencer, handler, router — compose into any agentic architecture, paired with a typed state and resource system that gives your flows programmatic data persistence and continuity. No hidden layers. No opinions baked into the internals. Just building blocks, all the way down.

02Proven strategies

A growing library of production-ready implementations, each built from the same blocks and state system you work with directly. Remixable, decomposable, and never opaque. Use them as-is or as a starting point for something new.

03Production-ready

DevTools, testing and evals, a typed client SDK, React hooks and components, CLI scaffolding, and provider-agnostic model flexibility. A complete stack — composable at every layer.

Why does this matter? →

Built from blocks and state — all the way down.

A research pipeline: three parallel searches, a synthesis generator that reads from session state, and a background worker that writes the result to a resource — without ever blocking the stream.

const researchBlock = sequencer({ name: "research" })
.then(parseQuery)
.parallel({
web: searchWeb,
docs: searchDocs,
past: recall, // reads ctx.user.resources.pastFindings and locates relevant items
})
.then(synthesize) // generator — reads ctx.session.state.query and parallel output
.work(handler, {
name: "save-draft",
sessionResources: { draft: draftResource },
sessionStateSchema: z.object({ lastResearched: z.string() }),
execute: async (input, ctx) => {
await ctx.session.resources.draft.setContent(input.response)
await ctx.session.state.patch({ lastResearched: input.query })
},
})
.work(updateMemory) // runs async, never blocks, can continue on after main thread completes

export default defineFlow({
kind: "research",
actions: {
research: {
inputSchema: z.object({ query: z.string() }),
block: researchBlock,
userMessage: (i) => i.query,
},
}
})
Blocks define what your flow does. State defines what it knows and remembers. Together, they're the substrate every strategy is built from.
LLM CallsGenerator

Streams tokens, runs tool loops, and injects whatever context you provide. The AI in your pipeline — composable like everything else.

Deterministic FunctionsHandler

Pure logic with typed contracts. Validate, transform, update state. The clean boundary between AI and code — explicit by design.

OrchestrationSequencer

Chains any block after any other. Sequential, parallel, looping, background workers. Compose the architecture you actually need.

Block SelectionRouter

Evaluates conditions at runtime and dispatches to the right pipeline. Intent routing, mode switching, conditional flows.

Flows

Wrap your blocks in a flow definition and get a complete API — action endpoints, SSE streaming, session management, state snapshots. No route wiring.

State & Scopes

Request, session, user, project. Four isolation levels with atomic operations. Each block declares only the fields it touches. State that accumulates and evolves as shared memory space.

Resources

Content body + structured metadata, in one atomic container — scoped like state. A draft, a plan, a code file. Cloud-native storage, ready for AI.

Patterns for every kind of agentic system.

Every pattern in the library is built from the same blocks and state system you just saw — which means every pattern is also something you can take apart, understand, and rebuild your way. This is how agentic techniques get discovered.

Multi-agent coordination patterns

Supervisor · Coordinator · Chain of Agents · Blackboard · Debate · Round Robin

Reasoning & planning patterns

Plan and Execute · Self-Ask · Self-Consistency · Skeleton of Thought · Least-to-Most · Step-Back Prompting

Memory & retrieval patterns

RAPTOR · Mind-Map Memory · Context Folding · RLM · Self-querying · Episodic Replay

Inference-time scaling patterns

RSA · Tree of Thoughts · Mixture of Agents · Best-of-N · Sequential Revision

Reactive patterns

Observer · Reflector · Self-Healing Loop · Response Auditor · Citation Verifier

Human-in-the-loop patterns

Approval Gates · Tool Call Approval · Human Feedback · Collaborative Editing · Preference Elicitation
Thought FabricAlpha

A full cognitive architecture — memory, attention, reasoning, identity, metacognition, and learning — built entirely from flow-state.dev blocks. Acts as an optional additional layer that can be added to any flow. Proof of what the primitives make possible.

Learn about Thought Fabric →

More patterns are added regularly — by us and by the community. The primitives are everything you need to build and share your own.

A complete production stack. Every layer composable.

Building production agentic systems requires more than a good architecture. It requires the tooling to run it, observe it, test it, and ship it. flow-state.dev includes all of it — and because the framework is composable at its core, none of the tooling is a black box either.

DevTools

Full visibility into every block execution, stream item, and state change across the entire flow chain. Debug what's actually happening — not what you think is happening.

Testing & Evals

A unit test harness for individual blocks and full flows, plus an eval framework for scoring outputs against datasets. Test deterministically. Evaluate non-deterministically.

CLI & Scaffolding

fsdev for scaffolding new blocks and flows, running the dev server, executing evals, and inspecting outputs — all from the terminal.

Client SDK & React

Typed client SDK and React hooks connecting your frontend to your flows — streaming, session state, and client-side data projections included.

Model Flexibility

Provider-agnostic. Swap models per block, define semantic model groups, automatic retry and fallback — without changing your flow logic.

React Component Library

Pre-built React components for streaming output, tool call display, chat UI, plan display, and more — wired directly to the client SDK and ready to drop in.

Build something nobody's built yet.

Everything you need to build a production-ready agentic system.

TypeScript · Vercel AI SDK · Works with any model provider