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

@bpmnkit/casen-worker-ai

v0.1.0

Published

AI task worker plugin for casen — classify, summarize, extract, and decide using Claude

Downloads

57

Readme

npm license typescript

Website · Documentation · GitHub · Changelog


Overview

casen-worker-ai is an official casen CLI plugin that brings AI-powered task processing into Camunda 8 workflows. It subscribes to four job types and uses the Anthropic Claude API to complete each job with structured output.

This is the right tool when you need AI logic in a process but don't want to build a full microservice — start the worker once and any process in your cluster can delegate AI tasks to it.

Why a worker instead of the HTTP connector?

The built-in Camunda HTTP connector can call any API but cannot:

  • Validate or parse the response and fail the job if the output is malformed
  • Route Anthropic rate-limit errors (429) to Camunda's retry budget with back-off
  • Throw a typed BPMN error that an error boundary event can catch

The worker handles all three via failJob and throwJobError, giving your process model clean error paths.

Installation

casen plugin install casen-worker-ai

Set your Anthropic API key before starting:

export ANTHROPIC_API_KEY=sk-ant-...
casen ai-worker

Configuration

| Environment variable | Default | Description | |---|---|---| | ANTHROPIC_API_KEY | required | Your Anthropic API key | | AI_MODEL | claude-3-5-haiku-20241022 | Model ID to use | | AI_MAX_TOKENS | 1024 | Token budget per call | | AI_TIMEOUT_MS | 60000 | HTTP timeout in ms |

Operations

com.bpmnkit.ai.classify — Classify text

Classifies text into one of the provided categories.

Input variables:

| Variable | Type | Required | Description | |---|---|---|---| | input | string | ✓ | Text to classify | | categories | string[] | ✓ | Allowed category names | | context | string | — | Optional domain context |

Output variables: category, confidence (0–1), rationale, aiModel, processedAt

BPMN error codes: AI_INVALID_CATEGORY, AI_PARSE_ERROR, AI_API_ERROR, AI_INVALID_INPUT

<bpmn:serviceTask id="ClassifyTicket" name="Classify ticket">
  <bpmn:extensionElements>
    <zeebe:taskDefinition type="com.bpmnkit.ai.classify" retries="3" />
    <zeebe:taskHeaders>
      <zeebe:header key="retryBackoff" value="PT30S" />
    </zeebe:taskHeaders>
    <zeebe:ioMapping>
      <zeebe:input source="=ticket.body" target="input" />
      <zeebe:input source='=["billing","technical","cancellation","general"]' target="categories" />
    </zeebe:ioMapping>
  </bpmn:extensionElements>
</bpmn:serviceTask>

com.bpmnkit.ai.summarize — Summarize text

Summarizes text to a target length and style.

Input variables:

| Variable | Type | Required | Description | |---|---|---|---| | input | string | ✓ | Text to summarize | | maxWords | number | — | Target word count (default: 100) | | style | "bullet" | "paragraph" | — | Output style (default: "paragraph") |

Output variables: summary, wordCount, aiModel, processedAt

com.bpmnkit.ai.extract — Extract structured fields

Extracts named fields from unstructured text. Missing fields are reported but the job still completes — use a gateway on =missingFields to decide whether to auto-proceed or route to manual review.

Input variables:

| Variable | Type | Required | Description | |---|---|---|---| | input | string | ✓ | Unstructured text | | fields | string[] | ✓ | Field names to extract | | schema | object | — | Type hints per field, e.g. { amount: "number" } |

Output variables: extracted (object), missingFields (array), aiModel, processedAt

com.bpmnkit.ai.decide — Make a boolean decision

Answers a yes/no question based on context and an optional policy statement. Use confidence at a gateway to route low-confidence decisions to human review.

Input variables:

| Variable | Type | Required | Description | |---|---|---|---| | question | string | ✓ | The yes/no question | | context | string | ✓ | Relevant facts | | policy | string | — | Natural language policy the model must apply |

Output variables: decision (boolean), rationale, confidence (0–1), aiModel, processedAt

Example workflow: Credit decision

Start Event
  → summarize (summarize application notes, maxWords=150)
  → decide     (question="Approve loan?", policy="Score ≥ 680 and amount ≤ 50k")
  → Gateway: decision=true and confidence≥0.8 → Auto-approve
             decision=false and confidence≥0.8 → Auto-deny
             default                           → Human review

Error handling

Add boundary events to your service tasks to handle AI failures gracefully:

  • Error boundary catching AI_PARSE_ERROR → route to a manual input fallback task
  • Timer boundary (PT5M) → escalation path if the worker is not running
  • Set retries="3" and retryBackoff="PT30S" on the task definition — the worker signals Camunda to retry via failJob on rate limits and network timeouts

Related Packages

| Package | Description | |---------|-------------| | @bpmnkit/core | BPMN/DMN/Form parser, builder, layout engine | | @bpmnkit/canvas | Zero-dependency SVG BPMN viewer | | @bpmnkit/editor | Full-featured interactive BPMN editor | | @bpmnkit/engine | Lightweight BPMN process execution engine | | @bpmnkit/feel | FEEL expression language parser & evaluator | | @bpmnkit/plugins | 22 composable canvas plugins | | @bpmnkit/api | Camunda 8 REST API TypeScript client | | @bpmnkit/ascii | Render BPMN diagrams as Unicode ASCII art | | @bpmnkit/ui | Shared design tokens and UI components | | @bpmnkit/profiles | Shared auth, profile storage, and client factories for CLI & proxy | | @bpmnkit/operate | Monitoring & operations frontend for Camunda clusters | | @bpmnkit/connector-gen | Generate connector templates from OpenAPI specs | | @bpmnkit/cli | Camunda 8 command-line interface (casen) | | @bpmnkit/proxy | Local AI bridge and Camunda API proxy server | | @bpmnkit/cli-sdk | Plugin authoring SDK for the casen CLI | | @bpmnkit/create-casen-plugin | Scaffold a new casen CLI plugin in seconds | | @bpmnkit/casen-report | HTML reports from Camunda 8 incident and SLA data | | @bpmnkit/casen-worker-http | Example HTTP worker plugin — completes jobs with live JSONPlaceholder API data |

License

MIT © BPMN Kit — made by u11g