Coinbase Agentkit LangChain Documentation

AgentKit LangChain Extension

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

Setup

Prerequisites

Installation

pip install coinbase-agentkit coinbase-agentkit-langchain

Environment Setup

Set the following environment variables:

export OPENAI_API_KEY=<your-openai-api-key>
export CDP_API_KEY_NAME=<your-cdp-api-key-name>
export CDP_API_KEY_PRIVATE=<your-cdp-api-key-private>

Usage

Basic Setup

from coinbase_agentkit import AgentKit
from coinbase_agentkit_langchain import get_langchain_tools

agentKit = AgentKit()

tools = get_langchain_tools(agentKit)

llm = ChatOpenAI(model="gpt-4o-mini")

agent = create_react_agent(
    llm=llm,
    tools=tools,
)

For AgentKit configuration options, see the Coinbase Agentkit README.

For a full example, see the chatbot example.

Contributing

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