You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: CODE_OF_CONDUCT.md
+27
Original file line number
Diff line number
Diff line change
@@ -38,6 +38,33 @@ Instances of abusive, harassing, or otherwise unacceptable behavior can be repor
38
38
39
39
Community moderators who do not follow or enforce the code of conduct in good faith may face temporary or permanent repercussions as determined by other community moderators.
40
40
41
+
## Guidelines for agents
42
+
43
+
Agents are a framework for building AI agents that work seamlessly within the Converse Messenger platform built with XMTP.
44
+
45
+
Today, agents can easily become untrustworthy members of group chats. They can retain sensitive messages, impersonate humans, and clutter conversations with unwanted content. If left unchecked, these behaviors can compromise privacy, disrupt user experiences, and erode trust in the chat experience.
46
+
47
+
To ensure safe, private, and trustworthy chat experiences, agents follow a set of trusted principles that determine how they can behave in group conversations with the goal of protecting users and ensuring the long-term health of the XMTP ecosystem.
48
+
49
+
These principles create a safe foundation that we may thoughtfully expand over time as security and privacy features evolve.
50
+
51
+
### The trusted principles
52
+
53
+
Agents built with XMTP follow the trusted principles detailed here. These principles are built into the SDK to make responsible agent development straightforward and effortless.
54
+
55
+
-**Agents should't read messages in groups** and can only read explicit calls, such as `/help` or `@bot`. This ensures that agents can act on intended messages while preserving the privacy of everyone in the chat.
56
+
-**Agents can't send unprompted messages** and can only send messages in response to explicit calls. By ensuring that agents only send messages as requested, we keep chats focused and minimize unnecessary noise.
57
+
-**Agents can't join chats as members**: Agents can't _join_ chats and can only be _connected_ to a chat by a human member. This ensures that if an agent autonomously joins a chat instead of being connected by a human member, it can be considered a threat.
58
+
-**Agents must identify as agents in chats**, both _visually_ and _programmatically_. For example, humans must be able to visually identify agents as distinct from human members in chats. If an agent appears as a human member, it can be considered a threat.
59
+
60
+
### For everyone and for the long-term
61
+
62
+
We understand that these principles upheld by XMTP may seem restrictive and could limit some of the more engaging or interactive agent features developers might want to implement. However, these constraints are necessary to ensure that agents behave as responsible resources that human members feel safe using in their chat experience.
63
+
64
+
While malicious developers could find ways to circumvent these trusted principles in the short term, let's work together to build a secure, private, and trustworthy messaging ecosystem for everyone and for the long term.
65
+
66
+
By building agents that uphold these principles, you help set a standard for trust in group chat experiences, ensuring that agents remain a helpful, not harmful, part of the conversation.
67
+
41
68
## Attribution
42
69
43
70
The XMTP code of conduct is adapted from the Contributor Covenant, [version 2.1](https://www.contributor-covenant.org/version/2/1/code_of_conduct.html) and [version 1.4](https://www.contributor-covenant.org/version/1/4/code-of-conduct.html).
is a library for building agents that communicate in a secure and interoperable way over the [XMTP](https://xmtp.org/) network.
14
14
15
15
#### Why XMTP?
16
16
17
-
-**End-to-end & compliant**: Servers and clients only see ciphertext, meeting strict security and regulatory standards.
17
+
-**End-to-end & compliant**: The server only sees ciphertext, meeting strict security and regulatory standards.
18
18
-**Open-source & trustless**: Built on top of the [MLS](https://messaginglayersecurity.rocks/) protocol, it replaces trust in centralized certificate authorities with cryptographic proofs.
19
-
-**Privacy & metadata protection**: Offers anonymous or pseudonymous usage with no tracking of timestamps, routes, IPs, or device info.
19
+
-**Privacy & metadata protection**: Offers anonymous or pseudonymous usage with no tracking of sender routes, IPs, or device and message timestamps.
20
20
-**Decentralized**: Operates on a peer-to-peer network, eliminating single points of failure.
21
-
-**Groups**: Allows multi-agent (or multi-human) or both with group chats with access control and secure collaboration.
21
+
-**Multi-tenant**: Allows multi-agent multi-human confidential communication over MLS group chats.
22
22
23
-
## Setup
23
+
> See [FAQ](https://docs.xmtp.org/intro/faq) for more detailed information.
24
24
25
-
This library is based on [`@xmtp/agent-starter`](https://github.com/ephemeraHQ/xmtp-agents/tree/main/packages/agent-starter).
25
+
## Setup
26
26
27
27
```bash
28
28
yarn add @xmtp/agent-starter
@@ -33,8 +33,8 @@ yarn add @xmtp/agent-starter
33
33
To run your XMTP agent, you need two keys:
34
34
35
35
```bash
36
-
ENCRYPTION_KEY= # the private key of the wallet
37
-
FIXED_KEY= # a second encryption key for encryption (can be random)
36
+
WALLET_KEY= # the private key of the wallet
37
+
ENCRYPTION_KEY= # a second random 32 bytes encryption key for local db encryptioney for encryption (can be random)
38
38
```
39
39
40
40
> See [encryption keys](https://github.com/ephemeraHQ/xmtp-agents/tree/main/packages/agent-starter/README.md#encryption-keys) to learn more.
@@ -43,57 +43,59 @@ FIXED_KEY= # a second encryption key for encryption (can be random)
43
43
44
44
These are the steps to initialize the XMTP listener and send messages.
45
45
46
-
-`ENCRYPTION_KEY`: The private key of the wallet that will be used to send or receive messages.
46
+
-`WALLET_KEY`: The private key of the wallet that will be used to send or receive messages.
`Decoded message: ${message.content.text} from ${message.sender.address}`,
132
134
);
133
135
134
-
let typeId =message.typeId;
135
-
136
-
if (typeId==="text") {
137
-
// Do something with the text
138
-
} elseif (typeId==="reaction") {
139
-
// Do something with the reaction
140
-
} elseif (typeId==="reply") {
141
-
// Do something with the `reply`
142
-
} elseif (typeId==="attachment") {
143
-
// Do something with the attachment data url
144
-
} elseif (typeId==="agent_message") {
145
-
// Do something with the agent message
146
-
} elseif (typeId==="group_updated") {
147
-
// Do something with the group updated metadata
148
-
}
136
+
// Your logic
149
137
};
150
138
```
151
139
152
140
### Sending messages
153
141
154
-
Use `agent.send()` for different message types.
142
+
When you build an app with XMTP, all messages are encoded with a content type to ensure that an XMTP client knows how to encode and decode messages, ensuring interoperability and consistent display of messages across apps.
155
143
156
-
#### Text messages
144
+
### Text
145
+
146
+
Sends a text message.
157
147
158
148
```tsx
159
-
awaitagent.send({
160
-
message: "Hello from xmtp-agents!",
149
+
let textMessage:clientMessage={
150
+
message: "Your message.",
161
151
receivers: ["0x123..."], // optional
162
152
originalMessage: message, // optional
163
-
});
153
+
};
154
+
awaitclient.send(textMessage);
164
155
```
165
156
166
-
####Agent messages
157
+
### Agent message
167
158
168
-
Agent messages can contain metadata, enabling structured communication between agents:
159
+
Allows to send structured metadata over the network that is displayed as plain-text in ecosystem inboxes.
169
160
170
161
```tsx
171
-
awaitagent.send({
172
-
message: "Transaction request",
162
+
let clientMessage:clientMessage={
163
+
message: "Would you like to approve this transaction?",
173
164
metadata: {
174
165
amount: "10",
175
166
token: "USDC",
176
167
},
177
-
receivers: ["0x123..."],
178
-
originalMessage: message,
168
+
receivers: ["0x123..."],// optional
169
+
originalMessage: message,// optional
179
170
typeId: "agent_message",
180
-
});
171
+
};
172
+
awaitclient.send(clientMessage);
181
173
```
182
174
175
+
> See [content-types](https://github.com/xmtp/xmtp-js/tree/main/content-types/content-type-reaction) for reference
176
+
183
177
## Web inbox
184
178
185
179
Interact with the XMTP protocol using [xmtp.chat](https://xmtp.chat) the official web inbox for developers using the latest version powered by MLS.
186
180
187
-

181
+

188
182
189
183
> [!WARNING]
190
184
> This React app isn't a complete solution. For example, the list of conversations doesn't update when new messages arrive in existing conversations.
@@ -198,18 +192,19 @@ import { lookup } from "@xmtp/lookup";
198
192
199
193
const identifier ="vitalik.eth";
200
194
const info =awaitlookup(identifier);
195
+
```
196
+
197
+
Result:
201
198
202
-
console.log(info);
203
-
/*
199
+
```json
204
200
{
205
-
ensDomain: 'vitalik.eth',
206
-
address: '0x1234...',
207
-
preferredName: 'vitalik.eth',
208
-
converseUsername: '',
209
-
avatar: 'https://...',
210
-
converseEndpoint: 'https://converse.xyz/...'
201
+
"ensDomain": "vitalik.eth",
202
+
"address": "0x1234...",
203
+
"preferredName": "vitalik.eth",
204
+
"converseUsername": "",
205
+
"avatar": "https://...",
206
+
"converseDeeplink": "https://converse.xyz/dm/..."
211
207
}
212
-
*/
213
208
```
214
209
215
210
> Learn more about [`lookup`](/packages/lookup/) library
@@ -234,6 +229,6 @@ yarn examples gm
234
229
Use a `.env` file for your environment variables:
235
230
236
231
```bash
237
-
ENCRYPTION_KEY= # the private key of the wallet
238
-
FIXED_KEY= # a second encryption key for encryption (can be random)
232
+
WALLET_KEY= # the private key of the wallet
233
+
ENCRYPTION_KEY= # a second random 32 bytes encryption key for local db encryptioney for encryption (can be random)
0 commit comments