GOAT
GOAT is the finance toolkit for AI agents.
danger
This tool exists outside of the main LangChain repository here. Please use caution when linking wallets to external providers and make sure they are trusted.
Overview
Create agents that can:
- Send and receive payments
- Purchase physical and digital goods and services
- Engage in various investment strategies:
- Earn yield
- Bet on prediction markets
- Purchase crypto assets
- Tokenize any asset
- Get financial insights
How it works
GOAT leverages blockchains, cryptocurrencies (such as stablecoins), and wallets as the infrastructure to enable agents to become economic actors:
- Give your agent a wallet
- Allow it to transact anywhere
- Use more than +200 tools
See everything GOAT supports here.
Lightweight and extendable Different from other toolkits, GOAT is designed to be lightweight and extendable by keeping its core minimal and allowing you to install only the tools you need.
If you don't find what you need on our more than 200 integrations you can easily:
- Create your own plugin
- Integrate a new chain
- Integrate a new wallet
- Integrate a new agent framework
See how to do it here.
Setup
- Install the core package and langchain adapter:
npm i @goat-sdk/core @goat-sdk/adapter-langchain
- Install the type of wallet you want to use (e.g solana):
npm i @goat-sdk/wallet-evm @goat-sdk/wallet-viem
- Install the plugins you want to use in that chain:
npm i @goat-sdk/plugin-erc20
Instantiation
Now we can instantiate our toolkit:
import { http } from "viem";
import { createWalletClient } from "viem";
import { privateKeyToAccount } from "viem/accounts";
import { baseSepolia } from "viem/chains";
import { getOnChainTools } from "@goat-sdk/adapter-langchain";
import { PEPE, USDC, erc20 } from "@goat-sdk/plugin-erc20";
import { sendETH } from "@goat-sdk/wallet-evm";
import { viem } from "@goat-sdk/wallet-viem";
import { ChatOpenAI } from "@langchain/openai";
import { createReactAgent } from "@langchain/langgraph/prebuilt";
// 1. Create a wallet client
const account = privateKeyToAccount(
process.env.WALLET_PRIVATE_KEY as `0x${string}`
);
const walletClient = createWalletClient({
account: account,
transport: http(process.env.RPC_PROVIDER_URL),
chain: baseSepolia,
});
// 2. Set up the tools
const tools = await getOnChainTools({
wallet: viem(walletClient),
plugins: [sendETH(), erc20({ tokens: [USDC, PEPE] })],
});
// 3. Create the agent
const model = new ChatOpenAI({
model: "gpt-4o",
});
const agent = createReactAgent({ llm: model, tools: tools });
Related
- Tool conceptual guide
- Tool how-to guides