@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 / objectFlowDefinitioninto a durable DAG runner. See Visual flows.createChatTrigger({ adapter, agent, ... })— unified inbound trigger for chat-surface bots (Slack / Teams / Discord / WhatsApp). Wraps aChatSurfaceAdapterthat normalizes provider events into aChatSurfaceEventdiscriminated union (message/mention/reply/reaction/file_upload/installation). Returns a framework-agnosticWebhookHandler.createQuotaTracker+withQuotas— per-tool quota / blast-radius limits (count / cost / duration windows).createValidatorGuard+ built-in validatorsdenyPattern,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:
speculateorreplayAgainst. - Compose agents: supervisor / swarm / hierarchical / blackboard.
- React to events:
createWebhookHandler+createCronScheduler.
#Related packages
#Source
- npm: https://www.npmjs.com/package/@agentskit/runtime
- repo: https://github.com/AgentsKit-io/agentskit/tree/main/packages/runtime
Explore nearby
- PeerFor agents — overview
Dense, LLM-friendly reference for every AgentsKit package. Designed to paste into an agent's context window.
- Peer@agentskit/core — for agents
Zero-dependency foundation. Contracts, chat controller, primitives, and a dozen feature subpaths.
- Peer@agentskit/adapters — for agents
Provider adapters (OpenAI-compatible + native) + router + ensemble + fallback + generic factory.