What the Agent Will Do
- Connect to the Exit Intelligence Stream to begin monitoring.
- Buy a token by building and submitting a transaction through the REST API.
- Monitor the position automatically via the stream (PnL updates, price tracking).
- Exit when strategy conditions are met (target profit, stop loss, trailing stop, or deadline).
Prerequisites
- A LaserSell API key (get one here).
- A Solana keypair (JSON byte array file).
- Python 3.10+ with the LaserSell SDK installed.
Architecture
Your agent owns the decisions. LaserSell owns the execution. The boundary between them is clean: the agent sends requests and receives events. All transactions are unsigned and signed locally by the agent.Step 1: Connect the Exit Intelligence Stream
The stream must be connected before the agent buys. The stream detects positions by watching for on-chain token arrivals in real time. If the buy lands before the stream is connected, the position will not be tracked.
Your agent can adjust these dynamically based on its own logic. See Strategy Configuration.
Step 2: Build and Submit a Buy
Once the stream is connected, the agent can buy a token. The REST API builds an unsigned transaction that the agent signs locally and submits.Step 3: Monitor and Exit Automatically
After the buy lands on-chain, the Exit Intelligence Stream detects the new token balance and begins tracking the position. The agent listens for events and acts on exit signals.Step 4: Update Strategy Mid-Session
Your agent can adjust strategy parameters at any time based on its own logic. For example, tightening the trailing stop after a position is profitable, or disabling the deadline if the agent decides to hold longer.Full Working Example
Here is the complete agent loop combining all steps:Extending This Pattern
This guide shows a single buy-and-exit cycle. A production agent would build on this foundation: Signal integration. The agent receives buy signals from any source: user prompts, on-chain analysis, social feeds, copy-trading leaders, or another AI model. The signal determines when to callbuild_buy_tx.
Multi-position management. The stream tracks multiple positions simultaneously across one or more wallets. An agent can manage a portfolio of active positions, each with its own entry logic, while LaserSell evaluates exit conditions on all of them in parallel.
Dynamic strategy. Use update_strategy to adjust parameters based on market conditions, position performance, or agent confidence. An agent that detects high volatility might tighten stops. One that detects a strong trend might widen them.
Risk controls. Enforce position sizing, maximum concurrent positions, daily loss limits, or any other risk rules in your agent’s decision layer before calling the API.
MCP integration. If your agent runs inside an MCP-compatible client like OpenClaw, Claude, Cursor, or another AI assistant, it can use the LaserSell MCP server to look up documentation, API schemas, and code examples in real time while building or debugging the integration.
Next Steps
- API Overview for the full API surface.
- Exit Intelligence Stream for the stream protocol deep dive.
- Strategy Configuration for all strategy parameters.
- Transaction Signing for signing and submission details.
- MCP Server to give your AI agent access to LaserSell documentation.

