Built by the team behind Compound.
Now in Early Access

The Onchain CLIAPIMCP
for Agents

agent.ts — legend
CLI
$ cargo install legend-clicopy $ legend-cli logincopy $ legend-cli accounts create --keygencopy
Works with

Building financial agents is hard.

Without Legend — Hard Mode
01Integrate wallet infrastructure
02Learn Morpho / Aave / Compound ABIs
03Handle token approvals manually
04Manage cross-chain bridging
05Provision gas on every network
06Build health monitoring
07Write an orchestration layer
08Months later — agent finally does something
With Legend — Easy Mode
One integration
Agents × Onchain x Legend
Every action. Every asset.

One integration. Every action.

Trade
Buy any asset on major EVM chains + Solana. Best-price routing and deep multichain liquidity. Cross-chain swaps handled automatically.
Earn
Deploy into Aave, Compound, and Morpho. Rate optimization across +100 markets, crosschain.
Borrow
On-demand liquidity against collateral without selling. Configure custom strategies on top of DeFi's most trusted Lending Protocols: Aave, Compound, Morpho.
Transfer
Move assets anywhere. Bridging handled automatically. Gas abstracted. Your agent says where, Legend figures out how.
Spend Soon
Conversion to cash via virtual card. Your agent pays real expenses from onchain balance.
NEW Markets Soon
Prediction markets and perpetuals. Hyperliquid and Polymarket integrations — your agent takes positions, manages risk, and settles automatically.

03

Transparent planning,
streamlined execution.

Every operation can be reviewed before it's signed. Your agent sees exactly what will happen, signs it — then Legend executes it.

01
Plan

You request an operation. Legend API returns a human-readable plan — amounts, routes, fees, protocols — before anything moves. Your agent (or a dedicated signing agent) can verify the plan matches the original intent before approving.

02
Sign

Flexible signing — bring your own key provider. Supports Privy, Turnkey, Ledger, and EOA keys. Legend never holds signing keys. Nothing moves without your signer's approval.

03
Execute

Legend handles gas, bridging, token approvals, and retries — then executes atomically onchain. Only whitelisted, audited DeFi protocols. Your agent can't accidentally route funds into an unknown contract.


Built with the guardrails agents need.

Whitelisted DeFi only
Every action routes through audited, whitelisted protocols. Agents can't accidentally dump funds into unknown contracts. The blast radius of any mistake is constrained by design.
Agent-in-the-loop verification
The Plan → Sign → Execute model means every transaction is confirmed as correct and safe before it is signed. A planner agent constructs the intent. Then a separate signing agent verifies the plan against the original intent before signing.
Sub-accounts per strategy
Each strategy is its own sub-account, resulting in out of the box risk isolation. Run high-risk + low-risk strategies in parallel with peace of mind.
Full activity log — no block explorer required
Every executed action is recorded with amounts, routes, fees, and timestamps. Your agent gets a structured audit trail out of the box — no manually tracing transactions across chains on a block explorer.

Ready-to-run financial strategies.

Pre-built flows your agent can run continuously.

Strategies — Standing Automations
Portfolio Rebalancer
Define target allocations. Rebalance back to target on a schedule or when drift exceeds a threshold.
DCA
Dollar-cost average into any asset on a schedule. Executes at regular intervals regardless of price.
Collateral Health Guardian
Monitor LTV on borrow positions. Auto-repay when approaching the liquidation threshold.
Rate Chaser
Watch yield rates continuously across protocols. When a meaningfully better rate appears, migrate the position atomically — no manual intervention.
Yield-Funded Operations
Earn on principal. Pay recurring costs from yield. Principal untouched. Agent runs indefinitely without a top-up.
Stablecoin Payroll
DCA out of volatile asset exposure into stablecoins on a schedule.
Orders — Conditional Triggers
Limit Order
Execute a swap when an asset hits a target price.
Stop-Loss / Take-Profit
Close or reduce a position at defined price levels.
Borrow Protection
Top up collateral or partially repay when LTV crosses a threshold. Prevents liquidation.
Recurring Buys
Purchase an asset on a fixed schedule — daily, weekly, or custom interval. Set it and forget it.
TWAP
Split large orders into smaller executions spread over time. Reduces price impact and slippage on big positions.

What people are already building.

Autonomous Trading Agents
Execute strategies — DCA, rebalancing, limit orders, cross-chain swaps — autonomously across any asset on any EVM chain + Solana (and soon Polymarket and Hyperliquid).
Self-Sustaining Agents
Earn yield on idle capital and pay their own operating costs from the yield — including paying via virtual card from onchain balance. No human tops them up. Run indefinitely.
Yield Aggregators
Deploy user funds into the best available yield across protocols. Rate optimization, auto-compounding, and migration all handled.
Microloans
Users borrow against holdings without selling. Agent manages collateral health, monitors LTV, and protects positions automatically.

We built this to power
our own app.

Proven in Production
The same engine running Legend's live consumer app. Real money. Real users. Not a prototype.
Built by DeFi Veterans
The team behind Compound. Deterministic execution, pre-signed plans, and a security model where Legend structurally cannot move funds without a signature.
Transparent Execution
Every plan is human-readable before signing. Chain-bound, replay-protected. Full audit trail — no block explorer spelunking.
Non-Custodial by Design
Legend never holds signing keys. Every transaction requires your signer's approval. Bring your own key provider — Privy, Turnkey, Ledger.

Get Started

Start building with Legend.

Read the docs and make your first API call in minutes.