Yield.xyz AgentKit Privy Skill
An Agent Skill that combines Yield.xyz's yield discovery and transaction building with Privy's wallet infrastructure, enabling AI agents to go from "find me the best USDC yield on Base" to a confirmed on-chain position, end to end.
Overview
Onchain yield management involves multiple steps: discovering opportunities across protocols and chains, constructing the right transactions, signing them securely, and confirming execution on-chain. Doing this programmatically, especially through an AI agent, requires cleanly separating what to do from how to sign.
This skill solves that by pairing two layers:
- Yield.xyz AgentKit MCP discovers yields across 80+ networks, inspects yield schemas, and builds unsigned transactions. It never touches private keys.
- Privy holds the agent wallet's key inside a Trusted Execution Environment (TEE), enforces configurable policy rules, and signs and broadcasts transactions.
The agent orchestrates both layers. The key never leaves Privy's infrastructure.
Use cases
- Search and compare yield opportunities across 80+ networks, with Privy policy guardrails enforcing spend limits and allowed chains
- Autonomously rebalance DeFi portfolios across Aave, Morpho, and Fluid — transactions signed inside Privy's TEE, keys never exposed
- Run treasury yield strategies with full human oversight via manual approval on the Privy dashboard (Semi-Autonomous)
- Set configurable risk policies so the agent only operates within guardrails you define
- Claim rewards, exit positions, and manage pending actions programmatically
Demos
Demo 1: Autonomous — Portfolio Rebalance on Base
Network: Base · Workflow: Autonomous
Pre-condition: USDC deposited into Aave V3, Morpho, and Fluid via the Privy agent wallet.
Demo 2: Semi-Autonomous — Split Deposit on Solana
Network: Solana · Workflow: Semi-Autonomous (Enterprise)
Pre-condition: Wallet funded with USDC on Solana, SOL for rent. Key quorum and approver configured.
How It Works
User prompt
│
▼
Yield.xyz AgentKit MCP
├── Discover yields
├── Inspect schema and limits
└── Build unsigned transaction(s)
│
▼
Privy Wallet
├── Evaluate policy rules
├── Sign transaction
└── Broadcast to chain
│
▼
Agent polls until confirmed
Agent reports result to user
Each transaction follows the same loop: build → sign → broadcast → confirm. If an action returns multiple transactions (e.g., an ERC-20 approval followed by a deposit), they execute sequentially, each must be confirmed before the next begins.
Getting Started
Prerequisites
| Requirement | Details |
|---|---|
| Privy account | Create at dashboard.privy.io |
| Privy App ID + Secret | Found at Dashboard → App Settings → Basics |
| Privy Enterprise plan | Required only for Semi-Autonomous workflow |
Install
In your terminal run:
npx skills add stakekit/agentkit --skill yield-agentkit-privyOpen your agent and run:
Set up the yield-agentkit-privy skill
The agent reads SKILL.md and handles the rest — registering the MCP server, collecting your Privy credentials, walking you through workflow and policy selection, creating your agent wallet, and confirming setup. You'll be prompted for your App ID, App Secret, preferred workflow, and policy preferences.
To confirm the skill is active and MCP is connected:
What skills and MCPs do you have connected?
Full setup details and source code are on GitHub.
Workflows
This skill supports two execution modes, chosen during setup.
Autonomous
The agent signs and broadcasts transactions automatically through Privy, subject to any policy rules you configure. Best for automation and speed. Available on any Privy plan.
Semi-Autonomous
Every transaction is submitted as an intent and held for manual approval on the Privy dashboard before Privy executes it. Approvers review the transaction details and complete MFA before it proceeds. Best for oversight, safety, and treasury management. Requires a Privy Enterprise plan.
Architecture and Design
Why unsigned transactions? Yield.xyz constructs transactions but never signs them. This keeps key management entirely outside the yield layer. Any compatible signing infrastructure — Privy, Moonpay, BankrBot, can plug in without modification.
Separation of concerns. The agent, the yield API, and the wallet each operate in their own domain. The agent orchestrates. Yield.xyz handles protocol complexity and transaction construction. Privy handles key security, policy enforcement, and on-chain execution. No single layer has both transaction-building authority and signing authority.
Policy enforcement. Privy policies are evaluated in a TEE before every signing operation. You can restrict by contract address, spending limit, chain, and more — so the agent operates within guardrails you define.
Error handling
| Error | Cause | Action |
|---|---|---|
POLICY_VIOLATION | Transaction exceeds policy limits | Report which rule triggered. Do not retry without user instruction. |
INSUFFICIENT_FUNDS | Wallet lacks gas | Ask user to add native token to the wallet address. |
FAILED | Transaction failed on-chain | Provide the hash for block explorer inspection. Stop all subsequent transactions. |
What cannot be automated
| Action | Reason |
|---|---|
| Fund the agent wallet | Requires an existing external wallet |
| Invite approver to Privy app | Tied to authenticated user account |
| Complete MFA | Device-bound |
| Create key quorum | API requires user Id input, so kept manual for better UX |
| Approve pending intent | By design — this is the point of the workflow |
| Upgrade to Enterprise | Billing — done on the Privy dashboard |
| Webhook Setup | Configuration → Webhooks in the Privy dashboard, no API available |
Resources
Updated 6 days ago
