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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@axonflow/sdk

v1.2.0

Published

AxonFlow SDK - Add invisible AI governance to your applications in 3 lines of code

Readme

AxonFlow SDK for TypeScript

Add invisible AI governance to your applications in 3 lines of code. No UI changes. No user training. Just drop-in enterprise protection.

Installation

npm install @axonflow/sdk

Quick Start

Basic Usage

import { AxonFlow } from '@axonflow/sdk';
import OpenAI from 'openai';

// Initialize your AI client as usual
const openai = new OpenAI({ apiKey: process.env.OPENAI_API_KEY });

// Add AxonFlow governance (3 lines)
const axonflow = new AxonFlow({ apiKey: process.env.AXONFLOW_API_KEY });

// Wrap any AI call with protect()
const response = await axonflow.protect(async () => {
  return openai.chat.completions.create({
    model: 'gpt-4',
    messages: [{ role: 'user', content: 'Process this customer data...' }]
  });
});

Even Easier with Client Wrapping

import { AxonFlow, wrapOpenAIClient } from '@axonflow/sdk';
import OpenAI from 'openai';

const openai = new OpenAI({ apiKey: process.env.OPENAI_API_KEY });
const axonflow = new AxonFlow({ apiKey: process.env.AXONFLOW_API_KEY });

// Wrap the entire client - all calls are now protected
const protectedOpenAI = wrapOpenAIClient(openai, axonflow);

// Use normally - governance happens invisibly
const response = await protectedOpenAI.chat.completions.create({
  model: 'gpt-4',
  messages: [{ role: 'user', content: 'Process this customer data...' }]
});

React Example

import { AxonFlow } from '@axonflow/sdk';
import { useState } from 'react';

const axonflow = new AxonFlow({ apiKey: 'your-key' });

function ChatComponent() {
  const [response, setResponse] = useState('');

  const handleSubmit = async (prompt: string) => {
    // Your existing OpenAI call, now protected
    const result = await axonflow.protect(async () => {
      return fetch('/api/openai', {
        method: 'POST',
        body: JSON.stringify({ prompt })
      }).then(r => r.json());
    });

    setResponse(result.text);
  };

  return (
    // Your existing UI - no changes needed
    <div>...</div>
  );
}

Next.js API Route

// pages/api/chat.ts
import { AxonFlow } from '@axonflow/sdk';
import OpenAI from 'openai';

const openai = new OpenAI({ apiKey: process.env.OPENAI_API_KEY });
const axonflow = new AxonFlow({ apiKey: process.env.AXONFLOW_API_KEY });

export default async function handler(req, res) {
  const { prompt } = req.body;

  try {
    // Protect the OpenAI call
    const response = await axonflow.protect(async () => {
      return openai.chat.completions.create({
        model: 'gpt-3.5-turbo',
        messages: [{ role: 'user', content: prompt }]
      });
    });

    res.json({ success: true, response });
  } catch (error) {
    // AxonFlow will block requests that violate policies
    res.status(403).json({ error: error.message });
  }
}

Configuration Options

const axonflow = new AxonFlow({
  apiKey: 'your-api-key',           // Required (use client_id from AxonFlow)

  // Optional settings
  mode: 'production',                // or 'sandbox' for testing
  endpoint: 'https://staging-eu.getaxonflow.com', // Default public endpoint
  tenant: 'your-tenant-id',         // For multi-tenant setups (use client_id)
  debug: true,                       // Enable debug logging

  // Retry configuration
  retry: {
    enabled: true,
    maxAttempts: 3,
    delay: 1000
  },

  // Cache configuration
  cache: {
    enabled: true,
    ttl: 60000  // 1 minute
  }
});

VPC Private Endpoint (Low-Latency)

For customers running within AWS VPC, use the private endpoint for sub-10ms latency:

const axonflow = new AxonFlow({
  apiKey: 'your-client-id',
  endpoint: 'https://10.0.2.67:8443',  // VPC private endpoint (EU)
  tenant: 'your-client-id',
  mode: 'production'
});

Performance:

  • Public endpoint: ~100ms (internet routing)
  • VPC private endpoint: <10ms P99 (intra-VPC routing)

Note: VPC endpoints require AWS VPC peering setup with AxonFlow infrastructure.

Sandbox Mode (Testing)

// Use sandbox mode for testing without affecting production
const axonflow = AxonFlow.sandbox('demo-key');

// Test with aggressive policies
const response = await axonflow.protect(async () => {
  return openai.chat.completions.create({
    model: 'gpt-4',
    messages: [{
      role: 'user',
      content: 'My SSN is 123-45-6789' // Will be blocked/redacted
    }]
  });
});

What Gets Protected?

AxonFlow automatically:

  • Blocks prompts containing sensitive data (PII, credentials, etc.)
  • Redacts personal information from responses
  • Enforces rate limits and usage quotas
  • Prevents prompt injection attacks
  • Logs all requests for compliance audit trails
  • Monitors costs and usage patterns

Error Handling

