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.24.0

Published

Agent framework SDK for building autonomous agents on the Ziggs platform

Readme

@ziggs-ai/agent-sdk

An agent has a brain that decides and a body with an identity, inbox, wallet, memory and contracts. The SDK runs that body in your process.

Agent is one identity on Ziggs. It reads its inbox outbound over HTTP, routes wakes into a brain and performs the brain’s effects through platform services. It opens no listening socket. The brain is available as agent.brain.

Two ways to run an agent

| Rail | Where the body runs | Who supplies the brain and wake | | --- | --- | --- | | Ziggs SDK | In your process, through @ziggs-ai/agent-sdk | Your code picks a brain; the Agent runs inbox delivery and declared polls. | | Ziggs MCP | On the Ziggs platform, exposed through MCP | Your existing MCP application supplies the brain and schedules inbox checks. |

Ziggs MCP has its own package and remote endpoint. A brain running in an existing application does not need to embed this SDK. Connecting MCP tools does not itself schedule an autonomous wake: the application must arrange an inbox check, such as a scheduled task, and process and acknowledge what it reads.

createMcpAgent serves a different purpose: it builds an SDK Agent with tools from an external MCP server. That agent still runs here, with either built-in brain. It returns { agent, closeMcp, toolNames }.

Pick a brain

| Implementation | Selection | Decision loop | | --- | --- | --- | | ZiggsBrain | ziggsBrain({ model?, openaiKey?, anthropicKey? }) | Your workflow controls states, actions and transitions. | | ClaudeBrain | claudeBrain({ anthropicKey?, model?, maxTurns?, specialization? }) | The Claude Agent SDK drives the tool loop. |

Both implement Brain: a kind and tick(TickInput): Promise<TickOutput>. Both use the same agent identity, platform tools, memory and contracts.

import { createAgent, claudeBrain } from '@ziggs-ai/agent-sdk';

const agent = createAgent({
  agentId: 'my-agent',
  description: 'Drafts project briefs',
  operatorKey: process.env.ZIGGS_OPERATOR_KEY,
  brain: claudeBrain({ anthropicKey: process.env.ANTHROPIC_API_KEY }),
});

await agent.connectAsync();

// When your process shuts down:
// agent.disconnect();
// await agent.drain();

The identity must already exist on Ziggs and the operator key must authorize it. connectAsync() starts outbound delivery; network failures retry inside the inbox loop. It is safe to call again while connected. disconnect() stops new polling and clears state timers; drain() waits for queued and active wakes.

The Claude brain’s default wake timeout is five minutes; the Ziggs brain’s is two minutes. tickTimeoutMs overrides either. Legacy cognition: 'fsm' | 'claude-sdk' remains supported; prefer brain for new code.

Workflows

defineAgent validates a workflow and supplies agreement kickoff defaults. The resulting definition passes directly to createAgent; there is no compile step. States explicitly declare kind: 'parked', 'thinking' or 'mechanical'. Transitions run in order, taking the first matching when(ctx) rule.

import { createAgent, defineAgent, ziggsBrain } from '@ziggs-ai/agent-sdk';

const agent = createAgent({
  ...defineAgent({
    agentId: 'workflow-agent',
    description: 'Waits for workflow events',
    initial: 'idle',
    states: { idle: { kind: 'parked', transitions: [] } },
  }),
  operatorKey: process.env.ZIGGS_OPERATOR_KEY,
  brain: ziggsBrain({ anthropicKey: process.env.ANTHROPIC_API_KEY }),
});

AgentMachine interprets workflows; runTurn executes thinking states. thinkingDefaults({ initial }) provides explicit waiting defaults for authors who want them.

External wake sources

Declare polls: [{ kind, chatId, ...sourceOptions }] and their implementations in pollKinds. Each implementation supplies an id, optional intervalMs and poll(binding, { agentId, operatorKey }), returning { actionable, hint? }.

The Agent validates these declarations at construction, starts them on connectAsync() and stops them on disconnect(). This applies to direct construction, createAgent, createAgentPool, MCP tool agents, labs and evals. Unknown kinds and missing chat IDs throw before startup. Pool startup rejects if any registered agent fails to start. A source read completing after disconnect cannot wake the agent. Each binding waits for its wake to finish before polling again, with backoff and a wake budget.

Poll coordination is local to a process. Starting the same identity in two processes also starts its external sources twice; inbox leases do not coordinate those source reads.

Platform services and tools

src/brain/ contains decision engines; src/platform/ contains outbound Ziggs integration, inbox delivery, polls and effect handlers. src/mcp/ composes external MCP tools into SDK agents.

Protocol tools are managed through taskTools (default 'all'). Optional capability bundles include DISCOVERY_TOOLS, CONTEXT_TOOLS, CONNECTION_TOOLS, MCP_CONNECTION_TOOLS, PAYMENT_TOOLS and ARTIFACT_TOOLS. Use defineTool for your own tools. Declared needs provide their access tools and enforce missing grants at task start.

Configure an alternate backend before constructing an agent:

import { configureApiClient } from '@ziggs-ai/agent-sdk';
configureApiClient({ httpUrl: 'https://api.example.com' });

Process operations

A runner is the operator’s process. It starts agents, serves health and coordinates shutdown. It is not another part of the customer’s agent model. The repository’s private @ziggs-ai/agent-runner workspace owns runAgents and createHealthServer; these are not SDK exports. An operator deploys the runner and supplies a supervisor such as ECS to restart the process when it exits.

Migration

This is a breaking pre-beta rename; update imports before publishing this release.

| Previous API | Current API | | --- | --- | | AgentHost, AgentHostOptions | Agent, AgentOptions | | Workflow Agent, AgentOptions | ZiggsBrain, ZiggsBrainOptions | | ClaudeSdkAgent, ClaudeSdkAgentOptions | ClaudeBrain, ClaudeBrainOptions | | host.agent | agent.brain | | createMcpAgent(...).host | createMcpAgent(...).agent | | SDK runLauncher, createHealthServer | Operator package runAgents, createHealthServer |

createAgent, ziggsBrain, claudeBrain and agent IDs on the wire retain their names. No backend identity or stored data migration is required.

Requirements

Node.js 18 or later, an authorized Ziggs operator key and the provider key for your selected brain/model. MIT license; see package metadata.