Skip to content

Repository files navigation

@falai/agent

Typed conversations where code stays in charge.

Define flows, steps, and tools in TypeScript; the framework calls the LLM only for the parts that need language — routing, extraction, and generation.

npmLicenseTypeScript

The AI understands. The code is in control.

import{createAgent,GeminiProvider}from"@falai/agent";constagent=createAgent({provider: newGeminiProvider({apiKey: process.env.GEMINI_API_KEY!}),schema: {type: "object",properties: {name: {type: "string"}}},flows: [{title: "Greet",requiredFields: ["name"],steps: [{id: "ask_name",prompt: "What's your name?",collect: ["name"]}],}],});constresponse=awaitagent.respond("Hi, I'm Alice");console.log(response.message);

Primitives

Agent

Bind schema to provider.

The top-level object. Owns the schema, the provider, the flows, the tools, and the session. One agent serves many conversations.

Flow

Collect until done.

A goal made of ordered steps. Declares which schema fields it needs; the engine completes the flow when every required field has been collected.

Tool

Run code, redirect flow.

A typed function the AI can call. Receives a ToolContext with session data, can dispatch directives to redirect the conversation, and returns a typed result.

Where to go next

Install

bun add @falai/agent
# or
npm install @falai/agent
# or
pnpm add @falai/agent

Requires Node 18+ or Bun 1.0+. Set a provider API key in your environment (for example GEMINI_API_KEY, OPENAI_API_KEY, ANTHROPIC_API_KEY, OPENROUTER_API_KEY, or DEEPSEEK_API_KEY).

License

MIT © 2025

About

Build intelligent, conversational AI agents with TypeScript

Resources

Stars

6 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages