Skip to main content

Installation

AgentFlow ships as two packages: agentflow-core (the zero-dependency library you embed in your agent code) and agentflow-dashboard (the React dashboard + CLI for visualisation). This guide covers the core library.

Requirements

  • Node.js 20 or later — the library uses node:crypto for UUID generation and targets the ESM module system.
  • TypeScript 5+ recommended for full type inference (strict mode works cleanly).

Install

npm install agentflow-core

There are no transitive runtime dependencies. The package ships both ESM and CJS builds with bundled type declarations.

Import

import {
createGraphBuilder,
discoverProcess,
findVariants,
getBottlenecks,
checkConformance,
checkGuards,
withGuards,
} from 'agentflow-core';

CommonJS

const {
createGraphBuilder,
discoverProcess,
findVariants,
getBottlenecks,
} = require('agentflow-core');

Quick verify

Run this snippet to confirm the package is installed and imports correctly:

import { createGraphBuilder, getStats } from 'agentflow-core';

const builder = createGraphBuilder({ agentId: 'verify', trigger: 'install-check' });
const rootId = builder.startNode({ type: 'agent', name: 'main' });
builder.endNode(rootId);
const graph = builder.build();

console.log('Graph ID:', graph.id);
console.log('Stats:', getStats(graph));
// Stats: { totalNodes: 1, byStatus: { completed: 1, ... }, depth: 0, duration: ..., ... }

If you see the graph ID printed without errors, the package is ready.

Package contents

All public APIs are re-exported from the package root — you never need to import from deep paths.

CategoryKey exports
Graph constructioncreateGraphBuilder, withGuards
Graph queriesgetStats, getChildren, getDepth, getFailures, getHungNodes
Process miningdiscoverProcess, findVariants, getBottlenecks, checkConformance
Knowledge storecreateKnowledgeStore, createPolicySource
Event emissioncreateEventEmitter, createJsonEventWriter
Insight enginecreateInsightEngine (Tier 2 — bring your own LLM)

TypeScript configuration

The library ships full .d.ts declarations. No additional @types/* packages are needed. A minimal tsconfig.json that works with the ESM build:

{
"compilerOptions": {
"target": "ES2022",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"strict": true
}
}

Next: Your first trace — build an execution graph and inspect its structure.