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

@simple-ai-lab/sdk

v0.6.0

Published

Simple AI SDK - define action-first agents and access your organization's data.

Readme

Simple AI SDK

Typed TypeScript client for the Simple AI API. Use it inside Simple AI code actions (bundled and authenticated automatically) or in your own applications with an API key.

npm install @simple-ai-lab/sdk

Inside a code action

import { defineAction } from '@simple-ai-lab/sdk';

export default defineAction(async ({ inputs, config, client }) => {
  const { records } = await client.data.query({
    tableName: 'customers',
    filters: [{ column: 'email', values: [inputs.email] }],
  });

  return { found: records.length > 0 };
});

No API key handling needed. Simple routes SDK requests through a protected outbound binding that injects a short-lived, organization-scoped credential without exposing it to action code.

Steering the conversation

An action invoked from a workflow can send the caller somewhere else. workflow.transitionTo records the node to run next, so the agent goes there instead of following the node's own edges. It returns normally: the rest of your handler still runs, and the value you return is still mapped to the action's outputs.

import { defineAction } from '@simple-ai-lab/sdk';

export default defineAction(async ({ inputs, client, workflow }) => {
  const { records } = await client.data.query({
    tableName: 'accounts',
    filters: [{ column: 'email', values: [inputs.email] }],
  });

  if (records[0]?.status === 'delinquent') {
    workflow.transitionTo({
      nodeName: 'Collections',
      message: 'Let me get you to the right team.',
      reason: 'account is delinquent',
    });
  }

  return { status: records[0]?.status ?? 'unknown' };
});

A transition accompanies the result rather than replacing it, so the example above both writes status to its outputs and moves the conversation. Asking twice keeps the last request, and an action that throws transitions nowhere.

The same action can run where there is no conversation to steer — as a per-turn action, an automatic before/after-call action, or in data sync. Those invocations do not grant WORKFLOW_TRANSITION, and transitionTo throws MissingCapabilityError instead. If your action runs in both places, check first:

import { ActionCapability, defineAction } from '@simple-ai-lab/sdk';

export default defineAction(async ({ metadata, workflow }) => {
  if (metadata.capabilities.includes(ActionCapability.WORKFLOW_TRANSITION)) {
    workflow.transitionTo({ nodeName: 'Collections' });
  }
  return { escalated: false };
});

In your own application

import { SimpleAI } from '@simple-ai-lab/sdk';

// Reads SIMPLE_API_KEY from the environment (dashboard: Settings → API Keys)
const client = new SimpleAI();

const { records, total } = await client.data.query({
  tableName: 'orders',
  text: 'ORD-1042',
});

client.data covers custom data end to end: query, facets, list, get, create, update, delete, deleteAll, batchUpsert, and getBatch. Errors throw SimpleAIError with the HTTP status, machine-readable code, and parsed body.

Define an agent

Agents use immutable Actions for integrations, and Agent commits pin exact Action versions. New source does not create legacy tools or HTTP graph nodes.

import { action, defineAgent, node, prompt } from '@simple-ai-lab/sdk';
import { z } from 'zod';

const lookup = action.http({
  key: 'lookup-account',
  name: 'Lookup account',
  description: 'Fetch an account',
  input: z.object({
    account_id: z.string().describe('The account identifier from the caller'),
  }),
  output: z.object({ account_name: z.string() }),
  outputMappings: { account_name: '{{ httpResponse.body.name }}' },
  request: {
    method: 'GET',
    url: 'https://example.com/accounts/{{ inputs.account_id }}',
  },
});

export default defineAgent({
  key: 'support',
  name: 'Support',
  branch: 'main',
  nodes: [
    node.prompt({
      key: 'root',
      name: 'Root',
      root: true,
      prompt: prompt.inline('Help the caller.'),
      actions: [
        action.callable({
          key: 'lookup-action',
          action: lookup,
          name: 'lookup_account',
          description: 'Look up an account',
          inputs: {
            account_id: action.fromAgent('The account identifier'),
          },
          // Action output name -> Agent parameter name
          outputParameters: { account_name: 'customer_account_name' },
        }),
      ],
    }),
  ],
});

action.fromAgent(...) sets an explicit input description override for that callable. Inputs omitted from inputs inherit their Action schema descriptions at runtime; the SDK leaves those overrides absent in the compiled Agent.

Built-in Actions use Agent v2 schemas by default. To preserve a pulled Action version's stored schemas, provide input, output, and outputMappings together.

call.backgroundNoise takes the Agent v2 block, { trackName, gainMultiplier }. Leave gainMultiplier out to keep it out of the commit, and pass backgroundNoise: null for an Agent with no background noise configured at all. Left unset, the block follows voice.backgroundNoise at gain 1.

Install @simple-ai-lab/cli for simple init, pull, typecheck, diff, and publish.

Documentation

Full docs: https://docs.usesimple.ai — see the SDK Quickstart and Code Actions guides.

License

Elastic License 2.0 — free to use; the SDK may not be provided to third parties as a hosted or managed service.