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

@theokit/sdk-handoff

v0.1.0

Published

Inter-agent dispatch for @theokit/sdk — typed Handoff descriptors, loop protection, plugin-based wiring.

Readme

@theokit/sdk-handoff

Inter-agent dispatch for @theokit/sdk. Typed Handoff descriptors with loop protection (self-reference, A↔B pair, multi-hop, receiver-disposed).

Extracted from @theokit/[email protected] as part of the SDK 2.0 package split (ADRs D214-D229).

Install

pnpm add @theokit/sdk @theokit/sdk-handoff

Quick start

import { Agent } from "@theokit/sdk";
import { Handoff } from "@theokit/sdk-handoff";

const billing = await Agent.create({
  name: "billing",
  model: { id: "openai/gpt-4o-mini" },
});

const support = await Agent.create({
  name: "support",
  model: { id: "openai/gpt-4o-mini" },
  // Preferred (new in 2.x): handoffs wire via Plugin protocol.
  plugins: [Handoff.asPlugin({ targets: [billing] })],
});

await support.send("I need help with my invoice");   // → support delegates to billing

The previous Agent.create({ handoffs: [...] }) option is deprecated in 2.x. It still works while @theokit/sdk-handoff is installed (the framework lazy-imports the tool-injector at runtime), but the codemod marks every call site with a CODEMOD comment recommending the plugins: [Handoff.asPlugin({...})] pattern. Plan removes the option entirely in 2.0.0 cohort.

API

Handoff.asPlugin({ targets, maxHandoffDepth? }): Plugin

Returns a Plugin consumed by Agent.create({ plugins: [...] }). The plugin runs at agent initialization and appends one CustomTool per target agent into the host's tool registry. Each invocation of the tool dispatches the conversation to the target agent (loop-protected).

| Option | Type | Default | Notes | |---|---|---|---| | targets | Array<SDKAgent \| HandoffDescriptor> | (required) | Agents the host can hand off to. | | maxHandoffDepth | number | 5 | Hop count cap. 0 disables handoff entirely. |

Errors

All errors extend Error and live in @theokit/sdk-handoff:

  • HandoffLoopError — multi-hop loop detected at runtime (A→B→C→A).
  • HandoffPairLoopError — A→B and B→A registered simultaneously.
  • HandoffSelfReferenceError — agent handoffs to itself.
  • HandoffReceiverDisposedError — target was disposed before dispatch.
  • HandoffNameCollisionError — two targets share the same agent name.

handoffTo(agent, opts?): HandoffDescriptor

Helper for one-off descriptor construction without going through Handoff.create.

How it fits with @theokit/sdk

  • Foundation: definePlugin, Plugin, CustomTool, and SDKAgent types come from @theokit/sdk.
  • Optional peer model: @theokit/[email protected] lazy-imports @theokit/sdk-handoff/internal/tool-injector only when Agent.create({ handoffs: [...] }) is called. Without the package installed, the option throws an actionable error.
  • No kernel coupling beyond types: sdk-handoff never imports from @theokit/sdk/internal/runtime or the agent loop.

Migration from @theokit/[email protected]

Before (1.x):

import { Agent, Handoff, handoffTo } from "@theokit/sdk";

const support = await Agent.create({
  name: "support",
  handoffs: [billing],
});

After (2.x):

import { Agent } from "@theokit/sdk";
import { Handoff } from "@theokit/sdk-handoff";

const support = await Agent.create({
  name: "support",
  plugins: [Handoff.asPlugin({ targets: [billing] })],
});

See docs/migration/1-x-to-2-0.md in the monorepo root.

License

Apache-2.0.