agentskit.js

@agentskit/runtime — for agents

Standalone agent runtime (ReAct loop) + speculate + topologies + durable execution + background agents.

#Purpose

Run an agent without a UI. Supports reflection, planning, multi-agent orchestration, durable step logs, cron + webhooks, speculative execution.

#Install

npm install @agentskit/runtime

#Primary exports

  • createRuntime({ adapter, tools, memory, skills, observers, ... }) — one-line agent; runtime.run(task) returns { content, steps, ... }.
  • createSharedContext — typed shared context across tools.
  • speculate({ candidates, pick, timeoutMs }) — race adapters, abort losers. See Speculative execution.
  • supervisor, swarm, hierarchical, blackboard — multi-agent topologies. See Topologies.
  • createDurableRunner + createInMemoryStepLog / createFileStepLog — Temporal-style step-log durability. See Durable execution.
  • createCronScheduler (5-field cron + every:<ms>) + createWebhookHandler + parseSchedule + cronMatches — background agents. See Background agents.
  • compileFlow({ definition, registry }) + validateFlow + flowToMermaid — compile a YAML / object FlowDefinition into a durable DAG runner. See Visual flows.
  • createChatTrigger({ adapter, agent, ... }) — unified inbound trigger for chat-surface bots (Slack / Teams / Discord / WhatsApp). Wraps a ChatSurfaceAdapter that normalizes provider events into a ChatSurfaceEvent discriminated union (message / mention / reply / reaction / file_upload / installation). Returns a framework-agnostic WebhookHandler.
  • createQuotaTracker + withQuotas — per-tool quota / blast-radius limits (count / cost / duration windows).
  • createValidatorGuard + built-in validators denyPattern, lengthRange, isJson — agent-insurance primitive that rejects tool args / outputs against allow/deny rules before they propagate.

#Minimal example

import { createRuntime } from '@agentskit/runtime'
import { anthropic } from '@agentskit/adapters'

const runtime = createRuntime({
  adapter: anthropic({ apiKey: process.env.ANTHROPIC_API_KEY!, model: 'claude-sonnet-4-6' }),
})

const result = await runtime.run('Summarize the quarterly report.')
console.log(result.content)

#Common patterns

  • Survive crashes: wrap side effects in runner.step(id, fn) (durable).
  • A/B across models: speculate or replayAgainst.
  • Compose agents: supervisor / swarm / hierarchical / blackboard.
  • React to events: createWebhookHandler + createCronScheduler.

#Source

Explore nearby

✎ Edit this page on GitHub·Found a problem? Open an issue →·How to contribute →

On this page