Imagine a trading strategy that could sit beside the market and ask, every week, "given what's happening now, how should I adjust?" — then adjust itself, carefully, on the record, and reversibly. That is what the agentic algo layer does. This is how it works, and — just as important — how it's kept from doing anything reckless.
First, the strategy — written as rules you can read
Before any AI enters the picture, there is a strategy. On Dhakua Research, a strategy isn't a black box or a tangle of code — it's a set of plain, explicit rules, authored in a readable language and run automatically against real market data. Here is a genuine one, lightly trimmed:
ALGO Portfolio Auto-Pilot ────────────────────────────────────────────── REGIME # the market backdrop sets the posture halt new buys in CRISIS max 25% per sector UNIVERSE liquid Indian equities where market cap ≥ ₹1000 Cr and avg. traded value ≥ ₹5 Cr ENTRY # open a NEW position when… Weinstein stage is early-to-mid Stage 2 (a confirmed uptrend) AND a confirmed breakout within 15 days AND clear air above (near a 52-week high, little resistance) AND NOT overextended # blow-off guard: RSI ≥ 70 and > 20% stretched ADD pyramid a winner that's up ≥ 8% and still trending TRIM cut back when a position exceeds the 10% single-stock cap # hard limit TRIM cut 25% when weekly RSI > 70 # take something off an overheated name EXIT close on a Stage-4 breakdown, or when the ATR stop is hit EXECUTION stop −10% · single-stock cap 10% · max 2 buys / day
Read it top to bottom and you can see the whole philosophy: buy confirmed uptrends near highs, pyramid winners, trim the overheated, and cut losers at a hard stop. Every line is a decision the strategy makes on real data, every day, with no human in the loop. This is a deterministic algo — the same inputs always produce the same actions. It's built and run on the Algo Desk, Dhakua Research's strategy engine. (How strategies are authored, compiled and backtested is a story of its own — a separate article covers the Algo Desk in depth.)
Deterministic strategies have one well-known weakness, though: they're frozen. The thresholds — a 15-day breakout window, a 70 RSI trim, a Stage-2 entry — were chosen at a moment in time. Markets move on. That's the gap the agentic layer is built to close.
Adding an "agentic" layer on top
The agentic layer wraps around a running strategy without touching its engine. It adds two — and only two — weekly conversations with an AI, and a wall between the AI and anything that moves real money. Here is the whole system on one page:
The rest of this article walks the two AI calls — Type-A (the rules) and Type-B (the trades) — and shows, in each case, exactly where the guardrails stop the AI from crossing a line.
The AI rewrites the strategy — inside the guardrails
Each week the AI is handed a real read of the book — the market regime, every position, how each is doing — and asked a narrow question: propose a small change to a rule that would suit conditions better. It replies with a candidate change and a written reason. Then the change runs a gauntlet:
Regime, holdings, each position's stage and gain — the real state, this week.
A single rule tweak, with a plain-English rationale.
Does it touch a frozen risk limit? If so — rejected, no exceptions.
What passes becomes the next generation of the strategy — reversible.
Here's a real one. The AI observed that the strategy was late to fresh breakouts and proposed shortening the breakout window so it acts on confirmation sooner. That's a legal, inside-the-lines change — a single threshold — so it was accepted and became a new generation of the strategy:
Type-A mutation — accepted ✓
ENTRY …a confirmed breakout within 15 days 12 days # react to fresh breakouts sooner
And another the AI reasoned into — tightening the blow-off guard so it locks in gains a touch earlier:
Type-A mutation — accepted ✓
ENTRY / ADD …NOT overextended (blow-off: RSI ≥ 70 68) # step back from froth a little earlier
But now the important half — what the AI is not allowed to do. Suppose it reasoned that loosening the concentration limit would let winners run bigger, and proposed this:
Type-A mutation — rejected by the wall ✕
EXECUTION single-stock cap 10% 15% ← REJECTED · this is a frozen risk limit the AI may never touch it
The wall doesn't argue with the rationale — it simply refuses. The risk skeleton of the strategy is frozen and cannot be edited by the AI at all:
| Frozen — the AI cannot change these | Why it's off-limits |
|---|---|
| The stop-loss / ATR exit | the real safety net — it can't be loosened or removed, so a losing position always has an exit |
| Single-stock & sector caps | concentration limits — the one thing an over-eager optimiser always wants to relax |
| Turnover / tax budget | so the strategy can't churn its way to a flattering-looking return |
| "Don't buy in a crisis" | stays non-negotiable, in every market |
Because each generation of rules is sealed with a fingerprint, the strategy keeps an append-only history: generation 0 is the original, frozen; each accepted change is a new generation chained to the last. A single kill-switch rolls the live strategy back to any earlier generation — or all the way to the start — instantly. Here is that history, live:
And the pipeline of every proposal — accepted or blocked — with its wall verdict and what it changed:
Under the hood, the wall is a single, deliberately dull component — pure logic over two rule-sets, no AI, no guesswork. Its whole job is to be un-bargainable:
The AI suggests trades — the rules get the veto
The second AI call is bolder and needs an even firmer hand. Each week the AI rates the portfolio and nominates actual transactions — buy this, add to that, sell the other. This is exactly where letting an AI act on impulse would be dangerous, and an early version proved it: given the keys, it once tried to dump four of the book's biggest long-term winners on a hunch.
So in the real design, sells and trims can only come from the strategy's own exit rules. If the AI says "sell" on a stock the strategy is holding — a healthy uptrend above its stop — the suggestion is vetoed. Dumping a compounding winner on an AI's whim isn't discouraged; it's made structurally impossible.
Buys work the same way in reverse: the AI can only endorse entries the strategy already judged eligible (past every universe, regime, blow-off and cap rule). It can be more cautious than the rules — it can decline — but it can never conjure a trade the rules forbid. Every suggestion earns an honest, recorded verdict:
An entry the rules already deem eligible, that the AI also endorses. The one case where an AI suggestion actually trades.
The AI wanted to sell a name the rules are holding. Blocked. This is the veto that matters.
The AI likes a stock already held with no add signal. Nothing to do — the position simply stays.
An eligible entry the AI chose not to back — the cautious direction. Recorded, not executed.
In practice, most weeks look quiet. The AI is bullish on plenty of names the strategy already holds — and the strategy simply keeps them, because its rules see no fresh signal to act on. A handful of eligible entries get endorsed and buy; a stray "sell a winner" gets vetoed. The AI's opinion on every name is recorded on the console; only the rules ever move a position.
And because every AI call is stateless, the loop's memory is kept on our side: next week's prompt replays the last week's vetoes back to the AI — "you tried to sell a protected winner; don't" — and the current rules are written into the prompt so the AI constrains itself up front. The deterministic veto is the wall; the feedback is the reminder.
Great at proposing. Not trusted to pick.
All of this care rests on a finding we tested rather than assumed. The popular idea is that a modern AI, handed enough data, can simply pick winning stocks. So we checked — rigorously, with no hindsight — over 256 point-in-time calls on the real portfolio. The result was blunt: the AI's stock picks were a coin flip; the names it rated bullish did no better than the ones it rated bearish.
An AI is excellent at proposing and adapting rules — a fast, tireless search over how a strategy could be tuned. It is not a stock-picker. So this system points the AI squarely at what it's good at, and puts a wall everywhere it isn't. That's not a limitation bolted on after the fact — it's the entire design.
One encouraging signal keeps the door open: run weekly, with full market context, the AI's bounded overlay edged ahead of a simple buy-and-hold over a month — before costs. A hint, not a verdict. Which is why the last piece is the most important of all: we don't argue about whether it works. We measure it.
Two strategies, side by side, in real time
The original deterministic strategy and its agentic twin run as two independent paper books, forward, at the same time — no real capital at risk. One follows fixed rules; the other lets the AI propose within the wall. The only question that matters — does the agentic version actually beat the plain one, after costs, across different markets? — is settled by watching them, not by arguing. The console keeps a running scorecard of the two: their returns since they forked, how much each trades, and exactly where their holdings have diverged. If the agentic version doesn't win net of costs, that's a clean, honest result too — and we'd report it.
Everything the AI does is on the record. Every proposal, every trade suggestion, every verdict — with the exact prompt and response behind it, re-openable with one click, no new AI call. The model itself is chosen by a central layer that names a task, not a vendor, and swaps providers automatically — so the intelligence can be upgraded without touching the strategy.
One layer in a larger stack
The agentic layer invents nothing about markets on its own. It stands on foundations built first — each worth its own article:
Where strategies are authored as the readable rules you saw above, compiled to a sealed recipe, and run and backtested on real data. The agentic layer proposes changes to these rules; it never replaces the engine. Read the Algo Desk article →
The clean, point-in-time market data the whole stack reads — prices, Weinstein stages, momentum and accumulation signals, fundamentals — for Indian and US equities. Every "no hindsight" guarantee here rests on it.
The interactive terminal where a human reads the same signals the AI does — stage analysis, relative strength, institutional accumulation. The AI's "observe" step draws on the very same intelligence.
Measured, not marketed
It would be easy to call this "an AI that trades." It isn't, and it shouldn't be. The AI here is a tireless search over how a strategy could improve, kept honest by a wall it can't cross and watched by a live experiment it can't fake. Its worst instinct — dumping a winner — is impossible for it to act on.
The bet is patient: not a machine that calls the next move, but a strategy that compounds small, sensible improvements to its own rules over time — each one reversible, each one on the record. And if, after enough markets, the agentic version doesn't beat the plain one net of costs — we'll have measured that too, and we'll say so.
Dhakua Research builds research infrastructure. Nothing here is a recommendation, a tip, or a promise of returns — it is a description of how a system is engineered to be careful with a powerful, unpredictable tool.