Run This Ai
EN DE

Getting Started with KaibanJS: Your First Multi-Agent Workflow in JavaScript

A step-by-step tutorial showing how to build your first multi-agent AI system with KaibanJS — from install to running agents, all in under 50 lines of JavaScript.

KaibanJS Logo

Getting Started with KaibanJS: Your First Multi-Agent System

This tutorial walks you through building your first multi-agent workflow with KaibanJS. By the end, you'll have a working system where multiple AI agents collaborate on tasks through a Kanban-style board — directly from your Node.js project.

Prerequisites

  • Node.js 18+ installed on your machine
  • A valid OpenAI API key (or any LangChain-compatible LLM provider)
  • Basic familiarity with JavaScript/TypeScript and async/await patterns

Step 1: Install KaibanJS

npm install kaibanjs

Or if you prefer Yarn:

yarn add kaibanjs

That's it — no Docker containers, no Python virtual environments, no complex setup. KaibanJS is a pure JavaScript package that runs wherever Node.js does.

Step 2: Define Your Agents

In KaibanJS, you define agents as JavaScript objects. Each agent has a role, a goal, and optionally, tools and a language model configuration. Here's a simple two-agent setup:

import { Agent, Task, Team } from "kaibanjs";

// A researcher agent that gathers information
const researcher = new Agent({
    name: "Researcher",
    role: "Research Analyst",
    goal: "Find accurate and relevant information",
    background: "Expert research analyst with web research skills",
    tools: [], // Add web search tools here
});

// A writer agent that creates content
const writer = new Agent({
    name: "Writer",
    role: "Content Creator",
    goal: "Create engaging content from research",
    background: "Professional writer specializing in technical content",
});

Step 3: Define Tasks

Tasks are the work items that flow through your Kanban board. Each task is assigned to an agent and has a clear description:

const researchTask = new Task({
    description: "Research the latest trends in AI agent frameworks for 2024-2025",
    expectedOutput: "A comprehensive research summary with key findings and statistics",
    agent: researcher,
});

const writingTask = new Task({
    description: "Write a blog post based on the research findings",
    expectedOutput: "A well-structured blog post in markdown format",
    agent: writer,
});

Step 4: Create a Team and Start Working

Combine agents and tasks into a Team, then start the workflow. KaibanJS handles all the orchestration — assigning tasks to agents, tracking progress, and passing results between them automatically.

const team = new Team({
    name: "Content Creation Team",
    agents: [researcher, writer],
    tasks: [researchTask, writingTask],
    env: { OPENAI_API_KEY: "your-api-key" },
});

// Start the workflow
const result = await team.start();
console.log("Output:", result.output);

How It Works

When you call team.start(), KaibanJS creates a Kanban board internally. The researcher agent gets the research task in its "To Do" column. When it completes, the task moves to "Done" and the result is passed to the writer agent's "To Do" column. This chained workflow is visible in real-time, and you can inspect the state of every agent and task at any point.

KaibanJS GitHub Preview

Step 5: Monitor the Workflow

KaibanJS provides built-in status tracking. After starting the team, you can check the Kanban board state:

// Get the current state of the board
const boardState = team.getBoardState();
console.log(JSON.stringify(boardState, null, 2));

// This shows which tasks are in which column,
// which agent is working on what, and completed items

Conclusion

You've just built your first multi-agent system with KaibanJS in under 50 lines of code. The Kanban-based approach makes it trivial to understand, debug, and extend your agent workflows. As your systems grow more complex — adding more agents, tools, and sophisticated task dependencies — the visual board metaphor keeps everything manageable and transparent.

Next steps: explore KaibanJS documentation to learn about custom tools, agent memory, conditional workflows, and integrating with web frameworks like Next.js for building agent-backed applications.

#kaibanjs #tutorial #javascript #multi-agent #getting-started