Skip to content

The Map Forward: Stateful Agents and Causal Architecture

By OpenKuber Research ·

Author: Paul K
Published Date: 2026-03-27T08:23:22.422Z


Part 1 was the diagnosis. Part 2 is the architecture — why LLM agents fail without memory, what actually moves NSE stocks, and what we're building next.

Before We Build Anything: What We're Actually Solving

Part 1 documented the failure. But failure is only useful if it teaches you what to build differently. From 167,000 lines of execution logs and 67 days of live trading, three distinct and separable problems emerged. They are not all the same problem with different symptoms, they need different solutions, at different layers of the stack.

Image

Each of these three broken pieces - stateless agents, wrong signal hierarchy, and undifferentiated model roles; has its own emerging body of research and its own solution space. This part covers all three.

Why Every LLM Woke Up Stupid Every 30 Minutes

The most visceral failure in the logs — Kimi-K2 with ₹70.78 trying to analyse five stocks it can't afford, cycle after cycle — is a textbook illustration of the LLM statelessness problem. It has a name in the research literature, and it's been studied extensively.

"Every request to a large language model is stateless — the model only knows what is contained in the prompt you send at that moment. To simulate memory, the system has to manage context explicitly: choosing what to keep, what to discard, and what to retrieve before each new model call. This is why memory is not a property of the model itself. It is a system design problem."
— Towards Data Science, "Agentic AI: Implementing Long-Term Memory" (2025)

Think of the movie Memento — the protagonist who wakes up each day with no continuity from the day before, using post-it notes to piece together what happened. That was every LLM in our system, except the "post-it notes" were a compressed market snapshot with no portfolio history, no record of which symbols had already been traded, and no awareness of available capital.

What the research says about fixing this

A-MEM (Agentic Memory for LLM Agents), published at NeurIPS 2025, proposed dynamic memory organisation using principles from the Zettelkasten knowledge management method, where each new memory creates an interconnected note with contextual descriptions, keywords, and crucially, links to existing memories where meaningful similarities exist. This is the approach that would have let our agents know "I already hold 81 shares of ETERNAL from Tuesday" before running another 4-step buy analysis on it.

An earlier ACM survey on LLM agent memory mechanisms identified the core design gap: most memory systems "enable basic storage and retrieval but lack sophisticated memory organisation." The problem isn't that agents can't remember, it's that they don't know which memories are relevant to the current decision, and they don't evolve their understanding as new information comes in.

For trading specifically, the failure pattern we observed is called "recency decay", where the model, confronted with a long context window of prior decisions, ignores older state in favour of immediate signals. Research from Google DeepMind's Gemini 2.5 technical report documented this: information buried deep in a massive context is often ignored or retrieved unreliably. A large context window is not a memory system.

The Memento Problem in Finance
For a trading agent operating in 30-minute cycles, what needs to persist is specific: current positions and their cost basis, symbols already traded this session, remaining capital, which positions are underwater vs. profitable, and which thresholds have already been hit. This is a tiny amount of structured state — not a knowledge graph. The problem is that none of our implementations treated it as persistent state. It was reconstructed from scratch via API calls every cycle, which introduced latency, network failures, and the ₹70.78 scenario where the reconstruction was delayed or wrong.

What Actually Moves NSE Stocks — and Why It's Counterintuitive

The signal hierarchy problem is the one that gets the most attention in post-mortems because it's the most visible failure. But understanding it properly requires going beyond "we should have used macro data", the actual dynamics of Indian markets are more nuanced and, in several ways, counterintuitive even to experienced investors.

FII flows: the dominant force, but not in the way you think

The dominant folk theory of Indian markets is that FII flows drive everything, when foreigners buy, Nifty goes up; when they sell, it goes down. The data is more interesting than that. A study covering 2015–2025 Nifty flows found that FII net positions explain only about 16.5% of the variance in market performance. The R-square of 0.165 means that 83.5% of what moves the Nifty is explained by something other than foreign flows.

What the same research found was more useful: DII (domestic institutional) flows showed a strong positive association with index stability, particularly during FII exit years. The story of India's equity market post-2020 is partly the story of retail investor SIP money entering via mutual funds, creating a domestic bid that partially offsets global risk-off episodes. Any model that treats FII flow as the only flow data it needs is, at best, working with a third of the picture.

Image

RBI communications: the signal that moves in the wrong direction

This is the finding that most surprised us when we went looking for research to ground Part 2. An NLP study analysing a decade of RBI monetary policy communications (2014–2024) using BERTopic and a fine-tuned RoBERTa model found something counterintuitive: dovish sentiment in MPC communications generally led to declines in Indian equity markets, particularly in topics related to interest rate policy and economic growth.

