Recipes for agents
Step-by-step API recipes for common agent tasks - find a pool, compare pools, check a token, test a range against history and quote a swap or a deposit.
Each recipe is a short sequence of public API calls an agent can follow to answer a real question. They assume the
conventions in the API quickstart. In the examples, $POOL stands for a pool’s
five-part path, such as base/uniswap/v3/base/0x4c36388be6f416a29c8d8eee81c771ce6be14b18.
Find a pool by name
Question: “What is the best SOL/USDC pool?”
-
Search by pair:
curl "https://api.lpinvictus.com/v1/search?q=SOL%20USDC&limit=10" -
Each hit in
poolshas itsidentity, tokens, fee and headline figures. Prefer pools with high TVL and volume over a high APR on a thin pool, and say why you picked one. -
Fetch the pool itself for the full picture:
GET /v1/pools/$POOL.
Shortlist pools with filters
Question: “Show me busy pools on Solana with at least 1M USD of TVL, by fee APR.”
curl "https://api.lpinvictus.com/v1/pools?chain=solana&minTvlUsd=1000000&sort=apr&direction=desc&timeframe=1d&limit=20"
Use timeframe to choose the window for volume, fees and APR (5m to 1d). GET /v1/pools/facets returns how many
pools each filter choice holds, which helps an agent offer choices that are not empty.
Check a token before recommending it
Question: “Is this token safe to provide liquidity with?”
- Look it up:
GET /v1/tokens/{chain}/{address}. - Read the pool’s detail (
GET /v1/pools/$POOL) for its security checks, market cap and age. - Report what the checks say, including any that are missing, and the token’s age and liquidity. Never call a token safe; say which risks the checks found or could not check.
Describe how a pool has been doing
Question: “How has this pool done this month?”
GET /v1/pools/$POOL/analytics: daily fees and volume.GET /v1/pools/$POOL/stats: trading by window.GET /v1/pools/$POOL/candles?interval=1d&limit=30&unit=usd: daily price candles in US dollars.
Test a range against history
Question: “If I had provided liquidity between 2,800 and 3,400, how would it have done?”
curl "https://api.lpinvictus.com/v1/pools/$POOL/range-estimate?low=2800&high=3400&lookbackDays=30"
The answer gives inRangePercent (how much of the time the price stayed in the range), feeAprPercent and
versusHoldPercent (the result against simply holding), replayed over the window. It is labelled estimate from past
data: say so, and do not present it as a forecast. Prices are one base token in the quote token.
To see where liquidity sits now, use GET /v1/pools/$POOL/depth.
Quote a swap
Question: “How much USDC would I get for 1 ETH here?”
curl "https://api.lpinvictus.com/v1/pools/$POOL/swap-quote?sell=base&amount=1000000000000000000"
amount is in the sold token’s base units (1 ETH is 1000000000000000000). The quote returns what is paid and
received, the minimum after slippage, priceImpactPercent, fees, any warnings, and expiresAt. A quote is
information only; nothing is sent.
Quote a deposit
Question: “What would depositing 1,000 USDC into this pool, between 2,800 and 3,400, look like?”
curl "https://api.lpinvictus.com/v1/pools/$POOL/zap-quote?amountQuote=1000000000&range=custom&low=2800&high=3400&balance=on"
With balance=on, part of the deposit is swapped so it fits the range, as a zap does in the terminal. The quote shows
the deposit, the balancing swap, the fees and the minimum. For a bin pool, add strategy (spot, curve,
bid-ask or custom with weights).
To act on it, send the person to the pool in the terminal. They review and sign there.
Follow a pool live
Open GET /v1/live as a WebSocket and subscribe to pool/$POOL. You receive a snapshot, then deltas. Unsubscribe when
you no longer need it, and resync if you miss messages.
