The risk gate: cheatsheet
For education only. Multi-agent architecture taught via stock analysis; not investment, financial, or trading advice.
The one idea
Section titled “The one idea”Before the plan is final, stress-test it with reviewers who disagree, then send it through a separate gate that can overrule. (Anchored to the TradingAgents framework, frozen snapshot 7e9e7b8; risk seats in agents/risk_mgmt/, gate in agents/managers/portfolio_manager.py.)
Why three reviewers, not one
Section titled “Why three reviewers, not one”One reviewer (or three who think alike) misses what a deliberately mixed panel catches. The three seats read the same trader plan but hold different attitudes toward risk, and each is told to challenge the other two:
- Risk-seeker: “actively champion high-reward, high-risk opportunities.”
- Guardian: “primary objective is to protect assets, minimize volatility, and ensure steady, reliable growth.”
- Balancer: “provide a balanced perspective, weighing both the potential benefits and risks.”
The disagreement is the feature. The plan gets pressure from every direction at once.
The rotation and the stop
Section titled “The rotation and the stop”| Question | Answer | In the code |
|---|---|---|
| Stop yet? | Enough turns happened, hand to the gate | if count >= 3 * max_risk_discuss_rounds: return "Portfolio Manager" |
| Who is next? | Bold then cautious then balanced, then repeat | routed by latest_speaker |
Default is one round: each of the three seats speaks once, then the gate. (The file has a loose “3 rounds” comment; behavior follows the number, which defaults to one.) Factor three because there are three seats.
The gate
Section titled “The gate”The Portfolio Manager argued none of the three positions. It reads the whole risk discussion plus the earlier plans, then issues the final decision (one of five stances: Buy, Overweight, Hold, Underweight, Sell), written to shared state as the final trade decision. (Those labels are the system’s own architectural choice, not advice to you.)
What makes it a real gate:
- Separate role: it can confirm, soften, or overrule the trader’s proposal.
- Deep model: it runs on the more capable model, the second of exactly two deep-model agents (the first was the judge after the bull and bear debate). Capability and authority sit at the two decision points.
How to follow along
Section titled “How to follow along”Read it free in your browser at github.com/TauricResearch/TradingAgents (pinned snapshot). No account, no Git, no programming knowledge needed. The short code 7e9e7b8 marks one frozen version, so the lessons match what you see.
Build your own (the transferable pattern)
Section titled “Build your own (the transferable pattern)”- Add a review after the work is produced; use more than one reviewer with genuinely different priorities, responding to each other.
- Bound the review; decide how many rounds and end it there.
- Put a separate gate at the end, with authority to confirm/change/reject and your most capable model.
Pitfalls to dodge
Section titled “Pitfalls to dodge”- The makers approving their own work (no gate, just a signature).
- A like-minded review panel (misses everything outside its shared bias).
- A gate with no teeth (cannot change or reject, so it is decoration).
Words to use precisely
Section titled “Words to use precisely”- Risk review: stress-testing a finished plan with reviewers of different risk attitudes.
- Gate: a separate final authority that reads the review and can overrule.
- Teeth: the gate’s actual power to change or reject, not just approve.