Advanced features
Enhance the user experience and agent capabilities with these advanced features.
Loader Messages:
Display a sequence of messages while the agent is processing a request. Add this inside the <loomlay-chat> element:
timeout: Time in milliseconds before the next message in the sequence is shown.
Passing User Context:
Send additional, persistent context about the user with each message. This is useful for passing user IDs, wallet addresses, or other data for function calling or personalization. Add this inside the <loomlay-chat> element:
The content of <userContext> will be sent along with every message from the user.
Generating Interactive Elements (Links & Buttons):
Instruct your agent to generate responses containing special syntax to render hyperlinks and buttons in the terminal.
General Syntax:
Links: [link|action_type|value|label]
Buttons: [btn|action_type|value|label]
Action Types:
open-new: Opens the value (URL) in a new browser tab.
open-current: Opens the value (URL) in the current browser tab.
prompt: Sends the value (text) back to the agent as if the user typed it.
Examples:
Hyperlink (open in new tab): Agent response: Check this out: [link|open-new|https://google.com|Open Google] Renders as: A clickable link "Open Google" that opens google.com in a new tab.
Button (open in current tab): Agent response: Visit our site: [btn|open-current|https://loomlay.com|Visit Loomlay] Renders as: A button "Visit Loomlay" that navigates to loomlay.com in the current tab.
Button (prompt): Agent response: Would you like to: [btn|prompt|analyze wallet 0x123...|Analyze Wallet] Renders as: A button "Analyze Wallet". Clicking it sends "analyze wallet 0x123..." to the agent.
Generating EVM Transaction Buttons:
Allow users to initiate EVM-compatible (e.g., Ethereum, Polygon) transactions directly from the terminal using their self-custodial wallet like MetaMask.
Flow: 1. Your agent's workflow uses a plugin (e.g., Relay, Clanker, Enso) to prepare/generate the transaction details. 2. Upon successful transaction generation, the plugin outputs a unique transaction_key. 3. Instruct your agent to include this transaction_key in its response using the special button syntax.
Syntax:
[btn|transaction|transaction_key|Button Label]
Example: Agent response: To proceed, please [btn|transaction|0xGeneratedTxKey123abc|Confirm Swap] Renders as: A button "Confirm Swap". Clicking it will prompt the user to confirm and send the transaction using their connected EVM wallet.
Hidden Messages (Whispers):
Send information from the agent that is processed by the system or other integrations but is not visible to the user in the terminal. This is useful for passing transaction keys, internal state, or context that shouldn't clutter the user interface.
Syntax: Instruct the agent to include the hidden message between <whisper> and </whisper> tags in its response.
Example Agent Output: Do you want to confirm the swap? <whisper>transaction_key:0xGeneratedTxKey123abc;item_id:789</whisper> Please click the button below. [btn|transaction|0xGeneratedTxKey123abc|Confirm Swap]
User Sees in Terminal: Do you want to confirm the swap? Please click the button below. (Followed by the "Confirm Swap" transaction button)
The content within <whisper>...</whisper> is not displayed via Terminal but is visible to the agent.
Last updated