Summary: Orchestration and shared state
For education only. This teaches multi-agent architecture using stock analysis as the example; it is not investment, financial, or trading advice.
A team of agents becomes one system through two things: orchestration (who runs next) and shared state (what they pass along). This lesson opens the code of the open-source TradingAgents framework (anchored to one frozen snapshot, marked 7e9e7b8) and reads the shared workspace every agent uses and the graph that routes control between them. This summary is the scan-in-five-minutes version of the full lesson.
Core ideas
Section titled “Core ideas”- Control flow and data flow are different problems. Control flow is whose turn it is; data flow is how one agent’s work reaches the next. They are solved by two different mechanisms, and a working system needs both.
- Shared state is one source of truth. The whole team reads from and writes to a single structured workspace. Each labelled space holds one piece of the work (the analyst reports, the judge’s plan, the trader’s plan, the final decision). The handoffs from earlier lessons are just reads and writes of those named spaces, so nobody passes private notes.
- The graph routes control with two kinds of arrow. A fixed arrow always goes to the same next agent (after the judge, always the trader; after the gate, stop). A conditional arrow runs a small function that reads the current state and picks the next step.
- You have already met the conditional arrows. The check on whether an analyst needs another tool call, the check on whether the debate continues, the check that rotates the three risk seats: each is a conditional edge of this one graph. The earlier lessons were reading pieces of a single map.
What changes for you
Section titled “What changes for you”The next time you ask AI to do more than one step, make these two decisions on purpose. For data flow, prefer a single source of truth: one place the work accumulates that every step reads from and writes to, rather than a chain of summaries that quietly lose detail. For control flow, name which handoffs are fixed (the order never changes) and which are conditional (the system loops, escalates, or finishes based on what has happened). When a multi-agent system misbehaves, the fault is usually in this wiring, a step that could not see an earlier step’s work, or a fork that routed the wrong way, not in any single agent.