Skip to main content

GOAT

GOAT 是面向 AI 代理的金融工具包。

¥GOAT is the finance toolkit for AI agents.

danger

此工具存在于主 LangChain 代码库 此处 之外。将钱包链接到外部提供商时请务必谨慎,并确保它们是可信的。

¥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 利用区块链、加密货币(例如稳定币)和钱包作为基础设施,使代理能够成为经济参与者:

¥GOAT leverages blockchains, cryptocurrencies (such as stablecoins), and wallets as the infrastructure to enable agents to become economic actors:

  1. 为你的代理提供一个 wallet

    ¥Give your agent a wallet

  2. 允许其处理 anywhere

    ¥Allow it to transact anywhere

  3. 使用超过 +200 个工具

    ¥Use more than +200 tools

查看 GOAT 支持的所有内容。

¥See everything GOAT supports here.

轻量级且可扩展 与其他工具包不同,GOAT 旨在保持其核心精简,并允许你只安装所需的工具,从而实现轻量级和可扩展性。

¥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.

如果你在我们超过 200 个集成中找不到所需内容,你可以轻松执行以下操作:

¥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

  1. 安装核心包和 langchain 适配器:

    ¥Install the core package and langchain adapter:

npm i @goat-sdk/core @goat-sdk/adapter-langchain
  1. 安装你想要使用的钱包类型(例如 solana):

    ¥Install the type of wallet you want to use (e.g solana):

npm i @goat-sdk/wallet-evm @goat-sdk/wallet-viem
  1. 安装你想在该链中使用的插件:

    ¥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