- ⚡ Functions all the way down —
agent, tool, flowAgent are functions returning plain objects.
- 🧩 Composition over configuration — Combine small pieces instead of configuring large ones.
- 🛡️ Result, never throw — Every public method returns
Result<T>.
- 🔒 Closures are state — Flow agent state is just variables in your handler.
- 📐 Type-driven design — Zod schemas, discriminated unions, exhaustive matching.
npm install @funkai/agents @funkai/prompts
import { agent } from "@funkai/agents";
import { openai } from "@ai-sdk/openai";
const writer = agent({
name: "writer",
model: openai("gpt-4.1"),
system: "You are a helpful writer.",
tools: { search },
});
const result = await writer.generate({ prompt: "Write about closures" });
---
name: writer
schema:
tone: string
---
You are a {{ tone }} writer.
npx funkai prompts generate --out .prompts/client --includes "src/agents/**"
| Package |
Description |
@funkai/agents |
Lightweight agent, tool, and flow agent orchestration |
@funkai/models |
Model catalog, provider resolution, and cost calculations |
@funkai/prompts |
Prompt SDK with LiquidJS templating, Zod validation, and CLI codegen |
@funkai/cli |
CLI for the funkai prompt SDK |
MIT