npm.io
0.3.0 • Published 1 year ago

@coinbase/agentkit-langchain

Licence
Apache-2.0
Version
0.3.0
Deps
2
Size
4 kB
Vulns
0
Weekly
0
Stars
1.3K

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.

Keywords