@coinbase/agentkit-langchain

Agentkit Extension - LangChain

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

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

Set the following environment variables:

export OPENAI_API_KEY=<your-openai-api-key>
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,
});

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