try {
  const response = await axonflow.protect(() => openai.complete(prompt));
} catch (error) {
  if (error.message.includes('blocked by AxonFlow')) {
    // Request violated a policy
    console.log('Policy violation:', error.message);
  } else {
    // Other errors (network, API, etc.)
    console.error('API error:', error);
  }
}

Production Best Practices

  1. Environment Variables: Never hardcode API keys

    const axonflow = new AxonFlow({
      apiKey: process.env.AXONFLOW_API_KEY
    });
  2. Fail Open: In production, AxonFlow fails open if unreachable

    // If AxonFlow is down, the original call proceeds
    // This ensures your app stays operational
  3. Tenant Isolation: Use tenant IDs for multi-tenant apps

    const axonflow = new AxonFlow({
      apiKey: 'your-key',
      tenant: getCurrentTenantId()
    });

Support

  • Documentation: https://docs.axonflow.com
  • Email: [email protected]
  • GitHub: https://github.com/axonflow/sdk-typescript

MCP Connector Marketplace

Integrate with external data sources using AxonFlow's MCP (Model Context Protocol) connectors:

List Available Connectors

const connectors = await axonflow.listConnectors();

connectors.forEach(conn => {
  console.log(`Connector: ${conn.name} (${conn.type})`);
  console.log(`  Description: ${conn.description}`);
  console.log(`  Installed: ${conn.installed}`);
  console.log(`  Capabilities: ${conn.capabilities.join(', ')}`);
});

Install a Connector

await axonflow.installConnector({
  connector_id: 'amadeus-travel',
  name: 'amadeus-prod',
  tenant_id: 'your-tenant-id',
  options: {
    environment: 'production'
  },
  credentials: {
    api_key: process.env.AMADEUS_API_KEY,
    api_secret: process.env.AMADEUS_API_SECRET
  }
});

console.log('Connector installed successfully!');

Query a Connector

// Query the Amadeus connector for flight information
const resp = await axonflow.queryConnector(
  'amadeus-prod',
  'Find flights from Paris to Amsterdam on Dec 15',
  {
    origin: 'CDG',
    destination: 'AMS',
    date: '2025-12-15'
  }
);

if (resp.success) {
  console.log('Flight data:', resp.data);
} else {
  console.error('Query failed:', resp.error);
}

Multi-Agent Planning (MAP)

Generate and execute complex multi-step plans using AI agent orchestration:

Generate a Plan

// Generate a travel planning workflow
const plan = await axonflow.generatePlan(
  'Plan a 3-day trip to Paris with moderate budget',
  'travel'  // Domain hint (optional)
);

console.log(`Generated plan ${plan.planId} with ${plan.steps.length} steps`);
console.log(`Complexity: ${plan.complexity}, Parallel: ${plan.parallel}`);

plan.steps.forEach((step, i) => {
  console.log(`  Step ${i + 1}: ${step.name} (${step.type})`);
  console.log(`    Description: ${step.description}`);
  console.log(`    Agent: ${step.agent}`);
  if (step.dependsOn.length > 0) {
    console.log(`    Depends on: ${step.dependsOn.join(', ')}`);
  }
});

Execute a Plan

// Execute the generated plan
const execResp = await axonflow.executePlan(plan.planId);

console.log(`Plan Status: ${execResp.status}`);
console.log(`Duration: ${execResp.duration}`);

if (execResp.status === 'completed') {
  console.log(`Result:\n${execResp.result}`);

  // Access individual step results
  Object.entries(execResp.stepResults || {}).forEach(([stepId, result]) => {
    console.log(`  ${stepId}:`, result);
  });
} else if (execResp.status === 'failed') {
  console.error(`Error: ${execResp.error}`);
}

Check Plan Status

// For long-running plans, check status periodically
const status = await axonflow.getPlanStatus(plan.planId);

console.log(`Plan Status: ${status.status}`);
if (status.status === 'running') {
  console.log('Plan is still executing...');
}

Complete Example: Trip Planning with MAP

import { AxonFlow } from '@axonflow/sdk';

async function planTrip() {
  // Initialize client
  const axonflow = new AxonFlow({
    apiKey: process.env.AXONFLOW_API_KEY,
    debug: true
  });

  // 1. Generate multi-agent plan
  const plan = await axonflow.generatePlan(
    'Plan a 3-day trip to Paris for 2 people with moderate budget',
    'travel'
  );

  console.log(`✅ Generated plan with ${plan.steps.length} steps (parallel: ${plan.parallel})`);

  // 2. Execute the plan
  console.log('\n🚀 Executing plan...');
  const execResp = await axonflow.executePlan(plan.planId);

  // 3. Display results
  if (execResp.status === 'completed') {
    console.log(`\n✅ Plan completed in ${execResp.duration}`);
    console.log(`\n📋 Complete Itinerary:\n${execResp.result}`);
  } else {
    console.error(`\n❌ Plan failed: ${execResp.error}`);
  }
}

planTrip().catch(console.error);

License

MIT