|
2 | 2 |
|
3 | 3 | [](https://github.com/huggingface/smolagents/releases)
|
4 | 4 | [](https://github.com/ephemerahq/xmtp-agents/blob/main/LICENSE)
|
5 |
| -[](https://github.com/ephemerahq/message-kit) |
6 | 5 |
|
7 | 6 | <img src="media/logo.png" alt="Logo" width="60" />
|
8 | 7 |
|
9 | 8 | # xmtp-agents
|
10 | 9 |
|
11 | 10 | </div>
|
12 | 11 |
|
13 |
| -`xmtp-agents` is a library for building secure, and interoperable agents that use the [XMTP](https://xmtp.org/) protocol. |
| 12 | +[`@xmtp/agent-starter`](https://github.com/ephemeraHQ/xmtp-agents/tree/main/packages/agent-starter). |
| 13 | +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
|
@@ -74,7 +74,7 @@ main().catch(console.error);
|
74 | 74 |
|
75 | 75 | #### Address availability
|
76 | 76 |
|
77 |
| -Returns `true` if an address has XMTP enabled |
| 77 | +Returns `true` if an address is reachable on the xmtp network |
78 | 78 |
|
79 | 79 | ```typescript
|
80 | 80 | const isOnXMTP = await agent.canMessage(address);
|
@@ -115,7 +115,7 @@ await group.sync();
|
115 | 115 | await group.addMembers([0xaddresses]);
|
116 | 116 | ```
|
117 | 117 |
|
118 |
| -> To learn more about groups, read the [XMTP documentation](https://docs.agent.org/inboxes/group-permissions). |
| 118 | +> To learn more about groups, read the [XMTP documentation](https://docs.xmtp.org). |
119 | 119 |
|
120 | 120 | ## Message handling
|
121 | 121 |
|
@@ -151,35 +151,41 @@ const onMessage = async (message: Message) => {
|
151 | 151 |
|
152 | 152 | ### Sending messages
|
153 | 153 |
|
154 |
| -Use `agent.send()` for different message types. |
| 154 | +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 | 155 |
|
156 |
| -#### Text messages |
| 156 | +### Text |
| 157 | + |
| 158 | +Sends a text message. |
157 | 159 |
|
158 | 160 | ```tsx
|
159 |
| -await agent.send({ |
160 |
| - message: "Hello from xmtp-agents!", |
| 161 | +let textMessage: agentMessage = { |
| 162 | + message: "Your message.", |
161 | 163 | receivers: ["0x123..."], // optional
|
162 | 164 | originalMessage: message, // optional
|
163 |
| -}); |
| 165 | +}; |
| 166 | +await agent.send(textMessage); |
164 | 167 | ```
|
165 | 168 |
|
166 |
| -#### Agent messages |
| 169 | +### Agent message |
167 | 170 |
|
168 |
| -Agent messages can contain metadata, enabling structured communication between agents: |
| 171 | +Allows to send structured metadata over the network that is displayed as plain-text in ecosystem inboxes. |
169 | 172 |
|
170 | 173 | ```tsx
|
171 |
| -await agent.send({ |
172 |
| - message: "Transaction request", |
| 174 | +let agentMessage: agentMessage = { |
| 175 | + message: "Would you like to approve this transaction?", |
173 | 176 | metadata: {
|
174 | 177 | amount: "10",
|
175 | 178 | token: "USDC",
|
176 | 179 | },
|
177 |
| - receivers: ["0x123..."], |
178 |
| - originalMessage: message, |
| 180 | + receivers: ["0x123..."], // optional |
| 181 | + originalMessage: message, // optional |
179 | 182 | typeId: "agent_message",
|
180 |
| -}); |
| 183 | +}; |
| 184 | +await agent.send(agentMessage); |
181 | 185 | ```
|
182 | 186 |
|
| 187 | +> See [content-types](https://github.com/xmtp/xmtp-js/tree/main/content-types/content-type-reaction) for reference |
| 188 | +
|
183 | 189 | ## Web inbox
|
184 | 190 |
|
185 | 191 | Interact with the XMTP protocol using [xmtp.chat](https://xmtp.chat) the official web inbox for developers using the latest version powered by MLS.
|
|
0 commit comments