Skip to content

Commit 7eccd84

Browse files
committed
update
1 parent ff69765 commit 7eccd84

22 files changed

+59
-2763
lines changed

examples/coinbase-langchain/README.md

+16-49
Original file line numberDiff line numberDiff line change
@@ -18,55 +18,6 @@ A DeFi agent built using Langchain and powered by CDP SDK, operating over the XM
1818
- [Coinbase Developer Platform](https://portal.cdp.coinbase.com) (CDP) API credentials
1919
- Yarn package manager
2020

21-
## Quick Start Guide
22-
23-
Follow these steps to get your x agent up and running:
24-
25-
1. **Clone the repository**:
26-
27-
```bash
28-
git clone https://github.com/ephemeraHQ/xmtp-agent-examples.git
29-
cd examples/coinbase-langchain
30-
```
31-
32-
2. **Install dependencies**:
33-
34-
```bash
35-
yarn install
36-
```
37-
38-
3. **Set up your environment variables**:
39-
Create a `.env` file like in `.env.example`:
40-
41-
```bash
42-
WALLET_KEY= # the private key for the wallet
43-
ENCRYPTION_KEY= # the encryption key for the wallet
44-
# public key is
45-
46-
NETWORK_ID=base-sepolia # base-mainnet or others
47-
OPENAI_API_KEY= # the OpenAI API key
48-
CDP_API_KEY_NAME= # the name of the CDP API key
49-
CDP_API_KEY_PRIVATE_KEY= # the private key for the CDP API key
50-
XMTP_ENV=local # the environment to use for XMTP
51-
REDIS_URL= # the URL for the Redis database
52-
```
53-
54-
4. **Start the agent**:
55-
56-
```bash
57-
yarn dev
58-
```
59-
60-
5. **Interact with your agent**:
61-
62-
Once running, you'll see a URL in the console like:
63-
64-
```bash
65-
Send a message on http://xmtp.chat/dm/YOUR_AGENT_ADDRESS?env=dev
66-
```
67-
68-
Open this URL in your browser to start chatting with your agent!
69-
7021
## Usage Examples
7122

7223
Once the agent is running, you can interact with it using natural language commands:
@@ -103,3 +54,19 @@ This agent combines key technologies:
10354

10455
- System falls back to local storage if Redis fails
10556
- Check permissions and connection URLs
57+
58+
## Run the agent
59+
60+
```bash
61+
# git clone repo
62+
git clone https://github.com/ephemeraHQ/xmtp-agent-examples.git
63+
# go to the folder
64+
cd xmtp-agent-examples
65+
cd examples/coinbase-langchain
66+
# install packages
67+
yarn
68+
# generate random xmtp keys (optional)
69+
yarn gen:keys
70+
# run the example
71+
yarn dev
72+
```

examples/coinbase-langchain/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"@langchain/langgraph": "^0.2.24",
1717
"@langchain/openai": "^0.3.14",
1818
"@redis/client": "^1.6.0",
19-
"@xmtp/node-sdk": "1.0.0",
19+
"@xmtp/node-sdk": "1.0.2",
2020
"redis": "^4.7.0"
2121
},
2222
"devDependencies": {

examples/coinbase-langchain/src/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import "dotenv/config";
22
import type { Conversation, DecodedMessage } from "@xmtp/node-sdk";
33
import { getAddressOfMember } from "@/helpers";
44
import { initializeAgent, processMessage } from "./langchain";
5-
import { initializeStorage as initStorage } from "./storage";
5+
import { initializeStorage } from "./storage";
66
import type { XMTPUser } from "./types";
77
import { initializeXmtpClient, startMessageListener } from "./xmtp";
88

@@ -80,7 +80,7 @@ async function main(): Promise<void> {
8080
validateEnvironment();
8181

8282
// Initialize storage (Redis or local)
83-
await initStorage();
83+
await initializeStorage();
8484

8585
// Initialize XMTP client
8686
const xmtpClient = await initializeXmtpClient();

examples/coinbase-langchain/src/langchain.ts

-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ function createWalletTools(xmtpUser: XMTPUser) {
2626
schema: z.object({}),
2727
func: async () => {
2828
try {
29-
console.log(`Checking balance for fixed inboxId: ${xmtpUser.inboxId}`);
3029
const result = await walletService.checkBalance(xmtpUser.inboxId);
3130
if (!result.address) {
3231
return `No wallet found for user ${xmtpUser.inboxId}`;

examples/cointoss/README.md

-148
This file was deleted.

examples/cointoss/package.json

-32
This file was deleted.

0 commit comments

Comments
 (0)