Research

A carry trade is simple to describe and hard to run well: supply collateral, borrow against it, and put the borrowed funds to work at a yield above the borrowing rate. Done well, it turns idle assets like BTC into a steady source of yield.
Run by hand, a carry trade has two challenges: safety and yield. In KPK Funds, the Carry Trade agent automates this around the clock and tackles both seamlessly: it keeps the spread positive, positions within their safety limits, and serves redemptions without the need for human intervention.
Challenges of manual carry
The spread a carry trade earns is set by DeFi lending rates that move every block, across protocols that price risk their own way. Running it by hand means watching borrow rates, yield rates, oracle prices, health factors and upgrades across several protocols at once. So most carry trades stick to a single venue to keep operations simple. KPK's automation removes that constraint: the Carry Trade agent can choose from several venues that pass the internal due diligence, computing the best allocation in real time. Every action it can take is whitelisted in advance and enforced onchain.
Manual carry leaves room for different risks belonging to:
Safety. A sharp drop in collateral value, if no one reacts in time, can push a position into liquidation. Redemptions add risk too: each one means unwinding part of the position, step by step, without breaching a safety limit along the way. On top of that sits protocol risk: an exploit, a failing oracle or an upgrade can change a venue's risk within seconds.
Yield. A borrow rate spike or an expiring incentive can shrink the spread or turn it negative, while better-paying options sit untouched. The best allocation changes every block, faster than anyone can keep up with by hand. A further drag: new deposits can sit idle until someone gets round to putting them to work.
Teams usually handle both challenges with a dashboard and an on-call rotation and vet a venue once and treat it as safe from then on.
What the Carry Trade agent does
KPK built proprietary infrastructure instead. An agent looks after the whole carry strategy: collateral on one or more lending venues, the debt drawn against it, and the yield positions where the borrowed funds are parked. It answers both challenges, safety and yield, and runs the fund's flows on top.
Safety: Every venue has a health factor band. The agent's own borrowing always stays inside it. If falling collateral prices push a health factor to the bottom of the band, the agent rebalances it before anything else happens. The agent also watches for protocol events, such as exploits, oracle failures, upgrades and parameter changes, and responds to them.
Yield: It sizes collateral, debt and yield deposits for the best net carry within its allocation limits (such as a minimum and maximum per protocol) and each venue's supply and borrow caps, and moves only when the gain is worth the cost of moving.
Fund flows: Subscriptions, redemptions, partial exits and full unwinds arrive as requests. The agent funds each one from the live position in a safe order.
Whenever the agent cannot act safely, it stands by and alerts the KPK risk team.
How it works: observe, decide, act
Every carry cycle follows the same three steps, and sends at most one transaction. The agent can run a cycle on every new block, about once every 12 seconds on Ethereum.

Observe: The agent reads every venue and yield position at a single block. Rates, prices, balances and health factors all describe the same moment, so no decision mixes stale and fresh data.
Decide: It picks exactly one action, in strict priority. Health factor rebalances come first. Then it serves requests from the fund: subscriptions, redemptions, exits and unwinds, which other agents file in a shared inbox. Last comes the optimiser, which proposes the plan with the best net carry inside every bound and floor. If nothing is safe and worthwhile, the agent stands by and no transaction is fired.
Act: The chosen action becomes one batched transaction, executed by the fund's own account, which accepts only the calls the agent is explicitly allowed to make. One signer and one action per cycle mean moves never race each other. When requests are still waiting, the agent schedules another cycle straight away, so a backlog clears quickly.
Safety: fund structure and agent rules
Safety comes from two layers: the fund's structure and the agent's own rules.
Non-custodial, with its scope enforced onchain. The agent never holds funds: positions sit in the fund's own smart account. That account carries an onchain allowlist of exactly what the agent may do, naming the contracts, the functions and even the parameters, such as where tokens may be sent. Every call is checked against it as it executes, and anything not on the list reverts. Even a leaked agent key would only allow the same calls, with no way to send funds anywhere else.
Rules that can't change overnight. The fund's account has no human signers, and any change to what the agent may call waits out a 3-day timelock controlled by KPK's Security Council.
Safety outranks yield. Rebalancing a venue at its trigger always comes before any move made for profit. If no rebalancing plan can be sent, a plain repay brings the venue back to its floor.
Every plan is replayed before it is trusted. The agent simulates the plan against the snapshot it was built from. A plan that would break a floor or a bound in replay is thrown away.
Health is checked at every step. Each venue's health factor is computed the way the protocol computes it, in integer arithmetic and rounded against the fund. It is checked at every point the batch passes through, not only at the end, and moves are ordered so that funds are freed before they are used and no venue drops below its floor mid-batch.
Checked again at signing. Just before signing, the agent rebuilds the transaction and refuses it unless it matches exactly. It re-prices any plan that adds risk against fresh chain state and refuses one that would land at the trigger. Valuations come from the fund's NAV oracle and are compared with each venue's own pricing; when they disagree beyond tolerance, the agent stands by.
Protocol risk is watched. KPK's custom monitors, configured through Hypernative, watch every venue and yield position for sudden onchain events, such as a suspected exploit, an unhealthy oracle or a protocol upgrade. An alert on one position pulls the fund out of that position alone, with no operator in the loop. Due diligence never stops either: each venue and the exposure underneath it keep being re-checked, not just at onboarding.
Standby is loud. A standby that needs a human alerts the risk team straight away. Two people from that team are on call 24/7, on a rota spread across time zones, and a page nobody acknowledges within 5 minutes goes to the rest of the team.
Some risks remain. A venue can be exploited faster than any exit, an oracle can misprice collateral, a wrapped asset can lose its peg, and a large unwind depends on how fast the yield positions can pay out. These risks are actively monitored and managed, but cannot be fully eliminated. Each Fund's documentation sets out its risks and terms.
Yield: inside the optimiser
The optimiser turns one snapshot into the best plan the limits allow. It is deterministic, with no network calls and no hidden state: the same snapshot always gives the same plan. The agent's input parameters are not instructions to follow; they are constraints. Each one cuts down the set of plans the search may consider, and the optimiser then picks the best plan from what is left:
Health factor floors per venue rule out any plan that would take a venue below its floor, at the end or partway through the batch.
Amount and share limits on each collateral and each borrow cap how much of a token a venue may hold or lend, in token units and as a share of the total.
Parking rules say which yield positions each borrow may use and how much each position may hold, at most and at least.
The operating mode can stop new borrowing (repay-only) or close the position entirely (unwinding).
Requests tighten the same set. A pending redemption, for example, reserves the collateral it needs, so every plan must leave that collateral free. The limits themselves are set by KPK's risk team, the optimiser then finds the best allocation inside them.