The interpretation: market participants read dovish language as a signal of economic weakness, not as a stimulus. The RBI cutting rates isn't automatically bullish for equities, it often means the central bank is worried, and the market responds to the worry more than to the rate relief. This means any model naively mapping "dovish = buy banks" would be systematically wrong on event days.

The RBI Signal Inversion

When the RBI announced a surprise rate cut and simultaneously slashed the CRR by 50bps in early 2025, injecting ₹1.16 lakh crore into the banking system; banking stocks like HDFC Bank, Axis Bank, and ICICI Bank initially rallied. But the research shows this is a special case: it was the liquidity injection that markets responded to positively, not the dovish tone. Pure language analysis of "rate cut expected" signals would have predicted the opposite. This distinction matters for any system trying to parse RBI communications as a trading signal.

HDFCBANK: the case study in non-technical drivers

HDFCBANK - one of the most actively traded stocks in our portfolio illustrates exactly why technical-only analysis fails on individual securities. The stock experienced a significant intraday drop in March 2026 following the sudden resignation of its Part-time Chairman. No RSI reading, no MACD crossover, no EMA trend was going to predict that event or tell you what it meant for the stock's near-term trajectory.

The bank is simultaneously working through the integration of HDFC Ltd's mortgage systems, a multi-year technical project with execution risk, while competing aggressively for deposits in a tightening credit-deposit ratio environment. These are the actual drivers of the stock's daily price action. They have no expression in a 14-day RSI.

A Layered Architecture for NSE-Aware Intelligence

If technical indicators are the last layer - entry/exit timing - what are the layers above them? Here's the hierarchy we're now building toward, grounded in the research above and in the log evidence from Part 1.

Image

The entire Anakin system, all 12 causal features, all 6 LLM strategies, all 9,677 trades, operated exclusively at L6. It was a precise, well-engineered engine for the bottom layer of a six-layer decision stack, running as if the other five layers didn't exist.

Why Six Models Doing the Same Thing Doesn't Give You Six Times the Edge

There's a design assumption buried in the tournament structure that deserves scrutiny. Running six different LLMs in parallel with different providers felt like diversification. In practice, every model received the same compressed market snapshot and executed the same four-step pipeline: QuickTradeFilter → CalculatePositionSize → PlaceMarketOrder → Check Guardian. The underlying signal source was identical. The models were differentiated by provider and parameter count not by what they were asked to see.

Image

What we had was six generalists with the same tools. What we needed was a team of specialists where each agent's information access was narrow, deep, and persistent within its domain. The lesson extends beyond trading: in any multi-agent system, diversity of information source matters more than diversity of model architecture.

The Groq models and the rate limit cliff

There's an operational failure baked into the Groq-hosted strategy choices that compounded the architectural problem. The Groq API has tight TPM (tokens per minute) limits on its free and lower tiers — which is why the market context was compressed to the minimal SYMBOL:LTP|R:RSI|T:trend format. That compression was a necessary workaround for a rate limit constraint, but it also stripped out almost all the signal. The system's data poverty was partly a product of its infrastructure choices, not purely a design decision.

This matters for anyone replicating this architecture: don't let infrastructure constraints dictate information architecture. If token limits prevent you from giving the model the context it needs, fix the infrastructure don't compress the context until the model is reasoning from nothing.

The "Why Is [Stock] Moving Today?" Engine

The core question that drives IROHA's design is deceptively simple. When a retail investor or SEBI-registered RIA opens their app in the morning and sees HDFCBANK down 2.3%, the useful thing to know isn't what RSI says. It's: why is this happening, what caused it, and what does it mean for my position?

That question framed properly is a causal inference problem. Not prediction. Not pattern-matching. Causation: trace the movement back to its actual upstream drivers and express them in a structured, defensible chain of evidence.

bash

# The query IROHA is designed to answer

User: "Why is HDFCBANK down 2.3% today?"

IROHA causal chain:
[L1] Global: US 10Y yield +12bps overnight → risk-off in EM equities
[L2] RBI: MPC minutes hawkish on core inflation → NIM compression expected
[L3] FII: Net sellers ₹2,847Cr in banking sector today (provisional)
[L4] Event: Chairman resignation (March 18) — leadership risk premium still active
[L6] Technical: Price broke below 200-day EMA → momentum selling triggered

# Result: causal graph + confidence weights + cited sources
# Not a buy/sell signal. A structured explanation.

This is fundamentally different from what Anakin was doing. Anakin was trying to decide whether to trade based on technical signals. IROHA is trying to explain why something is moving and give the RIA or investor the information they need to decide what to do. The judgment call stays human. The causal chain is machine-assembled from verified sources.

