Ninja Agents SDK - v1.0.0

Fileoverview

Ninja Agents SDK - Main package exports

A comprehensive TypeScript framework for building sophisticated AI crew orchestration systems. This package provides a clean, modular architecture for creating AI agents that can work together to solve complex problems.

Example: Quick Start

import { Shinobi, Kata, Shuriken, KataRuntime, Logger, Memory } from 'ninja-agents';
import { z } from 'zod';
import OpenAI from 'openai';

// Initialize core services
const openai = new OpenAI({ apiKey: process.env.OPENAI_API_KEY });
const memory = new Memory();
const logger = new Logger('info', 'MyApp', memory);
const runtime = new KataRuntime(openai, logger, memory);

// Create a simple capability
const calculatorShuriken = new Shuriken(
'calculate',
'Perform mathematical calculations',
z.object({
operation: z.enum(['add', 'subtract', 'multiply', 'divide']),
a: z.number(),
b: z.number()
}),
(params) => {
switch (params.operation) {
case 'add': return params.a + params.b;
case 'subtract': return params.a - params.b;
case 'multiply': return params.a * params.b;
case 'divide': return params.a / params.b;
}
}
);

// Create and execute a Shinobi
const mathExpert = new Shinobi(runtime, {
role: 'Mathematics Expert',
description: 'A skilled mathematician',
backstory: 'PhD in Mathematics with 20 years of experience',
shurikens: [calculatorShuriken],
katas: [{
model: 'gpt-4o-mini',
title: 'Problem Solver',
description: 'Solve mathematical problems step by step'
}]
});

const result = await mathExpert.execute('What is 15% of 240, then multiply by 3?');

Version

1.0.0

Author

Ninja Agents Team

Since

1.0.0

Index

Classes

Interfaces

Type Aliases

Core Components - Shuriken Represents an AI capability or function that can be invoked by an AI agent (Kata). Shurikens encapsulate both the definition (for OpenAI tool calling) and the implementation of a specific function.