The Starting Point
I have made a few attempts to achieve a fairly automated investing scheme for my savings. With two successful models of my discounted cash flow model earning a cumulative average of 50% over the last 2 years, it was about time I improved it with some agentic workflows.
With the current geopolitical unrest, it is important to consider all aspects of an investment. Time which I would rather spend on something else.
LLMs have proven to grow smarter each month at an exponential rate. Hence, it seemed like a fun experiment to let an LLM handle all decision making. This said, LLMs, as of now, have a habit of hallucinating — extrapolating from existing data to conclusions it does not have the evidence for, at an unreasonable rate.
However, with proper tool calling and reasoning with context, I have found that the LLM can be a very useful tool for making investment decisions.
The Safety Net — A Simulated Portfolio
To start off I need to initialise a few safety nets. The agent is not allowed to invest in real stocks. Instead I have built a simulated stock market. The agent is allowed to execute stock transactions within this sandbox while I monitor its performance.
Every buy, sell, and deposit is recorded to a transaction log. A portfolio snapshot is computed from this log at any time, tracking the current price of each holding, unrealised profit/loss using FIFO cost basis, and available cash. The agent can inspect this portfolio before making any decision.
How It Works
The system is structured as a main agent that orchestrates analysis and execution, supported by specialised subagents for deep research tasks. The main agent reasons over the full investment picture and delegates heavy computation to the right tool at the right time.
- A central reasoning agent coordinates everything — it decides when to delegate, when to act, and when to do nothing
- A financial analysis subagent digs into public company filings and runs valuation models to estimate intrinsic value
- A web research subagent gathers recent news, earnings commentary, and competitive context
- A portfolio layer manages all simulated trades, tracks holdings, and computes real-time profit and loss
Key Features
Probabilistic Cash Flow Valuation
Simulates thousands of possible futures from real free cash flow history, then estimates intrinsic value across a range of outcomes — conservative to optimistic — rather than pinning everything to a single number.
Direct SEC Filing Access
Pulls 10-K and 10-Q financials directly from SEC EDGAR. The agent can also read 8-Ks, insider Form 4 trades, and beneficial ownership filings in real time.
Persistent Memory
The agent writes its findings and reasoning to a memory file between runs. Next time it runs, it reviews prior conclusions before deciding whether any changes are actually warranted.
Web Search Integration
A dedicated subagent scours the web for recent news, earnings commentary, competitive developments, and macro context — anything that could materially affect long-term business value.
Simulated Portfolio Engine
Full transaction log with FIFO cost basis tracking, real-time price fetching, unrealised P&L per position, and available cash management.
Context Summarisation
As the agent's reasoning grows long, a summarisation middleware compresses older context automatically — keeping the agent focused without losing key findings.
The Investment Philosophy
The agent is not a trader. It is programmed as a value investor with a 3–5 year time horizon. Before any trade is executed, every item on a strict checklist must pass:
- A conservative intrinsic value has been estimated
- The current price is below that intrinsic value
- A margin of safety of at least 30% is present (50% preferred)
- The business model is understandable
- A durable competitive moat exists
- Management is competent and shareholder-aligned
- The balance sheet is strong with manageable debt
- Permanent loss risk is low
If any single item fails, no trade is made. Cash is held until a genuine opportunity appears. The primary directive is simple: preserve capital first, grow capital second. Never reverse this order.
The agent holds a concentrated portfolio of 3–10 positions plus cash. It never deploys all cash at once, never chases momentum, and never sells a position just because the price has fallen — only if the underlying business has fundamentally deteriorated.
What's Next
The current version runs as a sandbox experiment. The goal is to run it over a full market cycle and compare the simulated returns against the prior DCF models and the broader market. If it performs well under real conditions — managing volatility, avoiding permanent losses, and compounding steadily — the next step would be cautious deployment with a small real capital allocation.
The broader hypothesis being tested is simple: can a disciplined, rule-bound AI agent outperform the average retail investor not by being smarter, but by being more patient and less emotional?