@kognitivedev/tools
v0.2.11
Published
Tool system with approval workflows and AI SDK conversion
Maintainers
Readme
@kognitivedev/tools
Tool system for Kognitive agents — createTool, ToolRegistry, approval workflows, and AI SDK conversion.
Installation
bun add @kognitivedev/toolsQuick Start
import { createTool, ToolRegistry } from "@kognitivedev/tools";
import { z } from "zod";
import { streamText } from "ai";
const searchTool = createTool({
id: "search",
description: "Search documentation",
inputSchema: z.object({ query: z.string() }),
execute: async (input) => ({ results: [`Result for: ${input.query}`] }),
});
const registry = new ToolRegistry();
registry.register(searchTool);
const result = await streamText({
model: openai("gpt-4o"),
tools: registry.toAISDKTools(),
messages,
});Features
- createTool — typed tool factory with Zod schemas
- ToolRegistry — named collection with
toAISDKTools()conversion - Approval —
requireApproval(boolean or conditional function) - AI SDK native — converts directly to AI SDK
tool()format
