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.
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
| Input | Source | Max Weight |
|---|---|---|
| Repayment count | Protocol storage; incremented only on successful repay() | +55 pts |
| Liquidation count | Protocol storage; incremented at liquidation event | up to −55 pts penalty |
| Deposit tier (0–7) | Derived from lifetime cumulative deposit volume | +35 pts |
| Account age | Block 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:
| Tier | Score | Collateral Ratio | Interest Rate |
|---|---|---|---|
| ANON | 0–14 | 200% | 15% APR |
| BRONZE | 15–29 | 175% | 12% APR |
| SILVER | 30–49 | 150% | 10% APR |
| GOLD | 50–64 | 130% | 8% APR |
| PLATINUM | 65–79 | 120% | 6% APR |
| DIAMOND | 80–100 | 110% | 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
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
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 addresscollateral_usd_x6- collateral value in micro-USDdebt_usd_x6- outstanding debt in micro-USDcredit_score- current KreditAgent score (0–100)price_7d_change_bps- signed 7-day price trend in basis pointsliq_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
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
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):
| Trigger | Contracts Called |
|---|---|
| Borrowed event | NeuralScorer.infer() for the new borrower |
| CollateralDeposited event | RiskAssessor.assess_position() for the depositor |
| Liquidated event | RiskAssessor.assess_position() for the liquidated borrower |
| Deposited / YieldHarvested event | YieldMind.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.