> ## Documentation Index
> Fetch the complete documentation index at: https://docs.privy.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Using Privy server wallets with Yield.xyz AgentKit

Give AI agents access to 2,900+ yield opportunities across 80+ blockchain networks. Yield.xyz AgentKit discovers and constructs unsigned transactions for staking, lending, vaults, liquid staking, and restaking. Privy handles wallet creation, policy enforcement, and transaction signing. The two systems never overlap: Yield.xyz never signs, Privy never builds transactions.

## Resources

<CardGroup cols={2}>
  <Card title="Yield.xyz AgentKit" icon="github" href="https://github.com/stakekit/agentkit" arrow>
    GitHub repository for the Yield.xyz AgentKit MCP server.
  </Card>

  <Card title="Yield.xyz AgentKit docs" icon="arrow-up-right-from-square" href="https://docs.yield.xyz/" arrow>
    Official documentation for the Yield.xyz AgentKit.
  </Card>

  <Card title="Privy agentic wallets" icon="wallet" href="/recipes/agent-integrations/agentic-wallets" arrow>
    Set up Privy server wallets for autonomous agents.
  </Card>

  <Card title="Privy manual approvals" icon="shield-check" href="/transaction-management/overview" arrow>
    Intents API reference for semi-autonomous workflows.
  </Card>
</CardGroup>

***

## What is Yield.xyz AgentKit?

Yield.xyz AgentKit is an MCP server that provides AI agents with tools to search yield opportunities, build deposit/withdraw/claim transactions, and check balances across 80+ networks. All yield operations go through MCP tools — agents never call the Yield.xyz REST API directly.

| Tool                    | Purpose                                                         |
| ----------------------- | --------------------------------------------------------------- |
| `yields_get_all`        | Search and filter yields by network, token, type, or provider   |
| `yields_get`            | Retrieve full metadata for a specific yield                     |
| `yields_get_validators` | Fetch validator options for delegation-based yields             |
| `yields_get_balances`   | Check balances and pending actions                              |
| `actions_enter`         | Build transactions to deposit or stake into a yield             |
| `actions_exit`          | Build transactions to withdraw or unstake from a yield          |
| `actions_manage`        | Build transactions for pending actions (claim rewards, restake) |

