Skip to content

Agentic API

Agentic Primitives are read-only analytics: stateless objects that answer a specific question about an LP position or pool, and return a structured typed dataclass. They never mutate pool state. Same call shape from a Jupyter notebook or from Claude calling them as tools.

This page is the API reference index. For the conceptual overview and the agentic-loop walkthrough, see Agentic Primitives under Concepts. For the per-class detail pages — including signatures, parameter tables, and runnable examples — see the category links below.

CategoryPrimitivesWhat it answers
Position AnalysisAnalyzePosition, AnalyzeBalancerPosition, AnalyzeStableswapPositionWhy is this LP position gaining or losing money? IL decomposition, fee income, net PnL.
Price ScenariosSimulatePriceMove, SimulateBalancerPriceMove, SimulateStableswapPriceMoveWhat happens if the price moves X%? Forward IL, projected position value.
Pool HealthCheckPoolHealth, DetectRugSignals, DetectFeeAnomalyIs this pool healthy? Concentration, activity, fee anomalies, rug signals.
RiskCheckTickRangeStatus, AssessDepegRiskTick-range proximity (V3); depeg-IL across scenarios (Stableswap).
OptimizationEvaluateTickRanges, EvaluateRebalance, OptimalDepositSplitTick-range candidate evaluation, rebalance cost-vs-benefit, V2 zap-in α.
ComparisonCompareFeeTiers, CompareProtocolsFee-tier comparison (V3); cross-protocol comparison (V2/V3/Balancer/Stableswap).
ExecutionCalculateSlippage, DetectMEVTrade slippage decomposition; theoretical-vs-actual comparison for MEV detection.
PortfolioAggregatePortfolioMulti-position aggregation across protocols, with worst-first PnL ranking.
Break-EvenFindBreakEvenPrice, FindBreakEvenTimeAt what price / how long until fees break even with IL? (V2 + V3.)

Every agentic primitive follows the same contract:

result = ClassName().apply(lp, ...args)
  • Stateless construction. ClassName() takes no parameters.
  • .apply() does the work. The pool object and any analysis-specific arguments (token amounts, scenario parameters, ranges) are passed at call time.
  • Read-only. Pool state is never modified. Run as many times as you like at the same pool snapshot — the result is deterministic.
  • Returns a typed dataclass. Every primitive defines its own result dataclass — PositionAnalysis, PoolHealth, DepegRiskAssessment, etc. — with named fields a caller can destructure, serialize, or render.

For the dataclass definitions themselves see Result Dataclasses. For tool schemas (MCP) see Tool Schemas.