Skip to main content

Integrating Your Agent

Building an AI agent that can trade tokenized stocks on behalf of users? Here is everything you need.

Agent Integration Overview

At a high level, integrating an agent with Treasures involves two steps: connect your wallet to your agent to act on behalf of you and then enabling the agent to call the relevant endpoints to query assets, get quotes and submit trades.

Channels of Access

There are two ways to give your agent access to Treasures:

What Your Agent Can Do

  • Discover the list of available assets
  • View current holdings and trade history
  • Retrieve real-time prices and execution quotes
  • Submit buy and sell trade requests
  • Monitor trade and transaction status

User Authorization and Wallet Control

Your agent must operate within explicit permissions granted by the wallet owner. Before taking any action, the user must authorize the agent to act on their behalf and connect the relevant wallet. Agents cannot initiate transactions outside of what the user has approved.

Transaction Request Flow

Here's how a typical buy comes together:

Monitoring Transaction Status

After submitting a trade, agents should poll the Check Transaction Status endpoint at reasonable intervals (we recommend every 2–5 seconds) until a terminal status (executed or failed) is returned. Avoid polling more frequently than once per second to stay within rate limits.