Skip to content

Feature: Pendle Stablecoin Yield Agent (Web AG-UI) #387

@vseb1

Description

@vseb1

Overview

  • Add a Pendle-focused agent in web-ag-ui that discovers stablecoin pools, compares APY, and rebalances PT holdings to the best available yield.
  • Follow the mock agent workflow structure as the primary scaffold; use agent-clmm patterns only for transaction planning/execution and runtime checks.
  • Execute all Pendle actions through onchain-actions (local worktree preferred; production fallback if needed).

Goals

  • Discover Pendle stablecoin PT yields and rebalance into the best yield when thresholds are met.
  • Run autonomously after one-time setup (starting token + amount + delegations).
  • Emit AG-UI artifacts and progress updates aligned to mock agent patterns.
  • Include compounding gains and automatic Pendle rollovers in final scope.

Non-Goals

  • Non-stablecoin pools or volatile assets.
  • Leverage strategies or complex multi-hop yield optimization.
  • New pricing/oracle systems.
  • Custodial wallet management.

Functional Requirements

Pool discovery

  • Fetch Pendle stablecoin pools from onchain-actions.
  • Filter by stablecoin whitelist only (no liquidity/maturity filters).
  • Normalize APY fields and rank consistently; deterministic ordering for ties.
  • Fetch swappable tokens/pairs from onchain-actions and ignore pools that cannot be swapped to/from.

Portfolio assessment

  • Identify current PT holdings and associated pools.
  • Compare current APY vs best available APY.
  • Rebalance only when a configured threshold is exceeded (default: 0.5% APY delta).

Rebalance planning

  • Build plan to exit current PT and enter target PT.
  • Keep planning details internal; do not surface plan artifacts to UI.
  • Full scope: starting token → underlying → target PT.

Execution

  • Execute plan via onchain-actions (discovery, swaps, PT acquisition).
  • Track lifecycle with AG-UI events (planned → pending signature → submitted → confirmed/failed).
  • On failure, surface a clear rollback/next-step message; no silent retries.
  • Initial setup: starting token → highest-APY underlying → PT.
  • Rebalance flow: old PT → old underlying → new underlying → new PT.

Workflow UX

  • Only surface mock-agent-aligned artifacts: pendle-telemetry and pendle-summary.
  • UI shows latest trade, performance accounting metrics, and activity indicators only.
  • Do not expose pool lists, holdings, or rebalance plans.
  • Delegations collected during setup; no additional approvals mid-cycle.

Technical Requirements

  • Implement as a dedicated agent workflow inside web-ag-ui/apps, not by extending mock agent directly.
  • Use mock agent command routing/state machine patterns.
  • Use agent-clmm only for transaction execution flow, onchain confirmations, and wallet/network readiness checks.
  • Validate all external API inputs/outputs at client boundaries with Zod.
  • No mocks for missing env vars; local runs require explicit configuration.

Default Stablecoin Whitelist

  • USDai, reUSD, NUSD, rUSD, yzUSD, ysUSDC, upUSDC, USD3, jrUSDe, iUSD, syrupUSDC, syrupUSDT, USDe

Dependencies

  • onchain-actions service (local worktree preferred; production fallback allowed).
  • Pendle pool discovery/analytics support in onchain-actions.
  • web-ag-ui runtime + artifact rendering.

Acceptance Criteria

  • Agent registered/discoverable in web-ag-ui and gated by feature flag.
  • Pools filtered by whitelist; APY ranking is normalized and deterministic.
  • Rebalance decisioning respects threshold and is internal-only.
  • Execution uses onchain-actions and reports lifecycle events and telemetry/summary artifacts.
  • Setup flow captures starting token/amount + delegations, then runs autonomously.
  • Tests include unit coverage for filtering/ranking/decision logic and at least one integration test for discovery → decisioning.

Test Plan

  • Unit tests: pool filtering, APY normalization/ranking, rebalance threshold logic.
  • Integration test: mock pool list + holdings → internal execution decision logged.
  • Optional E2E: full transaction flow with funded test wallet.

Rollout

  • Implement behind feature flag in web-ag-ui.
  • Validate locally against a local onchain-actions instance.
  • Enable in staging after integration tests pass.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions