Back to services

flue

The sandbox agent framework.

View alternatives to flue
Suggest edit
Open source
Self-hostable
Apache-2.0
Recent reviews

Alternatives

Tech stack

No tech stack added yet. Sign in to suggest some

Introduction

Flue describes itself as "The Open Agent Framework." It is developed by the team behind Astro, and its source code is hosted on GitHub (withastro/flue). Developers can write AI agents in TypeScript using an API similar to React Hooks (such as useModel, usePersistentState, and useAgentStart). The official tagline: write once, deploy anywhere, use any LLM.

Flue is built on Pi, an open-source agent runtime framework, which the official site says is also used by projects such as OpenClaw. The tech stack also includes Durable Streams, Vite, Hono, and a flexible Sandbox API.

Key Features

  • Agents: Agents are persistent and stateful. They retain context across conversations and events, and can be addressed over HTTP (for example, POST /agents/assistant/:id).
  • Workflows: Each agent is essentially a function. You can call it locally, in CI, or from your own backend using flue run and the SDK, or hand it off to tools such as Cloudflare Workflows and Inngest for orchestration.
  • Sandboxes: Agents run commands and edit files in a secure environment. Remote sandboxes such as Daytona, E2B, and Vercel are supported.
  • Persistent state: Each agent can write its own data and adjust its own capabilities based on state changes.
  • Subagents: You can define specialized roles and delegate tasks to the right "expert."
  • Tools & Skills: Use your own code to call APIs and query data. You can also package specialized knowledge into skills and load them when needed.
  • MCP support: Connect to a wide range of external tools through the Model Context Protocol.
  • Durable execution: Every session is recorded in a durable stream. If the service crashes, restarts, or is redeployed, interrupted sessions resume automatically, and clients that reconnect don't have to start over.
  • Observability: Session traces can be exported to OpenTelemetry, Braintrust, Sentry, or a custom observer.
  • Chat channels: Agents can be connected to platforms such as Slack, Microsoft Teams, Discord, GitHub, Telegram, and WhatsApp.
  • Other capabilities: The documentation also covers Schedules, Evals, routing, databases, and React frontend integration.

Ecosystem Integrations

  • Deployment targets: Node.js, Cloudflare, Docker, AWS, Railway, Render, Fly.io, SST, GitHub Actions, GitLab CI, and more
  • Databases: PostgreSQL, MySQL, Redis, MongoDB, Supabase
  • Channels: Slack, Discord, GitHub, Linear, Notion, Shopify, Stripe, Twilio, Resend, and more

Target Users

Flue is aimed mainly at developers and teams building AI applications in TypeScript. It suits scenarios where agents need to actually take actions, retain state over the long term, and run reliably in production, rather than just serving as simple chatbots.

Installation and Usage

Requirements: Node.js >= 22.19.0 and an API key for your chosen model provider. Flue supports all of Pi's model providers. If you use the Cloudflare runtime, you can call models through the built-in cloudflare/* AI gateway without an API key.

Automatic setup (officially recommended): Copy the prompt provided on the official site into your coding agent. It will read https://flueframework.com/start.md, guide you through the configuration, and run flue init to initialize the project.

Manual setup:

npm install @flue/runtime @flue/cli

Create flue.config.ts:

import { defineConfig } from '@flue/runtime/config';
export default defineConfig({ target: 'node' }); // 或 'cloudflare'

Write the agent in src/agents/assistant.ts:

'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 it locally. Pass --id to target the same agent so that multi-turn conversations stay continuous:

npx flue run src/agents/assistant.ts --id hello-1 --message "Hello"

Deployment: Install @flue/vite, hono, and vite, enable the flue() plugin in vite.config.ts, then create a Hono router in src/app.ts and mount your agent. After that, you can build and deploy. When deploying to Cloudflare, you also need to configure @cloudflare/vite-plugin.

Notable Features

  • Agents are written much like React components: the function's return value is the system instruction, and Hooks handle capabilities such as model selection and state management.
  • Built-in durability and failure recovery mean accepted tasks are not lost.
  • It isn't tied to a specific model or vendor, and it offers many deployment targets.
  • Flue 2.0 introduces Agent Hooks.