Skip to content
Blog

Flue: The Open Agent Framework for Building Durable AI Agents

Explore Flue 2.0, the open TypeScript agent framework from the creators of Astro. Learn how Agent Hooks, durability, and a React-like API make building autonomous AI agents intuitive and powerful.

Published on September 12, 2026

AI Assistant

What is Flue?

Flue is an open-source agent framework built in TypeScript by the creators of Astro. It lets you build autonomous, durable AI agents using a React-like hooks API. Write once, deploy anywhere, and use any LLM provider.

Unlike traditional agent SDKs that treat agents as static configurations, Flue 2.0 introduces Agent Hooks — a dynamic, composable approach inspired by React hooks that lets agents evolve their capabilities at runtime.

Why Flue Stands Out

Agent Hooks: React for AI Agents

The core innovation in Flue 2.0 is the hooks-based API. Instead of defining agents as static objects, you write agent functions that call hooks to compose capabilities:

export function Assistant() {
  const [count, setCount] = usePersistentState('count', 0);
  useAgentStart(() => setCount((n) => n + 1));
  useModel('moonshot/kimi-k2');
  return `You are a helpful assistant. This conversation has ${count} messages.`;
}

This unlocks powerful patterns:

  • Dynamic capability upgrades — An agent can trade up to a bigger model when work gets hard
  • Stateful workflows — Track progress through multi-step processes with persistent state
  • Conditional tools — Attach different capabilities based on runtime conditions
  • Custom hooks — Package reusable capabilities into composable, shareable units

Durability by Default

Agents built with Flue survive crashes, restarts, and redeployments. Every session is recorded in a durable stream and resumes automatically when the runtime comes back online. No lost work, no manual recovery.

Bring Your Own Stack

Flue integrates with the tools you already use:

  • LLMs: Any provider supported by Pi (Anthropic, OpenAI, Moonshot, and more)
  • Deployment: Cloudflare Workers, Node.js, Docker, AWS, Vercel, Railway
  • Channels: Slack, Discord, GitHub, Telegram, WhatsApp, Microsoft Teams
  • Databases: PostgreSQL, Redis, MongoDB, MySQL, Supabase
  • Observability: OpenTelemetry, Braintrust, Sentry

Getting Started

Installation

npm install @flue/runtime @flue/cli

Create Your First Agent

'use agent';
import { useModel } from '@flue/runtime';

export function Assistant() {
  useModel('anthropic/claude-haiku-4-5');
  return 'You are a helpful assistant. Keep replies short.';
}

Run Locally

npx flue run src/agents/assistant.ts --message "Say hello"

Deploy with Vite

Flue uses Vite for builds and Hono for routing:

// vite.config.ts
import { flue } from '@flue/vite';
import { defineConfig } from 'vite';

export default defineConfig({
  plugins: [flue()],
});

Key Features

FeatureDescription
16 Built-in HooksuseModel(), useTool(), useSkill(), useSandbox(), and more
Persistent StateusePersistentState() survives crashes and restarts
SubagentsDelegate work to specialized child agents
MCP SupportMount tools from any Model Context Protocol server
Sandbox ExecutionSecure environments for running commands and editing files
Multi-channelConnect to Slack, Discord, GitHub, and 20+ platforms

Real-World Example: Issue Triage Agent

Here’s an agent that follows a multi-step workflow to triage GitHub issues:

export function IssueTriageAgent({ id }) {
  useSandbox(local());
  const [step, setStep] = usePersistentState('step', 'reproduce');

  if (step === 'reproduce') {
    useModel('anthropic/sonnet-5-0');
    useSkill(reproChecklist);
    useTool({ name: 'submit_repro', run: () => setStep('diagnose') });
  }
  if (step === 'diagnose') {
    useModel('anthropic/fable-5-0');
    useSkill(debuggingGuide);
    useTool({ name: 'submit_diagnosis', run: () => setStep('report') });
  }
  if (step === 'report') {
    useModel('anthropic/sonnet-5-0');
    useTool(postGitHubComment);
  }

  return `Follow the workflow to triage GitHub issue ${id}.`;
}

The agent advances through steps, attaches different tools at each stage, and persists progress across sessions.

When to Use Flue

Flue is ideal when you need:

  • Durable agents that survive infrastructure failures
  • Dynamic capabilities that evolve during execution
  • TypeScript-first development with familiar patterns
  • Production-ready deployment to major cloud platforms
  • Integration with existing tools via MCP and built-in channels

Conclusion

Flue 2.0 represents a new approach to building AI agents — one that treats them as dynamic, composable functions rather than static configurations. With its React-like hooks API, built-in durability, and extensive ecosystem, it’s a compelling choice for teams building production AI agent systems.

The framework is open source and available on GitHub. To get started, check out the official documentation.