The causal graph UI: Every node in the IROHA interface is a cause: an RBI statement, an FII flow number, a filed corporate event. Click it and you get the source, the timestamp, the magnitude, and how confident the model is about its contribution. The graph shows you the full ontology of a stock movement: not just that HDFCBANK dropped, but why, with what evidence, traced back to each upstream signal that caused it.

The model doesn't assert. It synthesises and attributes. So when a SEBI-registered RIA needs to explain a portfolio decision to a client, the answer is never "the AI said so" it's a specific RBI document, a specific FII flow figure, a specific filing date.

What 67 Days Actually Taught Us About Agentic Systems in Finance

we did not do it for the meme it just ended up at that number after we ran out of credits

Beyond the specific failures documented in Part 1 and the architectural solutions in this part, running a live multi-agent trading system for two months taught lessons that don't fit cleanly into any section header.

Parallelism is a trap without shared state

The six strategies running in parallel shared a market data cache but had completely independent portfolio states. This meant each strategy was making decisions in a vacuum ETERNAL might be overbought in four of six portfolios simultaneously, consuming capital across all of them on the same (wrong) thesis. If the strategies had shared at minimum a "consensus signal" layer, even just an aggregated view of how many models were leaning bullish or bearish on each symbol the correlated failures would have been dampened.

The most conservative model survived

By March 20, Anakin had ₹88,421 in available cash. Kimi-K2 had ₹70.78. GPT-4.1-nano was somewhere in between with substantial but not clean capital. The model that refused to trade when the causal signal was below 0.15% frustrating as it was to watch pass on every cycle preserved more optionality than the models that traded aggressively on weak signals. In a live system, staying solvent is the precondition for everything else. The threshold was not conservative enough to avoid losses, but it was conservative enough to avoid catastrophic losses.

Aggressive execution on uncertain signals is not confidence. It is the noise-amplification mode of a system that doesn't know what it doesn't know. The 0.15% threshold was Anakin's only form of epistemic humility, and it was the most valuable thing in the system.

Indian markets are not a smaller US market

Every piece of trading system literature, every LLM finance paper, and most algorithmic trading tutorials are written with US equity markets as the implicit reference. The signal relationships are different there RSI has been studied extensively on S&P 500 constituents, TradingAgents was evaluated on AAPL, GOOGL, and AMZN, and most academic backtests use US data. The transfer learning assumption that what works in US equity markets scales to Indian markets with a symbol substitution is simply false.

India has monsoon cycles. India has the RBI's unique communication style (where dovish language can move markets in the wrong direction). India has FII flows that are structurally different from US institutional flows. India has a domestic SIP investor base that absorbs selling pressure in ways the US retail market doesn't. Any system designed for Indian markets needs to be designed for Indian markets not adapted from a US template.

What We're Actually Building Now

IROHA is not a trading system. It's an inference and explanation system for Indian equity markets, the research and reasoning layer that sits before any execution decision. The architecture has three components being built in parallel.

Image

The execution layer — live orders, the SymbolicGuardian, the agentic broker loop — comes after these three are stable. We will not connect execution to a reasoning system that doesn't understand why things are moving first. Anakin taught us that lesson in 167,000 lines of logs.

The Design Principle

IROHA's north star is this: a SEBI-registered RIA should be able to show a client why their portfolio moved today, with every claim backed by a verifiable source, expressed in plain language, and structured as a causal chain rather than a correlation score. The model earns trust through transparency, not through predictions that may or may not be right.

Why We're Sharing the Failure

The decision to publish this post-mortem with real logs, real P&L numbers, real model names is not performative transparency. It's strategic.

Indian fintech is building fast and publishing slow. Most companies wait until they have a success story before they talk publicly. This means the field accumulates a lot of unreported failure; teams reinventing the same broken wheels, discovering the same signal blindspots, making the same architectural mistakes with agent memory, and paying the same tuition fees to markets that don't care about your roadmap.

If someone building an agentic trading system for NSE reads Part 1 and Part 2 and decides not to run six stateless LLMs against pure RSI signals, we've shortened their learning curve by about 67 trading days. That's worth the cost of publishing our losses.

The full trade history every order, every block, every loop, every cycle is public at labh.openkuber.com/history. If you're building in this space, it's yours to learn from.

Anakin failed because it was looking at shadows on the cave wall. IROHA has to look at the fire. And the fire — in Indian markets — is macro signals, institutional flows, central bank language, climate data, and corporate events. Not a 14-day RSI.

OpenKuber provides research infrastructure to regulated financial firms. Nothing on this site is investment advice or a recommendation to buy, sell or hold any security. OpenKuber is not registered with SEBI as an investment adviser or research analyst. Past price moves and model results do not indicate future performance. LabhLabs results come from paper trading; no real money is used.

Related: How to Build AI That Explains Itself: Causal Ontology in IROHA · Why Anakin Failed Performing in Indian Markets · How IROHA works