Building Your First Agent: A Beginner's Guide
Deploying your first autonomous agent sounds intimidating. It's not. In 15 minutes, you'll have an agent monitoring real-time market data, identifying arbitrage opportunities, and executing trades. Here's exactly how.
What You'll Build
A basic agent that:
- Connects to KicksDB's Unified API
- Monitors price differences between StockX and GOAT
- Alerts you when arbitrage opportunities > 5% appear
- Automatically lists inventory on the higher-priced platform
By the end, you'll have a data-driven system running 24/7. No manual spreadsheet checking. No missed opportunities.
Step 1: Set Up Your KicksDB API Key
First, you need access to live market data. Go to kicks.dev/register and sign up for a free account. Free tier gives you:
- 1,000 Standard API requests/month (product metadata, pricing)
- Access to Unified API (cross-platform matching)
- Historical data (sales history from past 90 days)
Save your API key. You'll need it in the next step.
Step 2: Connect to ReVault Agent Framework
ReVault provides a pre-built agent framework that handles the heavy lifting. Here's your first agent in ~30 lines of code:
const KicksDBClient = require('@kicksdb/sdk');
const ReVaultAgent = require('@revault/agent');
// Initialize
const kicks = new KicksDBClient({
apiKey: process.env.KICKSDB_API_KEY
});
const agent = new ReVaultAgent({
name: 'Arbitrage Monitor',
kicksdb: kicks,
platforms: ['stockx', 'goat'],
minSpread: 0.05 // 5% minimum
});
// Monitor for opportunities
agent.onPriceDifference((opportunity) => {
console.log(
`📊 ${opportunity.shoe}: Buy on ${opportunity.buyPlatform} @ $${opportunity.buyPrice}, sell on ${opportunity.sellPlatform} @ $${opportunity.sellPrice}`
);
// Auto-execute if spread > 7%
if (opportunity.spread > 0.07) {
agent.executeTrade(opportunity);
}
});
agent.start();That's it. This agent now:
- Calls KicksDB's Unified API every 30 seconds
- Compares StockX vs GOAT prices for all available inventory
- Triggers alerts when spread > 5%
- Auto-executes trades when spread > 7% (you can adjust thresholds)
Step 3: Understanding the Data Flow
KicksDB gives your agent three API layers:
Standard API
Product metadata from single platforms. Use this to build a catalog of all available shoes.
GET /products/stockx?query=jordan-1-retro-high
Unified API
Cross-platform matching. Returns the same shoe with prices from all platforms simultaneously. This is where arbitrage opportunities live.
GET /unified/shoes?id=jordan-1-chicago
Real-Time API (WebSocket)
Live price updates with sub-100ms latency. For detecting demand shocks and inventory drops in real-time.
WS: wss://realtime.kicks.dev/prices
Your beginner agent only needs the Unified API (every 30s). As you scale, you'll add WebSocket listeners for sub-second reaction times.
Step 4: Add Inventory Management
A smart agent doesn't just spot opportunities—it tracks inventory to avoid overstocking. Add this:
agent.onTrade(async (trade) => {
// Update inventory
agent.inventory.deduct(trade.shoe, trade.quantity, 'stockx');
agent.inventory.add(trade.shoe, trade.quantity, 'goat');
// Log to KicksDB for analytics
await kicks.trades.log({
shoe: trade.shoe,
boughtOn: 'stockx',
soldOn: 'goat',
quantity: trade.quantity,
profit: trade.profit,
executedAt: new Date()
});
// Alert if inventory skewed
if (agent.inventory.balance(trade.shoe) > 50) {
console.warn('⚠️ Over-concentrated in ' + trade.shoe);
}
});This ensures you don't get stuck holding inventory when the market corrects. You're constantly rotating: buy low, sell high, repeat.
Step 5: Add Risk Controls
A runaway agent can cost you money. Add guardrails:
const agent = new ReVaultAgent({
name: 'Arbitrage Monitor',
kicksdb: kicks,
// Risk management
maxTradesPerHour: 10,
maxExposurePerShoe: 5000, // $5K per SKU
maxTotalExposure: 50000, // $50K total
minProfitPerTrade: 20, // $20 minimum profit
// Halt if losing money
haltIfLosses: true,
lossThreshold: 500 // Stop if down $500 in a day
});These limits prevent the agent from making catastrophic mistakes. It forces discipline: every trade must be profitable or it doesn't execute.
Step 6: Deploy on ReVault
Push your agent code to ReVault's hosting:
# Deploy agent revault deploy --name arbitrage-bot --runtime node # Agent is now running 24/7 # Monitor via dashboard at revault.app/agents/arbitrage-bot
Your agent is now:
- Running on ReVault's infrastructure (100% uptime SLA)
- Connected to live KicksDB data
- Executing trades 24/7 while you sleep
- Logging all activity to your dashboard
Step 7: Monitor & Iterate
Check your dashboard daily. Look for:
- Profit per trade - Should be increasing as the agent learns
- Trades per day - More consistent opportunities = market is inefficient
- Win rate - Should be > 85%. If lower, tighten spread requirements
- Inventory health - Balanced across platforms, no stale inventory
After 1-2 weeks of data, you'll see patterns. Maybe Mondays have higher spreads. Maybe certain shoe categories are more volatile. Use this to refine:
- Adjust min spread by category (high-volatility shoes can use lower spreads)
- Add category filters (focus on the 50 highest-volume shoes)
- Increase trade limits if consistently profitable
Real Results
Operators running agents for 30+ days report:
- Week 1: 0.5-1% daily return (learning phase)
- Week 2-3: 1-2% daily return (patterns emerge)
- Week 4+: 1-3% daily return (consistently profitable)
On a $10K inventory, that's $100-300/day or $3-9K/month. Not life-changing, but pure profit from market inefficiency.
Next Steps
Now that you have a basic agent:
- Add WebSocket listeners - React to demand shocks in real-time
- Integrate geography - Monitor GOAT Asia, Flight Club EU separately
- Add predictive pricing - Use KicksDB's sales history to forecast where prices are going
- Scale inventory - Gradually increase capital allocation as you prove consistency
The market rewards operators who systematize. Your agent is the beginning of that system.