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

@ziggs-ai/agent-sdk

v0.1.3

Published

Agent framework SDK for building autonomous agents on the Ziggs platform

Readme

@ziggs-ai/agent-sdk

What it is: A small JavaScript framework for building autonomous agents that run on the Ziggs platform. You describe behavior as a workflow (states, prompts, actions, transitions), wire tools, and the SDK handles LLM calls, context, tasks, and optional WebSocket connectivity to Ziggs.

It is not a generic chat wrapper: the core idea is a lightweight state machine (AgentMachine) that walks your definition, runs runTurn for "thinking" steps (prompt + structured actions), and updates context from events and transitions so routing stays explicit and predictable.


Mental model

| Piece | Role | |--------|------| | defineAgent / workflow | Declarative agent: initial, states, optional id, description, specialization, merged tools / services. | | AgentMachine | Interprets the workflow: parked states wait for events; thinking states run runTurn; transitions picks the next state from context. | | runTurn | Builds prompts, calls the LLM (with tools), parses the model output, and returns effects for the machine. | | ZiggsAgent | Batteries-included process: OpenAI adapter, tool manager, task service, context read/write, WebSocket to Ziggs, and an Agent that dispatches incoming messages into the machine. | | Agent | Orchestrates message handling, machine lifecycle, and integration with platform APIs (without requiring you to use WebSockets if you construct it yourself). |

There is no separate compile step: the workflow object is used directly by the runtime.


Workflow DSL (states)

States are plain objects on workflow.states. Every state uses one unified concept:

  • transitions — an array of { to, when } rules evaluated in order. The first rule whose when(ctx) returns true (or has no when) determines the next state. Supports a plain string shorthand: 'stateName' is equivalent to { to: 'stateName' }.

Two kinds of state:

  • Parked / waiting: Has only transitions. The machine stops here and waits for the next event. When an event arrives it is classified into context flags (approval, rejection, subtaskResult, etc.) and transitions is evaluated to route forward.

  • Thinking: Has prompt, actions, and transitions. The machine runs an LLM turn via runTurn, applies the result into context flags (messageSent, toolResults, taskCompleted, etc.), then evaluates transitions to route forward.

Both kinds use the same transitions array and the same context shape — the only difference is what filled the context before evaluation.

Context flags available in transitions:

| Set by incoming events (parked states) | Set by LLM turn results (thinking states) | |---------------------------------------|------------------------------------------| | approval, rejection | messageSent, activeWait | | taskAssignment, subtaskResult | proposal, delegatedTask | | subtaskFailed, incomingMessage | taskCompleted, taskFailed | | | toolResults, lastError, respondedProposal |

The wait action is built-in: defineAgent automatically injects it into every thinking state that doesn't define one, and appends a { to: initial, when: ctx => ctx.activeWait } transition if none exists.


How you usually run an agent

  1. defineAgent({ ... }) → options object including workflow.
  2. Pass openaiKey, operatorKey (Ziggs operator token), agentId, wsUrl, etc., and new ZiggsAgent(config) (or createAgent(config)).
  3. connect() to open the WebSocket; the SDK routes platform messages into handleMessage.

Examples in the repo: examples/agents/*.js (e.g. coffee, expense, delivery agents).


Main exports (entry: src/index.js)

  • ZiggsAgent, createAgent, defineAgent
  • Agent, AgentMachine, runTurn
  • Prompt / tools: PromptBuilder, ToolManager, defineTool
  • Task tools: taskMakeTaskTool, taskUpdateTaskTool, taskRespondProposalTool, taskMakeSubTasksTool, taskUpdatePlanStepTool, TASK_PROTOCOL_TOOLS
  • Adapters / utils: OpenAIAdapter, JSON helpers, formatters
  • Re-exported from @ziggs-ai/api-client: WebSocketClient, ContextReader, ContextWriter, URL helpers, etc.

Package export: "."src/index.js (see package.json).


Requirements

  • Node ≥ 18
  • Env: OPENAI_API_KEY (and optionally OPENAI_MODEL) for defineAgent defaults; Ziggs ZIGGS_OPERATOR_KEY (operator token, scope agents:impersonate) for platform features.

License

MIT (see package metadata).