<Info>
  Yield.xyz AgentKit is maintained by the Yield.xyz team. For AgentKit-specific issues, refer to
  their [GitHub repository](https://github.com/stakekit/agentkit).
</Info>

***

## Prerequisites

* A Privy account with API credentials ([dashboard.privy.io](https://dashboard.privy.io/))
* `PRIVY_APP_ID` and `PRIVY_APP_SECRET` set as environment variables
* Optionally `PRIVY_WALLET_ID` if a wallet already exists
* [Claude Code](https://docs.anthropic.com/en/docs/agents-and-tools/claude-code/overview) installed
* Privy Enterprise plan (required for the semi-autonomous workflow only)

<Tip>
  To set up Privy server wallets before continuing: [Agentic wallets
  guide](/recipes/agent-integrations/agentic-wallets) · [Privy
  dashboard](https://dashboard.privy.io/)
</Tip>

***

## Installation

Install the Yield.xyz AgentKit skill:

```bash theme={"system"}
npx skills add https://github.com/stakekit/agentkit
```

The installer prompts for a skill selection (`yield-agentkit-privy`) and an agent choice (Claude Code, Cursor, or Codex CLI). Once complete, the skill is symlinked into the project at `.agents/skills/yield-agentkit-privy`.

Open the agent in the project directory and run:

```
Set up the yield-agentkit-privy skill
```

The skill verifies Privy credentials and prompts for a workflow selection: **Autonomous** or **Semi-Autonomous**.

***

## Workflows

Privy supports two control models depending on approval requirements.

### Autonomous

The agent signs and broadcasts transactions directly via Privy's wallet RPC endpoint. Policies are enforced automatically within the TEE. No manual approval is required. Available on any Privy plan.

<Steps>
  <Step title="Verify credentials">
    The skill checks that `PRIVY_APP_ID`, `PRIVY_APP_SECRET`, and optionally `PRIVY_WALLET_ID` are
    present.
  </Step>

  <Step title="Register the MCP server">
    The skill registers the Yield.xyz AgentKit MCP server:

    ```bash theme={"system"}
    claude mcp add --transport http yield-agentkit https://mcp.yield.xyz/mcp
    ```
  </Step>

  <Step title="Configure a policy (optional)">
    The skill offers to attach a policy (conservative, balanced, or skip). Policies restrict
    per-transaction spend, allowed chains, or allowlisted protocols. All enforcement happens inside
    the TEE.
  </Step>

  <Step title="Create the wallet">
    The skill creates a wallet and attaches the policy if one was configured.
  </Step>

  <Step title="Fund the wallet">Send assets to the displayed wallet address.</Step>

  <Step title="Issue DeFi instructions">
    The agent is ready. Example prompt: `"Deposit USDC into Aave V3 on Base."`
  </Step>
</Steps>

### Semi-autonomous (Enterprise)

Every transaction is submitted as an intent via Privy's [Intents API](/transaction-management/overview). A designated approver must review and approve each transaction on the Privy dashboard before it executes. Intents expire after 72 hours if not approved.

**Intent statuses:** `pending` (awaiting approval), `executed` (broadcast), `failed` (execution error), `expired` (72h elapsed), `rejected` (cancelled), `dismissed` (resource changed).

<Steps>
  <Step title="Complete autonomous setup steps 1–3">
    Follow the credential verification, MCP registration, and policy configuration steps from the
    autonomous workflow above.
  </Step>

  <Step title="Confirm Enterprise prerequisites">
    Verify the Enterprise plan is active and the approver has been invited and completed MFA.
  </Step>

  <Step title="Create a key quorum">
    Create a [key quorum](/controls/key-quorum/create) in the Privy dashboard under **Wallet
    Infrastructure → Authorization → New Key → Register Key Quorum Instead**. Copy the Quorum ID and
    provide it to the agent. The agent verifies it via `GET /v1/key_quorums/{id}`.
  </Step>

  <Step title="Create the wallet">
    The skill creates the wallet with the key quorum as owner:

    ```bash theme={"system"}
    POST /v1/wallets
      chain_type: "ethereum"
      owner_id: <key_quorum_id>
      policy_ids: [<policy_id>]
    ```
  </Step>

  <Step title="Set up webhooks (optional)">
    Register an HTTPS endpoint under **Configuration → Webhooks** in the Privy dashboard and enable
    all four intent events: `intent.created`, `intent.authorized`, `intent.executed`, and
    `intent.failed`. See [Privy intent webhooks](/controls/dashboard/intent-webhooks).

    For testing without a backend, use [webhook.site](https://webhook.site/).
  </Step>
</Steps>

Once setup is complete, every transaction follows this cycle: agent builds via MCP → submits as intent → approver reviews on dashboard → Privy signs and broadcasts → agent polls until `executed` → reads hash.

***

## Transaction flow

Every yield action — enter, exit, or manage — follows the same sequence:

1. Call `yields_get` to inspect the yield schema
2. Call `actions_enter`, `actions_exit`, or `actions_manage` to build unsigned transactions
3. MCP returns an array of transactions with `stepIndex`, `type`, and `unsignedTransaction`
4. For each transaction in `stepIndex` order:
   * **Autonomous:** `POST /v1/wallets/{id}/rpc` → immediate hash
   * **Semi-autonomous:** `POST /v1/intents/wallets/{id}/rpc` → poll until `executed`
5. Report results with on-chain confirmation hashes

### EVM transactions

Extract only the fields Privy accepts from the unsigned transaction:

```bash theme={"system"}
PRIVY_TX=$(echo "$UNSIGNED_TX" | jq '{from, to, value, data, nonce, type} | with_entries(select(.value != null))')
```

Submit to Privy:

```bash theme={"system"}
# Example uses Base (chainId: 8453)
curl -s -X POST "https://api.privy.io/v1/wallets/$PRIVY_WALLET_ID/rpc" \
  --user "$PRIVY_APP_ID:$PRIVY_APP_SECRET" \
  -H "privy-app-id:$PRIVY_APP_ID" \
  -H "Content-Type: application/json" \
  -d "{
    \"method\":\"eth_sendTransaction\",
    \"caip2\":\"eip155:8453\",
    \"params\": { \"transaction\":$PRIVY_TX }
  }"
```

### Solana transactions

Convert hex to base64 before submitting:

```bash theme={"system"}
TX_BASE64=$(echo "$UNSIGNED_TX" | xxd -r -p | base64)

curl -s -X POST "https://api.privy.io/v1/wallets/$PRIVY_WALLET_ID/rpc" \
  --user "$PRIVY_APP_ID:$PRIVY_APP_SECRET" \
  -H "privy-app-id:$PRIVY_APP_ID" \
  -H "Content-Type: application/json" \
  -d "{
    \"method\":\"signAndSendTransaction\",
    \"caip2\":\"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp\",
    \"params\": { \"transaction\":\"$TX_BASE64\", \"encoding\":\"base64\" }
  }"
```

### Multi-transaction ordering

Transactions are processed sequentially in `stepIndex` order. For EVM chains, the nonce increments for each subsequent transaction. If any transaction fails, execution stops immediately and the failure is returned.

<Tip>
  For detailed transaction guides, see [Send EVM
  transaction](/wallets/using-wallets/ethereum/send-a-transaction) and [Send Solana
  transaction](/wallets/using-wallets/solana/send-a-transaction).
</Tip>

<Info>
  The skill never modifies values inside an `unsignedTransaction`. Amounts, recipient addresses,
  fees, and calldata are passed through exactly as returned by the MCP. Only structural fields are
  adjusted for Privy's signing format.
</Info>

***

## 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 the 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 — 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                | No API available — done in Configuration → Webhooks in the dashboard |

***

## Learn more

<CardGroup cols={2}>
  <Card title="Yield.xyz AgentKit" icon="github" href="https://github.com/stakekit/agentkit" arrow>
    Skill repository and MCP server source.
  </Card>

  <Card title="Yield.xyz AgentKit docs" icon="arrow-up-right-from-square" href="https://docs.yield.xyz/" arrow>
    AgentKit reference documentation.
  </Card>

  <Card title="Privy agentic wallets" icon="wallet" href="/recipes/agent-integrations/agentic-wallets" arrow>
    Wallet setup guide for autonomous agents.
  </Card>

  <Card title="Privy manual approvals" icon="shield-check" href="/transaction-management/overview" arrow>
    Intents API reference.
  </Card>

  <Card title="Privy webhooks" icon="bell" href="/api-reference/webhooks/overview" arrow>
    Webhooks overview for transaction events.
  </Card>

  <Card title="Privy dashboard" icon="gauge" href="https://dashboard.privy.io/" arrow>
    Wallet and policy management.
  </Card>
</CardGroup>
