AI Agent Workflows

Four smart contracts form Kredio's intelligence layer: one deterministic Wasm scorer invoked atomically at borrow time, and three PVM contracts that run continuously alongside every active borrower position. Together they produce a complete, permanent, on-chain record of credit quality and risk state for every participant.

1
ink! Wasm - Deterministic

KreditAgent - Deterministic Credit Scorer

The foundation of the credit system. KreditAgent is an ink! Wasm contract called atomically by EVM market contracts via SCALE-encoded staticcall at every borrow. It computes a score from 0 to 100 entirely from on-chain protocol storage - nothing is self-reported.

Scoring Inputs

InputSourceMax Weight
Repayment countProtocol storage; incremented only on successful repay()+55 pts
Liquidation countProtocol storage; incremented at liquidation eventup to −55 pts penalty
Deposit tier (0–7)Derived from lifetime cumulative deposit volume+35 pts
Account ageBlock delta since first deposit in contract storage+10 pts

Credit Tiers

The score maps to six credit tiers, each with a distinct collateral ratio and interest rate:

TierScoreCollateral RatioInterest Rate
ANON0–14200%15% APR
BRONZE15–29175%12% APR
SILVER30–49150%10% APR
GOLD50–64130%8% APR
PLATINUM65–79120%6% APR
DIAMOND80–100110%4% APR

Liquidation Penalty

A single liquidation event deducts 20 points. Two liquidations deduct 35. Three or more deduct 55 - enough to reset a DIAMOND borrower back to ANON. This penalty is hard-coded in protocol storage and cannot be disputed.

Address: 0x8c13E6fFDf27bB51304Efff108C9B646d148E5F3 · ink! Wasm, Asset Hub EVM


2
ink! PVM - Neural Cross-Validation

NeuralScorer - Neural Cross-Validation

A static rule-based system can be gamed. A borrower who understands the weights can engineer transactions to produce a high score while carrying genuine default risk. The NeuralScorer is the answer to this. It independently computes a weighted neural score from the same four inputs as KreditAgent, using different weight matrices, and compares the result against the deterministic baseline.

The meaningful output is not the neural score in isolation - it is the delta between the neural score and the deterministic score. A borrower whose behaviour is genuinely healthy will produce a small, consistent delta. A borrower engineering transactions to inflate the rule-based score will produce a growing divergence as the neural model weighs input combinations differently.

Event Output

One ScoreInferred event is emitted per call:

ScoreInferred {
  account,
  neural_score,        // 0–100
  deterministic_score, // from KreditAgent
  confidence_pct,      // how closely the models agree
  delta_from_rule,     // signed difference
  model_version
}

The confidence_pct is the protocol's real-time view of how much it trusts any individual score. High confidence means both models agree - the borrower's profile is consistent. A widening delta is an early signal of score manipulation or an unusual behavioural pattern worth monitoring.

Address: 0xac6bd3ff3447d8d1689dd4f02899ff558f108e0d · ink! PVM, Asset Hub EVM


3
ink! PVM - Forward-Looking Risk

RiskAssessor - Forward-Looking Position Risk

Rather than evaluating positions against where they currently sit, RiskAssessor evaluates positions against where they are going. It factors the seven-day price trend into every assessment alongside current health ratio and credit score, producing a concrete countdown rather than a colour code.

A position that looks healthy on a snapshot but is sitting on a sustained price decline is classified into a different risk tier than an identical position in a stable market. This distinction matters to the protocol treasury and to the borrower managing their position.

Inputs

  • borrower - position address
  • collateral_usd_x6 - collateral value in micro-USD
  • debt_usd_x6 - outstanding debt in micro-USD
  • credit_score - current KreditAgent score (0–100)
  • price_7d_change_bps - signed 7-day price trend in basis points
  • liq_ratio_bps - position-specific liquidation threshold

Output per Position

PositionRisk {
  liquidation_probability_pct,  // 0–100
  estimated_blocks_to_liq,      // concrete countdown
  risk_tier,                    // Safe / Watch / Warning / Critical
  collateral_buffer_bps,        // current safety margin
  recommended_top_up_atoms      // exact amount to return to safe zone
}

Single-position and 16-position batch modes are both supported. The batch mode allows the AI Engine to assess the entire active borrower pool in a single on-chain call during the periodic sweep.

Address: 0xdB9E48932E061D95E22370235ac3a35332d289f7 · ink! PVM, Asset Hub EVM


4
ink! PVM - Yield Allocation

YieldMind - Autonomous Yield Allocation

YieldMind reads three signals - pool utilisation, price volatility, and the weighted average credit score of the active borrower base - and computes the optimal allocation of idle capital across three yield buckets: conservative (6.5% APY), balanced (11% APY), and aggressive (18% APY).

Market Condition Routing

High Utilisation
All capital stays liquid. External deployment halted until borrower demand eases.
High Volatility
All active deployments routed strictly to the conservative bucket. Capital preservation first.
Normal Conditions
Allocation scales across all three buckets based on average platform credit quality and volatility.

Decision Output

AllocationDecision {
  conservative_bps,  // share to 6.5% APY bucket
  balanced_bps,      // share to 11% APY bucket
  aggressive_bps,    // share to 18% APY bucket
  idle_bps,          // retained as liquid buffer
  projected_apy_bps, // blended APY of this allocation
  confidence,
  reasoning_code     // 0=Normal, 1=HighUtil, 2=LowUtil, 3=Volatile
}

The reasoning_code documents the logic behind each allocation decision on-chain - not just what was decided, but why.

Address: 0x0b68fbfb596846e4f3a23da10365e0888a182ef3 · ink! PVM, Asset Hub EVM

Trigger Schedule

The AI Engine calls these contracts on two cadences - event-driven (immediate) and periodic (every 50 blocks, approximately every five minutes):

TriggerContracts Called
Borrowed eventNeuralScorer.infer() for the new borrower
CollateralDeposited eventRiskAssessor.assess_position() for the depositor
Liquidated eventRiskAssessor.assess_position() for the liquidated borrower
Deposited / YieldHarvested eventYieldMind.compute_allocation() over full pool state
Every 50 blocks (~5 min)NeuralScorer + RiskAssessor for all active borrowers; YieldMind unconditionally

When no active borrowers are present on testnet, the AI Engine uses the deployer address as a sentinel to keep all three PVM contracts emitting events on a regular cadence - ensuring the on-chain event record remains continuous.