agentskit.js

Multi-Agent Delegation

Coordinate multiple specialist agents from a parent agent using directed delegation.

Coordinate multiple specialist agents from a parent agent using directed delegation.

#Install

npm install @agentskit/runtime @agentskit/adapters @agentskit/skills @agentskit/tools

#Quick Start

import { createRuntime, createSharedContext } from '@agentskit/runtime'
import { anthropic } from '@agentskit/adapters'
import { planner, researcher, coder } from '@agentskit/skills'
import { webSearch, filesystem } from '@agentskit/tools'

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

const result = await runtime.run('Build a landing page about quantum computing', {
  skill: planner,
  delegates: {
    researcher: { skill: researcher, tools: [webSearch()], maxSteps: 3 },
    coder: { skill: coder, tools: [...filesystem({ basePath: './src' })], maxSteps: 8 },
  },
})

#How It Works

When you configure delegates, the runtime auto-generates tools named delegate_<name>. The parent LLM calls them like any other tool. Each delegate runs its own ReAct loop and returns a result.

#DelegateConfig

interface DelegateConfig {
  skill: SkillDefinition     // required β€” the child's behavior
  tools?: ToolDefinition[]   // tools available to the child
  adapter?: AdapterFactory   // optional β€” different LLM per child
  maxSteps?: number          // default: 5
}

#Shared Context

const ctx = createSharedContext({ project: 'landing-page' })

runtime.run('Build it', { delegates: { ... }, sharedContext: ctx })

// Parent reads/writes
ctx.set('key', 'value')
ctx.get('key')

// Children get read-only view β€” set() is not available

#Child Isolation

  • Fresh messages β€” no parent history
  • Inherits observers β€” events visible in logging
  • No memory β€” doesn't share parent's memory
  • Depth limit β€” maxDelegationDepth default 3

#Events

[10:00:01] => delegate:start researcher [depth=1] "Research quantum computing"
[10:00:03] <= delegate:end researcher (2100ms) "Found 3 papers on..."

Explore nearby

✎ Edit this page on GitHubΒ·Found a problem? Open an issue β†’Β·How to contribute β†’

On this page