← projects

[Twelve Roles]

Self-Hosted Multi-Agent Research

The open-source TradingAgents graph running on my own GPUs, fed by my optimizer and aware of the macro regime.

● EvolvingAgents & LLMsPersonalPythonLangGraphvLLMllama.cppPydantic
01 /context

TradingAgents is an open-source LangGraph project (by Tauric Research) where analyst, researcher, trader and risk agents debate one ticker and a Portfolio Manager issues a rating. Out of the box it targets paid APIs, runs one ticker at a time and knows nothing about the economy around it.

02 /my role

I did not design the 12-role graph, its checkpoints or its memory — those are upstream. What I added: parallel analysts, two new LLM providers, a GPU deployment, macro context for the final decision, a batch runner driven by my optimizer and a crypto variant.

03 /problem

Running the graph for a whole portfolio every day on paid APIs was slow and expensive, and the Portfolio Manager decided without knowing whether the central bank was tightening or easing.

04 /how it works
  1. 01 · Parallel analyst fan-out

    The four analysts (market, sentiment, news, fundamentals) run concurrently when a concurrency limit allows it, instead of one after another.

  2. 02 · OpenAI-compatible providers

    Added a hosted fast-inference API and my own vLLM endpoint as providers. Analysts run with reasoning off; managers run with reasoning on, toggled per request.

  3. 03 · Macro context in the decision

    The optimizer's regime (central-bank bias × growth, drivers, confidence) and each asset's macro alpha are written into the agent state and into the Portfolio Manager's prompt.

  4. 04 · Batch runner

    runner.py reads the optimizer's JSON, runs the graph per ticker, writes one decision file per asset plus a run summary, and flags divergences between weight and rating.

  5. 05 · Crypto variant

    A subclass keeps the whole graph and swaps only the analysts' data tools for market and DeFi data sources.

05 /architecture
01
Optimizer JSON
02
runner.py
03
4 analysts (parallel)
04
Bull ↔ Bear → Research Mgr
05
Trader → risk debate
06
Portfolio Mgr + macro
07
decision.json per asset
06 /interactive demo

what you're seeing

Each node is an agent. The four analysts on the left run in parallel; Bull and Bear debate; the Research Manager and Trader turn that into a plan; three risk profiles argue; the Portfolio Manager decides. The card on the right compares the rating with the weight the optimizer gave the same asset.

try this

  1. 1.Press Run analysis and watch which nodes light up together.
  2. 2.Run it a few times — when the rating comes out Sell while the weight is high, the divergence warning appears.
  3. 3.Raise the speed to see the shape of the graph instead of the text.

real vs simplified

The messages are scripted, not live LLM output, and the asset is fictional. The graph's shape is the open-source TradingAgents design; the parallel fan-out, the macro context given to the Portfolio Manager and the divergence check are my additions.
[lab] loading demo…
07 /results
The same code path runs against a local 9B model, my 27B deployment or a hosted API — only configuration changes.
Every decision records the regime it was made under, so ratings can be compared across regimes.
Unit tests cover the runner and the macro-context formatting.
08 /what broke and what I changed
  • ! brokeThe market analyst asked for indicators (like a 200-day moving average) that the data window couldn't compute.

    → changedThe prompt now states the data window and tells the model to skip indicators that don't fit; the lookback went up to 200 days.

  • ! brokeReasoning flags sent as top-level parameters were silently ignored by the OpenAI client.

    → changedThey're sent inside extra_body as chat-template arguments, per request.

09 /related