Skip to main content
This guide sets up an AI agent that discovers yields, enters and exits positions, and claims rewards with a Privy server wallet. yield.xyz AgentKit builds the unsigned transactions through the MCP server, and Privy creates the wallet, enforces policies and signs. The two never overlap: yield.xyz never signs, and Privy never builds transactions. The same setup runs in production with real funds, and covers DeFi, staking and tokenized real-world assets, including RWA eligibility checks, subscription and redemption.

Resources

What the agent can do

  • Search and compare yields across networks on live rate, TVL, rate history and risk
  • Enter and exit staking, lending, vault and RWA positions
  • Rebalance and rotate between strategies
  • Claim rewards and complete pending actions
  • Monitor a portfolio
It does this through the AgentKit MCP tools. The agent never calls the REST API directly. See MCP server for every tool’s inputs.

RWA eligibility

Before entering an RWA position, the agent checks eligibility. For a permissioned issuer it checks the wallet’s KYC status: if the wallet is approved it builds and submits the transaction, and if not it shows the issuer’s onboarding URL and stops, so nothing is sent from a wallet that is not allowlisted. For an open-access issuer it confirms jurisdiction eligibility and proceeds.

Prerequisites

  • A Privy app with API credentials from the Privy dashboard, with PRIVY_APP_ID and PRIVY_APP_SECRET set as environment variables, and optionally PRIVY_WALLET_ID for an existing wallet
  • An agent such as Claude Code, Cursor or Codex CLI
  • A Privy Enterprise plan, for the semi-autonomous workflow only
The skill does not create Privy credentials: configure Privy in the agent’s environment first.

Install

Open the agent in the project directory and run:
The skill checks your Privy credentials and asks which workflow to use.

Choose a workflow

Autonomous

1

Verify credentials

The skill checks that PRIVY_APP_ID and PRIVY_APP_SECRET, and optionally PRIVY_WALLET_ID, are set.
2

Register the MCP server

3

Attach a policy (optional)

Choose conservative, balanced or none. Policies limit per-transaction spend, allowed chains and allowlisted protocols, and are enforced inside the TEE.
4

Create and fund the wallet

The skill creates the wallet, attaches the policy and shows the address. Send assets to it.
5

Give instructions

For example: Deposit USDC into Aave V3 on Base.

Semi-autonomous

Each transaction becomes a Privy intent that a designated approver reviews on the Privy dashboard. Intents expire after 72 hours. Their statuses are pending, executed, failed, expired, rejected and dismissed.
1

Run the first three autonomous steps

Verify credentials, register the MCP server and choose a policy.
2

Confirm Enterprise prerequisites

The Enterprise plan is active, and the approver has been invited and completed MFA.
3

Create a key quorum

In the Privy dashboard, go to Wallet Infrastructure, Authorization, New Key, Register Key Quorum Instead. Give the Quorum ID to the agent, which verifies it with GET /v1/key_quorums/{id}.
4

Create the wallet

The skill creates the wallet with the key quorum as owner:
5

Set up webhooks (optional)

Under Configuration, Webhooks, register an HTTPS endpoint and enable intent.created, intent.authorized, intent.executed and intent.failed.
Each transaction then runs: the agent builds it through MCP, submits it as an intent, the approver approves it, Privy signs and broadcasts, and the agent polls until executed and reads the hash.

Transaction flow

Every enter, exit or manage follows the same sequence:
  1. yields_get to read the yield’s argument schema
  2. actions_enter, actions_exit or actions_manage to build the transactions, returned with stepIndex, type and unsignedTransaction
  3. For each transaction, in stepIndex order:
    • Autonomous: POST /v1/wallets/{id}/rpc returns the hash
    • Semi-autonomous: POST /v1/intents/wallets/{id}/rpc, then poll until executed
  4. submit_hash with each confirmed hash, and report the result

EVM

Pass only the fields Privy accepts from the unsigned transaction:

Solana

Privy takes the transaction as base64. A Solana unsignedTransaction can come back hex or base64 encoded depending on the yield; convert hex to base64 first:
See Solana signing for detecting the encoding.

Ordering

Transactions run one at a time in stepIndex order, with the EVM nonce increasing for each. If one fails, the agent stops and reports the failure. The skill never changes amounts, recipients, fees or calldata inside an unsignedTransaction: only field names are adjusted for Privy’s format.

Error handling

What stays manual

Next steps

AgentKit

Plugins and skills for other agents and wallets.

Guardrails

What AgentKit checks before any transaction is built.

MCP server

Every tool and its inputs.

RWAs

Issuers, eligibility and redemption timing.