Agent Developer
1 / 5

Start building on Specular

Give your AI agent access to onchain credit. Connect a wallet, register, and start borrowing.

Get started in ~2 minutes
Connect your agent's wallet
Your agent needs its own wallet on Base — separate from your personal wallet. Choose how to set it up.
I have a wallet
Use an existing wallet's private key. Works with any EVM wallet on Base.
Generate a new wallet
We'll create a fresh wallet for your agent. One command, takes 2 seconds.
Set up with your wallet
Export the private key from your wallet and save it as an environment variable. Then install the SDK and register.
export AGENT_KEY=0x_your_private_key_here
Never commit private keys to git. Use a .env file or secrets manager.
npm install @specular/sdk
import { Specular } from '@specular/sdk'; const spec = new Specular({ privateKey: process.env.AGENT_KEY, network: 'base-sepolia' }); const agent = await spec.register(); console.log('Agent created:', agent.address);
Generate a new agent wallet
Run these commands to create a fresh wallet, install the SDK, and register your agent on testnet.
npx @specular/sdk generate-wallet
This outputs an address and private key. Save the private key securely — you'll need it next.
export AGENT_KEY=0x_key_from_step_1
npm install @specular/sdk
import { Specular } from '@specular/sdk'; const spec = new Specular({ privateKey: process.env.AGENT_KEY, network: 'base-sepolia' }); const agent = await spec.register(); console.log('Agent created:', agent.address);
Your agent is live on testnet
You have an onchain identity, and you're ready to post collateral, borrow USDC, and start building reputation. Follow the full walkthrough for the complete loop.
Looking for something else?
I'm building an AI agent
Give your agent access to onchain credit. Borrow USDC, execute strategies, and build reputation — all programmatically.
I want to earn yield
Supply USDC to the lending pool and earn interest from agent loan repayments. Passive yield backed by collateral.
I'm exploring the protocol
Understand how onchain reputation, credit scoring, and agent-native lending work under the hood.
I need help launching an agent
You have an idea but need guidance on architecture, wallet setup, strategy design, and going live.
Agent Developer
Get your agent borrowing in under 10 minutes.
You'll install the SDK, register an identity, post collateral, and make your first borrow. By the end, your agent will have onchain credit history.
~10 minutes
Node.js 18+ Ethereum wallet + private key Collateral assets on Base (wstETH, USDC, etc.) ~$0.50 ETH for gas
1
Install the SDK
The SDK handles wallet management, transaction signing, and all contract interactions.
npm install @specular/sdk
Requires Node.js 18+ and an Ethereum wallet with a private key. Works with ethers.js v5 and v6.
2
Register your agent's identity
This creates your agent's onchain record in the AgentRegistry. It's your agent's permanent identity — reputation, credit history, and borrowing terms all tie back to it.
import { Specular } from '@specular/sdk'; const spec = new Specular({ privateKey: process.env.AGENT_KEY, network: 'base-sepolia' // start on testnet }); const agent = await spec.register(); // → { address: '0xA3f…', id: 42, score: 500 }
3
Deposit collateral
Post a basket of tokenized assets as collateral. New agents start at 200% collateral ratio. As you repay loans and build reputation, this drops — all the way to 100% at score 1000.
// Approve and deposit a collateral basket const deposit = await spec.deposit({ assets: [ { token: 'wstETH', amount: 2 }, { token: 'USDC', amount: 200 } ] }); // → { tx: '0x7c2…', basketValue: 4120, collateralRatio: 200 }
4
Borrow USDC
Request a loan against your collateral. Your rate and limit are determined by your current reputation score.
const loan = await spec.borrow(500); // → { id: 1, amount: 500, rate: 10, due: 1719878400 } console.log(loan.rate); // 10% APR (starting rate) console.log(loan.id); // Use this to repay
5
Repay and build reputation
Every on-time repayment raises your agent's reputation score, unlocking better rates and higher borrow limits. This is the core loop.
const result = await spec.repay(loan.id); // → { tx: '0xf1a…', newScore: 85, nextRate: 9.2 } // Score went 0 → 85. Next loan: better terms.
Full example: copy, paste, run
Here's a complete script that does a full borrow→repay cycle on testnet. Save it as agent.mjs and run with node agent.mjs.
import { Specular } from '@specular/sdk'; const spec = new Specular({ privateKey: process.env.AGENT_KEY, network: 'base-sepolia' }); // 1. Register const agent = await spec.register(); console.log('Agent:', agent.address); // 2. Deposit collateral basket await spec.deposit({ assets: [{ token: 'wstETH', amount: 2 }] }); // 3. Borrow const loan = await spec.borrow(500); console.log('Loan:', loan.id, 'at', loan.rate + '% APR'); // 4. Use the capital (your strategy here) // 5. Repay and build reputation const result = await spec.repay(loan.id); console.log('Score:', result.newScore);
This uses testnet — no real money at risk. Once you've validated your strategy, switch network to 'base' for mainnet.
Ready to go deeper?
Browse live contracts, check out the code, or follow the full Launch Guide for strategy design, safety rails, and going to mainnet.
Capital Provider
Start earning yield from agent lending.
Supply USDC to the Specular lending pool. When agents borrow and repay, you earn interest — backed by collateral and onchain reputation.
~5 minutes
Wallet on Base (MetaMask, Coinbase, Rainbow) USDC to supply ~$0.10 ETH for gas
1
Set up a Base wallet
You'll need a wallet on Base network with USDC. If you're coming from Ethereum mainnet, bridge your USDC to Base.
We recommend Coinbase Wallet, MetaMask, or Rainbow. All support Base natively.
2
Supply USDC to the pool
Deposit any amount of USDC into the LiquidityMarketplace. Your capital becomes available for agents to borrow against their collateral.
// Using the SDK import { Specular } from '@specular/sdk'; const spec = new Specular({ privateKey: process.env.LP_KEY, network: 'base' }); await spec.supply(10000); // → Supplied 10,000 USDC to pool
You can also interact directly with the LiquidityMarketplace contract at 0xd7b4…3b1C8f
3
Earn yield automatically
As agents borrow and repay, interest accrues to your position. Rates range from 2–10% APR depending on borrower reputation. Your capital is protected by borrower collateral.
4
Withdraw anytime
Withdraw your principal plus earned interest whenever you want, subject to pool utilization.
await spec.withdraw(10000); // → Withdrew 10,000 USDC + accrued interest
Want to understand the risk model?
Learn how collateral, liquidation, and reputation scoring protect lender capital. Or explore the full protocol architecture.
Protocol Explorer
Understand how Specular works.
A guided tour of the protocol's architecture — identity, reputation, lending, and discovery. No code required.
~7 minute read
No code required No wallet needed
1
The problem
AI agents are increasingly autonomous — trading, managing infrastructure, allocating resources. But they can't access credit. Existing DeFi requires human-oriented interfaces, manual governance, and has no concept of machine identity. Agents need their own financial infrastructure.
2
Agent identity
Every agent registers a permanent onchain identity through the AgentRegistry contract. This is like a wallet-native profile — it ties together all of an agent's borrowing history, reputation, and interactions into a single verifiable record on Base.
View AgentRegistry on Basescan →
3
Reputation scoring
Agents start at score 500 (base score). Every on-time repayment increases it. The score is deterministic — calculated from observable onchain behavior, not subjective governance votes. Higher scores unlock lower interest rates (10% → 2.9%), reduced collateral (200% → 100%), and higher borrowing limits.
View ReputationManager on Basescan →
4
The lending marketplace
Capital providers supply USDC. Agents borrow against collateral at rates set by their reputation. The system is fully permissionless — any agent with a registered identity can participate. All loans, repayments, and liquidations happen onchain.
View LiquidityMarketplace on Basescan →
5
Machine-readable discovery
Specular publishes a .well-known/specular.json manifest — a machine-readable file that lets any agent discover the protocol, find contract addresses, understand capabilities, and start interacting. No docs to parse. No humans in the loop.
Think of it like robots.txt, but for financial services. Agents can autonomously discover and evaluate whether to use the protocol.
Ready to build?
Read the whitepaper for the full technical specification, jump into the code, or follow the agent quickstart.
Launch Guide
Go from idea to live agent, step by step.
Building an autonomous agent that borrows, trades, and manages capital is a different kind of project. This guide helps you make the right decisions before writing a line of code.
~15 minute read
Node.js 18+ Agent strategy idea Collateral assets + ETH on Base (for mainnet)
1
Define your agent's strategy
Before touching code, get clear on what your agent will do with borrowed capital. The strategy determines everything — how much to borrow, repayment frequency, and risk tolerance.
Common strategies:
Arbitrage — borrow USDC, exploit price differences across DEXs, repay within minutes
Market making — borrow to provide liquidity, earn spread, repay from fees
Cross-chain bridging — borrow on Base, deploy capital on other chains, repay after settlement
Yield farming — borrow at Specular rates, deploy into higher-yield protocols, pocket the spread
2
Choose your agent framework
The Specular SDK works with any framework that can control an Ethereum wallet. Pick based on what your agent needs to do beyond borrowing.
Framework fit:
LangChain / LangGraph — best for agents that need LLM reasoning + tool use
CrewAI — best for multi-agent coordination (e.g. one agent borrows, another trades)
AutoGPT — best for fully autonomous long-running agents
Custom Node.js — best for deterministic strategies that don't need an LLM
3
Set up your wallet and keys
Your agent needs its own wallet — separate from your personal wallet. This keeps agent funds isolated and makes reputation tracking clean.
# Generate a fresh agent wallet npx @specular/sdk generate-wallet # Output: # Address: 0x7a3… # Private key: 0xe4f… (save this securely!)
Never commit private keys to git. Use environment variables or a secrets manager. The agent wallet needs a small amount of ETH on Base for gas (~0.001 ETH to start).
4
Start on testnet
Before risking real capital, validate your strategy on Base Sepolia testnet. The contracts and SDK work identically — just change the network config.
const spec = new Specular({ privateKey: process.env.AGENT_KEY, network: 'base-sepolia' // testnet }); await spec.register(); await spec.deposit(1000); // testnet USDC const loan = await spec.borrow(500); // Run your strategy here… await spec.repay(loan.id);
Run at least 5–10 full borrow→deploy→repay cycles on testnet before going to mainnet. Watch for gas costs, timing, and edge cases.
5
Add safety rails
Autonomous agents need guardrails. Before going live, make sure your agent handles failures gracefully.
Checklist:
☐ Max borrow limit per cycle (don't let the agent over-leverage)
☐ Auto-repay if strategy fails (protect your reputation score)
☐ Gas price ceiling (pause if gas spikes)
☐ Circuit breaker — kill switch if losses exceed threshold
☐ Logging — record every borrow, trade, and repayment
☐ Alerting — notify you on failures via webhook, Telegram, or email
6
Go live on Base mainnet
Switch to mainnet, fund your agent wallet with collateral assets and ETH for gas, and start small. Your first few loans will be at higher rates (10% APR) and require 200% collateral — that's by design. As your agent repays reliably, terms improve automatically.
const spec = new Specular({ privateKey: process.env.AGENT_KEY, network: 'base' // mainnet — real money }); // Start conservative. Scale up as reputation grows.
Start with small borrows ($100–$500) to build reputation cheaply. Once your score passes 500, you'll be borrowing at 6% with 150% collateral — that's when most strategies become profitable.
Need hands-on help?
Reach out to the team, or go back to the agent quickstart to start building.