@coinbase/agentkit-langchain
TypeScript icon, indicating that this package has built-in type declarations

0.3.0 • Public • Published

Agentkit Extension - LangChain

LangChain extension of AgentKit. Enables agentic workflows to interact with onchain actions.

Setup

Prerequisites

Installation

npm install @coinbase/agentkit-langchain @coinbase/agentkit @langchain @langchain/langgraph @langchain/openai

Environment Setup

Set the following environment variables:

export OPENAI_API_KEY=<your-openai-api-key>

Usage

Basic Setup

import { getLangChainTools } from "@coinbase/agentkit-langchain";
import { createReactAgent } from "@langchain/langgraph/prebuilt";
import { ChatOpenAI } from "@langchain/openai";
import { AgentKit } from "@coinbase/agentkit";

const agentKit = await AgentKit.from({
  cdpApiKeyName: "CDP API KEY NAME",
  cdpApiKeyPrivateKey: "CDP API KEY PRIVATE KEY",
});

const tools = await getLangChainTools(agentKit);

const llm = new ChatOpenAI({
    model: "gpt-4o-mini",
});

const agent = createReactAgent({
    llm,
    tools,
});

Contributing

See CONTRIBUTING.md for detailed setup instructions and contribution guidelines.

Package Sidebar

Install

npm i @coinbase/agentkit-langchain

Weekly Downloads

1,177

Version

0.3.0

License

Apache-2.0

Unpacked Size

3.95 kB

Total Files

4

Last publish

Collaborators

  • coinbase-owner
  • coinbase-npm