The search runs in five steps:
Model everything at once. Every venue's collateral and debt, every yield position and the idle assets in the fund's account become one optimisation problem. Rates come in as models read at that block, so the optimiser knows what a position earns, or a debt costs, after a move of any size, not just today. A large move that shifts a market's rate is priced that way. Incentives are priced the same way, on both legs: extra yield on a deposit and a rebate on a borrow, each diluted as the fund's share of the campaign grows.
Turn amounts into steps. Each token's total is split into equal steps, so a borrow on any venue and a deposit into any position move on the same grid. Steps a protocol would refuse (a supply cap, a paused reserve, missing liquidity) or that break a configured bound are dropped up front.
Search exactly, not greedily. A dynamic-programming search covers every feasible combination of moves across venues and positions. It returns the highest net carry: what collateral and positions earn, minus what debt costs. On that grid the result is the optimum, not a heuristic's best guess. Ties go to the plan that moves less, so the agent never churns for nothing.
Gate on net gain. The plan goes out only if it improves net carry by enough to be worth moving. Health factor rebalances skip that gate.
Stay within budget. The search counts its own work and stops at a fixed budget. A plan that cannot be found in time means standing by, never guessing.
Adapters: one interface per protocol
The agent makes the decisions, and adapters handle each protocol's specifics. An adapter is a module in the agent's own code: it reads one protocol's state and writes the calls the fund will make there.

Each adapter family has one fixed interface. A venue or position reads its whole state at the cycle's block and returns call legs, and the agent joins those legs into its single batch. Adding a protocol means writing one adapter against that interface, not rewriting the decision logic. Today that covers five borrow venues and six kinds of yield position, from Morpho vaults and Aave pools to Sky's sUSDS. Each fund can only allocate to the protocols on its own onchain allowlist, so supporting a protocol does not mean every fund uses it.
Fund flows: how requests are served
Other agents never touch the position. They file a request in the agent's inbox and wake it up.

Four kinds of request reach the inbox: subscriptions, redemptions, exits and full unwinds. The agent serves them only after any health factor rebalance, one action per cycle, and settles each request exactly once. A funded redemption is handed on to settlement, which pays the redeemer.
Full unwinds can be fast. During the Binance exploit on 29 Oct, KPK exited a BTC carry position 12 seconds after Aave v4 froze, in a single transaction: USDC pulled from Morpho, WBTC loan repaid on Aave, all principal back. A freeze usually means something is wrong, so KPK exits first and asks questions later.

Carry you don't have to watch
Carry has always rewarded whoever watches the market most closely and reacts most carefully. KPK's Carry Trade agent does both, every cycle. It reads the whole position at once, makes one considered move, and refuses any move that would breach a safety limit.
The result is collateral-backed yield run with institutional discipline: the assets stay in the fund's own account, and the agent can only make the calls it is allowed to.
Risk disclaimer
Funds curated by KPK are non-custodial smart contracts and may carry significant risks, including possible loss of assets. KPK does not provide investment, legal, or financial advice. Past performance does not guarantee future results.
Share this article

