Skip to content

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AgentKit Node SDK

The official Node.js SDK for AgentKit.

AgentKit lets you expose your existing backend functions as AI-callable tools without rewriting your application or exposing public endpoints.


Features

  • 🚀 Register existing backend functions as AI tools
  • 🔒 Outbound-only WebSocket connection (no public endpoints required)
  • 📦 TypeScript-first
  • ✅ Supports Zod and JSON Schema
  • ⚡ Automatic reconnection
  • ❤️ Works with Express, NestJS, Fastify and any Node.js server

Installation

npm install @rutvikmakvana/agentkit-node

Quick Start

import { agentkit } from "@rutvikmakvana/agentkit-node";
import { z } from "zod";

agentkit.init({
  projectKey: process.env.AGENTKIT_PROJECT_KEY!,
});

agentkit.tool({
  name: "getOrder",
  description: "Get order details by ID",
  input: z.object({
    orderId: z.string(),
  }),
  handler: async ({ orderId }) => {
    return orderService.getOrder(orderId);
  },
});

agentkit.connect();

API

Initialize

agentkit.init({
  projectKey: "...",
});

Register Tool

agentkit.tool({
  name,
  description,
  input,
  handler,
});

Connect

agentkit.connect();

Disconnect

agentkit.disconnect();

Supported Schemas

Zod

input: z.object({
  id: z.string(),
});

JSON Schema

input: {
  type: "object",
  properties: {
    id: {
      type: "string"
    }
  }
}

Events

agentkit.on("connected", ...);

agentkit.on("disconnected", ...);

agentkit.on("toolCalled", ...);

agentkit.on("error", ...);

Supported Frameworks

  • Express
  • NestJS
  • Fastify
  • Hono
  • Koa
  • Any Node.js HTTP server

How AgentKit Works

Your Backend
      │
      │
agentkit.connect()
      │
      ▼
Outbound WebSocket
      │
      ▼
AgentKit Cloud
      │
      ▼
LLM invokes your tool
      │
      ▼
Your existing function executes
      │
      ▼
Response returned to the AI

No public API endpoints.

No ngrok.

No inbound ports.

Works locally and in production.


Requirements

  • Node.js 18+
  • TypeScript 5+

License

MIT

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages