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

@temporalio/agent-kit-worker

v0.8.0

Published

Worker side of the Temporal Agent Kit: the AgentKitPlugin and its activities, the agent client and the Code Mode sandbox.

Readme

@temporalio/agent-kit-worker

The worker side of the Temporal Agent Kit: AgentKitPlugin and Agent Kit's activities, the agent client, Code Mode's Monty activities, and the agent-kit command (init, schema, skills, doctor; agent-kit-schema is the same schema command). Agents themselves are written against @temporalio/agent-kit, which runs in the workflow.

Getting started

Follow the TypeScript quickstart for a complete npm install, agent, worker, registry, and first console session. It includes the pinned Temporal and OpenAI dependencies and explains the startup processes.

Agent Kit has one server and console for both SDKs. They come from the temporal-agent-kit Python package; uvx runs them without a Python project of your own. Your agents run on your TypeScript worker.

Worker configuration

The worker is an ordinary Temporal worker, so it can host other workflows and activities too. AgentKitPlugin adds Agent Kit's activities, payload offload, activity tool bodies (tools: [toolActivity(tool, impl), ...]), and Code Mode when @pydantic/monty is installed. Register it after your model integration's plugin, such as OpenAIAgentsPlugin, GoogleGenAIPlugin or StrandsPlugin. The OpenAI plugin must be imported from this package's /ai-sdks/openai-agents entry point to enable Agent Kit streaming. StrandsPlugin comes from /ai-sdks/strands-agents; pass it observerFactory: kitObserverFactory from /ai-sdks/strands-agents to stream onto the turn.

Keep the underlying Temporal SDK packages at the version required by the model integration. The @temporalio/agent-kit* packages have their own, separate version. The quickstart lists a complete pinned installation.

Schema CLI and init data

An agent, in agents.ts:

import { z } from "zod";
import {
  TextMessage,
  TextReply,
  ToolApprovalPolicy,
  defineAgent,
  handler,
} from "@temporalio/agent-kit";

export const BriefedAgent = defineAgent({
  name: "BriefedAgent",
  approvalPolicyDefault: ToolApprovalPolicy.alwaysRequireHumanApproval(),
  initData: { schema: z.object({ topic: z.string() }).meta({ title: "Brief" }), required: true },
  handlers: {
    ask: handler({ description: "Ask about the topic.", input: TextMessage, output: TextReply }),
  },
  create: ({ data }) => ({ ask: async ({ text }) => ({ text: `${data.topic}: ${text}` }) }),
});

Add closeAfterIdleDefault: "30 minutes" to close an agent once no one has sent it a message for that long, such as one behind a chat box whose session is not kept. An idle agent consumes no compute while it waits, so leave this out for agents you want to keep. A caller overrides it with close_after_idle (seconds, 0 for never) on the AgentConfig. Subagents never close on idle: their parent decides when they end.

A Temporal Schedule can start a workflow but can't send it a message. To start a session on a Schedule, put the first message in the AgentConfig as initial_message ({ type: "ask", payload: { text: "..." } }). The runner admits it when the agent starts, as turn 1. Set close_after_idle with it, so that the session closes after its turn. A message the agent refuses fails the workflow.

Its worker, in worker.ts (compile both files before running):

import { fileURLToPath } from "node:url";
import { loadClientConnectConfig } from "@temporalio/envconfig";
import { NativeConnection, Worker } from "@temporalio/worker";
import { AgentKitPlugin } from "@temporalio/agent-kit-worker";

const { connectionOptions, namespace } = loadClientConnectConfig();
const worker = await Worker.create({
  connection: await NativeConnection.connect(connectionOptions),
  namespace: namespace ?? "default",
  taskQueue: "briefed-agent-task-queue",
  workflowsPath: fileURLToPath(new URL("./agents.js", import.meta.url)),
  plugins: [new AgentKitPlugin()],
});
await worker.run();

The registry the server reads, agents.toml:

[[agents]]
key = "briefed"
workflow_type = "BriefedAgent"
task_queue = "briefed-agent-task-queue"
label = "Briefed"
description = "Answers questions about the topic it is started with."
schema = "BriefedAgent.schema.json"   # optional; see below

schema is the agent's schema document, relative to the registry. From it the server reads what the agent takes to start, here a required Brief, so the console asks for it in a form before starting a session; the server never imports your code. Write it, and again whenever the agent's init data changes:

npx agent-kit schema ./dist/agents.js#BriefedAgent -o BriefedAgent.schema.json

It takes <module>#<export>: a module path relative to the current directory, TypeScript (Node 22.18 or later runs it directly) or compiled JavaScript, and the name the agent is exported as. Without -o it prints the document.

Serving and connection configuration

Follow Run the web UI for the startup commands. The console server uses the registry and generated schema; the server never imports your TypeScript code. Keep workflow_type equal to the agent's defineAgent({ name }), and task_queue equal to the queue your worker polls.

loadClientConnectConfig() and the Python CLI resolve the Temporal connection from TEMPORAL_* environment variables and profiles. With nothing configured, they use localhost:7233 and namespace default. For a project-local file, export TEMPORAL_CONFIG_FILE explicitly in every service terminal; a temporal.toml in the current directory is not picked up automatically. Use the same TEMPORAL_PROFILE and connection overrides for all services.

If you use TASK_QUEUE_PREFIX, set it consistently for the console server and the worker, and resolve the worker queue with taskQueueName("briefed-agent-task-queue"), exported by this package. The registry keeps the unprefixed queue name; the server applies the prefix.

See the registry and server documentation and quickstart troubleshooting.