https://github.com/joggrdocs/funkai
A composable AI microframework built on ai-sdk, curried with funk-tional programming flair.
https://github.com/joggrdocs/funkai
agents ai ai-sdk functional-programming microframework nodejs prompts typescript vercel-ai-sdk workflows
Last synced: 4 days ago
JSON representation
A composable AI microframework built on ai-sdk, curried with funk-tional programming flair.
- Host: GitHub
- URL: https://github.com/joggrdocs/funkai
- Owner: joggrdocs
- License: mit
- Created: 2026-03-11T22:12:48.000Z (25 days ago)
- Default Branch: main
- Last Pushed: 2026-03-27T19:59:56.000Z (9 days ago)
- Last Synced: 2026-03-28T02:47:46.823Z (9 days ago)
- Topics: agents, ai, ai-sdk, functional-programming, microframework, nodejs, prompts, typescript, vercel-ai-sdk, workflows
- Language: TypeScript
- Homepage: https://funkai.vercel.app
- Size: 1020 KB
- Stars: 2
- Watchers: 0
- Forks: 0
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Agents: AGENTS.md
Awesome Lists containing this project
README
## Features
- :zap: **Functions all the way down** — `agent`, `tool`, `flowAgent` are functions returning plain objects.
- :jigsaw: **Composition over configuration** — Combine small pieces instead of configuring large ones.
- :shield: **Result, never throw** — Every public method returns `Result`.
- :lock: **Closures are state** — Flow agent state is just variables in your handler.
- :triangular_ruler: **Type-driven design** — Zod schemas, discriminated unions, exhaustive matching.
## Install
```bash
npm install @funkai/agents @funkai/prompts
```
## Usage
### Create an agent
```ts
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" });
```
### Define a prompt
```
---
name: writer
schema:
tone: string
---
You are a {{ tone }} writer.
```
### Generate typed prompts
```bash
npx funkai prompts generate --out .prompts/client --includes "src/agents/**"
```
## Packages
| Package | Description |
| ------------------------------------- | -------------------------------------------------------------------- |
| [`@funkai/agents`](packages/agents) | Lightweight agent, tool, and flow agent orchestration |
| [`@funkai/models`](packages/models) | Model catalog, provider resolution, and cost calculations |
| [`@funkai/prompts`](packages/prompts) | Prompt SDK with LiquidJS templating, Zod validation, and CLI codegen |
| [`@funkai/cli`](packages/cli) | CLI for the funkai prompt SDK |
## License
[MIT](LICENSE)