🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

@workflowai/workflowai

Package Overview
Dependencies
Maintainers
2
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@workflowai/workflowai

WorkflowAI JS SDK

1.6.7
latest
npm
Version published
Weekly downloads
1.1K
39.87%
Maintainers
2
Weekly downloads
 
Created
Source

Javascript / Typescript SDK for WorkflowAI

WorkflowAI

npm version License: Apache 2.0

WorkflowAI

WorkflowAI is a low-code tool for product managers and software engineers that makes it easier to ship features powered by AI.

Get Started

  • Go to workflowai.com.
  • Enter your company URL, and get suggestions of AI-powered features for your product.
  • Build your first AI features in a few minutes.
  • Then go to the Code section to copy the code generated for Typescript.

Code Section

Example Syntax

// Initialize WorkflowAI Client
import { WorkflowAI } from '@workflowai/workflowai';

const workflowAI = new WorkflowAI({
  // optional, defaults to process.env.WORKFLOWAI_API_KEY
  // key: // Add your API key here
});

// Initialize Your AI agent
export interface GetCapitalInfoInput {
  city: string;
}

export interface GetCapitalInfoOutput {
  country: string;
  capital: string;
  fun_fact: string;
}

const getCapitalInfo = workflowAI.agent<
  GetCapitalInfoInput,
  GetCapitalInfoOutput
>({
  id: 'get-capital-info',
  schemaId: 1,
  version: '1.4',
  // Cache options:
  // - "auto" (default): if a previous run exists with the same version and input, and if
  // the temperature is 0, the cached output is returned
  // - "always": the cached output is returned when available, regardless
  // of the temperature value
  // - "never": the cache is never used
  useCache: 'auto',
});

// Run Your AI agent
async function getCapitalInfoRun() {
  const input: GetCapitalInfoInput = {
    city: 'Wellington',
  };

  try {
    const {
      output,
      data: { duration_seconds, cost_usd, version },
    } = await getCapitalInfo(input);

    console.log(output);
    console.log('\nModel: ', version?.properties?.model);
    console.log('Cost: $', cost_usd);
    console.log('Latency: ', duration_seconds?.toFixed(2), 's');
  } catch (error) {
    console.error('Failed to run :', error);
  }
}

Keywords

workflowai

FAQs

Package last updated on 04 Apr 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts