Skip to content

How an agent fetches its own data, in brief

About this track: Clawdemy uses the open-source TradingAgents framework (by TauricResearch; Yijia Xiao, Edward Sun, Di Luo, and Wei Wang; arXiv:2412.20138; Apache-2.0) as a real-world example of how an agentic AI system is structured. Our goal is to teach the architecture: how specialist agents, a research debate, a trader role, and a risk layer are coordinated by an orchestrator. We are not teaching you how to invest, trade, or pick stocks, and we make no claim that this or any AI system is profitable or predicts markets. This content is for education only and is not investment, financial, or trading advice. Rules vary by country, and this is not advice anywhere. The Trading Agents Lab capstone is a simulation you explore yourself with your own AI provider key; it does not place real trades. The framework’s own authors state it plainly: “It is not intended as financial, investment, or trading advice.”

Lesson 1 introduced the team and said the analysts gather information. This lesson shows how, and it is the first time we open the actual code. The analysts are not handed data; each is given a small set of tools and sent to fetch its own facts, deciding what to pull and when it has enough.

Reading the real market analyst, you will see the three pieces that make this work: the analyst is given a narrow toolbox (just two tools), the tools are attached to the model so it can ask to call them, and the system runs a loop (the model asks for a tool, the tool runs, the result comes back, the model decides again) that ends the moment the model stops asking for tools. You will also see a small but telling design touch: each analyst’s working notes are wiped before the next one starts, so only the finished report survives. The throughline is transferable: an agent gathers for itself through the tools you give it, and the stop condition you choose is what keeps the loop from running forever.

Everything is anchored to one snapshot of the framework (a frozen version marked 7e9e7b8), and every code claim is checked against that source.

This is the second lesson of the track and the first that reads code. Lesson 1 was the map; from here we walk the system one stage at a time. Lesson 2 covers how the analysts gather; lesson 3 turns to the bull-and-bear debate that weighs what they found, and the rest of the track continues through synthesis, the risk gate, orchestration and shared state, memory, and a hands-on capstone.

Prerequisites: lesson 1 of this track (the team and why it is split), and the foundational tool-use lesson (how a tool turns a model into an agent). You should be comfortable with the idea of an agent as a model with a focused job. You do not need to install or run anything; the project can be read in your browser, and every excerpt is quoted in the lesson.

  • Explain how a tool lets a model act in the world instead of only producing text
  • Describe the tool-use loop (think, call a tool, read the result, decide again) and what makes it stop
  • Identify the market analyst’s tools and the structural signal that ends its loop
  • Analyze why an agent that fetches its own data is more capable but less predictable
  • Apply the small-toolbox-plus-explicit-stop pattern to a role in your own agent system
  • Read time: about 9 minutes
  • Practice time: about 15 minutes (a self-check, a design exercise, and flashcards)
  • Difficulty: deep (this track is the advanced end of the catalog; the foundational agent tracks are the on-ramp)