UNPKG

@coinbase/agentkit-vercel-ai-sdk

Version:

Vercel AI SDK extension of CDP Agentkit

28 lines (27 loc) 802 B
"use strict"; /** * Main exports for the CDP Vercel AI SDK package */ Object.defineProperty(exports, "__esModule", { value: true }); exports.getVercelAITools = getVercelAITools; const ai_1 = require("ai"); /** * Get Vercel AI SDK tools from an AgentKit instance * * @param agentKit - The AgentKit instance * @returns An array of Vercel AI SDK tools */ function getVercelAITools(agentKit) { const actions = agentKit.getActions(); return actions.reduce((acc, action) => { acc[action.name] = (0, ai_1.tool)({ description: action.description, parameters: action.schema, execute: async (args) => { const result = await action.invoke(args); return result; }, }); return acc; }, {}); }