Summary: Memory and reflection
For education only. This teaches multi-agent architecture using stock analysis as the example; it is not investment, financial, or trading advice.
A good system does not just decide; it records what it decided and, once the outcome is known, reflects on it. This lesson opens the code of the open-source TradingAgents framework (anchored to one frozen snapshot, marked 7e9e7b8) and reads its memory log and reflection step. This summary is the scan-in-five-minutes version of the full lesson.
Core ideas
Section titled “Core ideas”- Record now, judge later. When a run finishes, the system writes the decision into a plain logbook and marks it not-yet-judged (pending). No model is used; recording is bookkeeping, not thinking. You cannot grade a call before you know how it turned out, so it waits.
- Reflection happens on a later run. The next time the same company is analyzed, the system settles the earlier pending decision first. By then real time has passed and the outcome is visible.
- The reflection is grounded in a real outcome, against a baseline. The system looks at what actually happened over the following days (five by default) and compares it to how a broad market slice moved over the same days (the framework uses the S&P 500). That comparison is a fairer test than a raw up-or-down. The short reflection is written on the cheaper model.
- The lesson is fed back to the point of decision. The accumulated history is injected into the next run, and only the final gate (the portfolio manager) reads it, the same agent that makes the last call and runs on the more capable model.
What changes for you
Section titled “What changes for you”When you want an AI workflow to improve over time, copy this shape. Record what your system decided when it decides, and resist judging it in the same breath, because the honest answer is not available yet. Later, once you can see what actually happened, reflect against that real outcome (and, where you can, against a baseline of what would have happened anyway), not against the system’s own confidence. Keep the lessons short enough to re-read, and feed them back to the step that makes the decision. This is about a system learning from experience, recording whether its past calls were right or wrong; it is not a claim that the system makes money or predicts the market.