šŸš€ Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more →
Socket
Sign inDemoInstall
Socket

@coinbase/agentkit-vercel-ai-sdk

Package Overview
Dependencies
Maintainers
0
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@coinbase/agentkit-vercel-ai-sdk

Vercel AI SDK extension of CDP Agentkit

0.1.0
latest
Source
npm
Version published
Weekly downloads
270
12.97%
Maintainers
0
Weekly downloads
Ā 
Created
Source

Coinbase Agentkit Extension - Vercel AI SDK

This package is an extension used to easily plug AgentKit into AI SDK by Vercel.

Installation

For a single command to install all necessary dependencies, run:

npm install @coinbase/agentkit-vercel-ai-sdk @coinbase/agentkit ai @ai-sdk/openai

To break it down, this package is:

npm install @coinbase/agentkit-vercel-ai-sdk

This package is used alongside AgentKit and AI SDK, so these will need to be installed as well.

npm install @coinbase/agentkit ai

Finally, install the model provider you want to use. For example, to use OpenAI, install the @ai-sdk/openai package. See here for a list of supported model providers.

npm install @ai-sdk/openai

Usage

The main export of this package is the getVercelAITools function. This function takes an AgentKit instance and returns an object containing the tools for the AgentKit agent. This object can then be passed to AI SDK.

Here's a snippet of code that shows how to use the getVercelAITools function to get the tools for the AgentKit agent.

chatbot.ts
import { getVercelAITools } from "@coinbase/agentkit-vercel-ai-sdk";
import { AgentKit } from "@coinbase/agentkit";
import { generateText } from "ai";
import { openai } from "@ai-sdk/openai";

// Get your Coinbase Developer Platform API key from the Portal: https://portal.cdp.coinbase.com/
// Or, check out one of the other supported wallet providers: https://github.com/coinbase/agentkit/tree/main/typescript/agentkit
const agentKit = await AgentKit.from({
  cdpApiKeyName: process.env.CDP_API_KEY_NAME,
  cdpApiKeyPrivateKey: process.env.CDP_API_KEY_PRIVATE_KEY,
});

const tools = await getVercelAITools(agentKit);

// There are multiple methods to generate text with AI SDK.
// See here for more information: https://sdk.vercel.ai/docs/ai-sdk-core/generating-text
const { text } = await generateText({
  model: openai("gpt-4o-mini"), // Make sure to have OPENAI_API_KEY set in your environment variables
  system: "You are an onchain AI assistant with access to a wallet.",
  prompt: "Print wallet details",
  tools,
  // Allow multi-step tool usage
  // See: https://sdk.vercel.ai/docs/foundations/agents#multi-step-tool-usage
  maxSteps: 10,
});

console.log(text);

For a full example, see the AgentKit AI SDK Chatbot Example.

Contributing

We welcome contributions of all kinds! Please see our Contributing Guide for detailed setup instructions and contribution guidelines.

Keywords

coinbase

FAQs

Package last updated on 07 Mar 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts