npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

agentflow-core

v0.8.1

Published

Monitor any AI agent system. Auto-detects failures, sends alerts, audits OS processes. Zero config, zero dependencies.

Readme

agentflow-core

v0.8.0 — Monitor any AI agent system. Auto-detects failures, sends alerts, audits OS processes. Zero config, zero dependencies.

Works with any agent framework: OpenAI, Anthropic, LangChain, CrewAI, AutoGen, or hand-rolled agents.

Installation

npm install agentflow-core

Requires Node.js >= 20.

Quick start

Step 1 — Build an execution graph

Wrap your agent's work with createGraphBuilder. Each logical unit of work is a node; the graph captures the full execution tree.

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

const builder = createGraphBuilder({ agentId: 'my-agent' });

const rootId = builder.startNode({ type: 'agent', name: 'main' });
  const toolId = builder.startNode({ type: 'tool', name: 'fetch', parentId: rootId });
  builder.endNode(toolId);
builder.endNode(rootId);

const graph = builder.build();
console.log(getStats(graph));
// { totalNodes: 2, failedNodes: 0, duration: 42, status: 'completed' }

Step 2 — Mine patterns across runs

Accumulate graphs over time and use process mining to find variants, bottlenecks, and conformance drift.

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

const model = discoverProcess(graphs);          // build a process model from observed runs
const variants = findVariants(graphs);          // group runs by their execution path
const bottlenecks = getBottlenecks(graphs);     // rank nodes by cumulative wait time
const report = checkConformance(graph, model);  // score a new run against the baseline

Step 3 — Add guards

Guards detect runaway loops, spawn explosions, and policy violations at runtime. Wrap your builder with withGuards to activate them.

import { createGraphBuilder, withGuards, createSomaPolicySource } from 'agentflow-core';

const raw = createGraphBuilder({ agentId: 'my-agent' });
const guarded = withGuards(raw, {
  maxDepth: 8,
  maxReasoningSteps: 20,
  onViolation: 'warn',        // 'warn' | 'error' | 'abort'
  policySource: myPolicySource, // optional: adaptive thresholds from Soma
});

API highlights

| Export | Kind | Description | |---|---|---| | createGraphBuilder | factory | Build and mutate an execution graph during a run | | withGuards | wrapper | Add runtime guard checks to any GraphBuilder | | checkGuards | fn | Pure guard check on a graph snapshot | | getStats | fn | Summary stats: node counts, status, duration | | getCriticalPath | fn | Longest path through the graph by duration | | getFailures | fn | All failed nodes with error metadata | | getHungNodes | fn | Nodes that are running beyond their timeout | | discoverProcess | fn | Build a process model from a run corpus | | findVariants | fn | Group runs by execution path signature | | getBottlenecks | fn | Rank nodes by cumulative elapsed time | | checkConformance | fn | Score a run against a reference process model | | createInsightEngine | factory | Tier-2 LLM analysis: anomaly, failure, and fix prompts | | createTraceStore | factory | Persist and load graphs from disk | | createEventEmitter | factory | Emit structured events during execution | | createJsonEventWriter | factory | Write events to newline-delimited JSON | | createSomaEventWriter | factory | Write events to a Soma inbox for ingestion | | createKnowledgeStore | factory | Lightweight in-process key/value knowledge store | | createPolicySource | factory | Static policy source for guard thresholds | | stitchTrace | fn | Reconstruct a distributed trace from span events | | startLive | fn | Live terminal monitor for a running agent | | startWatch | fn | Headless watcher with alerting via notify channels | | auditProcesses | fn | Audit OS processes, PIDs, and systemd units | | runTraced | fn | Run a shell command with full execution tracing | | toAsciiTree | fn | Render a graph as an ASCII tree | | toTimeline | fn | Render a graph as a text timeline |

Full type definitions are bundled. All functions are pure unless noted as factory.

Docs

https://github.com/ClemenceChee/AgentFlow#readme