Installation
Install the SDK using your preferred package manager:Requirements
- Node.js: >= 22.0.0
- TypeScript: >= 5.0.0 (recommended)
Project Entry Point
Every Runflow project needs amain.ts file at the root that exports an async function main(). This is the function the Runflow engine calls when your agent receives a message:
main.ts
Project Structure
Learn how to organize your project as it grows
Built-in Libraries
The SDK includes the following libraries out-of-the-box. No need to install them separately - they’re available in all your agents:| Library | Version | Description | Import |
|---|---|---|---|
| axios | ^1.7.0 | HTTP client for API requests | import axios from 'axios' |
| zod | ^3.22.0 | Schema validation and TypeScript inference | import { z } from 'zod' |
| date-fns | ^3.0.0 | Modern date utility library | import { format, addDays } from 'date-fns' |
| lodash | ^4.17.21 | JavaScript utility library | import _ from 'lodash' |
| cheerio | ^1.0.0 | Fast, flexible HTML/XML parsing | import * as cheerio from 'cheerio' |
| pino | ^8.19.0 | Fast JSON logger | import pino from 'pino' |
Quick Examples
Environment Variables
Set up your environment variables:Configuration File
Create a.runflow/rf.json file:
.runflow/rf.json in the current directory and parent directories.
Configuration Priority:
- Explicit config in code
.runflow/rf.json- Environment variables
- Defaults
Manual API Client Configuration
Next Steps
Quick Start
Create your first agent
Core Concepts
Learn about Agents