cyberagent 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 K.C
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,340 @@
1
+ Metadata-Version: 2.4
2
+ Name: cyberagent
3
+ Version: 0.1.0
4
+ Summary: Physical-bottleneck, reverse-consensus investment analysis for every market — an LLM agent chain that traces any asset (A-share / HK / US stocks, crypto) to its supply-chain constraint and refuses to chase narrative-driven tops. Bring your own LLM key.
5
+ Author-email: CyberK13 <klchen0113@gmail.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/CyberK13/cyberagent
8
+ Project-URL: Source, https://github.com/CyberK13/cyberagent
9
+ Project-URL: Documentation, https://github.com/CyberK13/cyberagent#readme
10
+ Project-URL: Issues, https://github.com/CyberK13/cyberagent/issues
11
+ Project-URL: Changelog, https://github.com/CyberK13/cyberagent/blob/main/CHANGELOG.md
12
+ Keywords: ai-agent,llm,equity-analysis,stock-analysis,crypto-analysis,multi-agent,langchain,crewai,mcp,chain-of-thought,investment-research,quantitative-finance
13
+ Classifier: Development Status :: 2 - Pre-Alpha
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Intended Audience :: Financial and Insurance Industry
16
+ Classifier: License :: OSI Approved :: MIT License
17
+ Classifier: Operating System :: OS Independent
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3 :: Only
20
+ Classifier: Programming Language :: Python :: 3.9
21
+ Classifier: Programming Language :: Python :: 3.10
22
+ Classifier: Programming Language :: Python :: 3.11
23
+ Classifier: Programming Language :: Python :: 3.12
24
+ Classifier: Topic :: Office/Business :: Financial :: Investment
25
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
26
+ Requires-Python: >=3.9
27
+ Description-Content-Type: text/markdown
28
+ License-File: LICENSE
29
+ Requires-Dist: pydantic<3.0,>=2.0
30
+ Requires-Dist: httpx>=0.25
31
+ Provides-Extra: stocks
32
+ Requires-Dist: yfinance>=0.2; extra == "stocks"
33
+ Provides-Extra: web
34
+ Requires-Dist: flask>=3.0; extra == "web"
35
+ Provides-Extra: openai
36
+ Requires-Dist: openai>=1.0; extra == "openai"
37
+ Provides-Extra: gemini
38
+ Requires-Dist: google-genai>=0.2; extra == "gemini"
39
+ Provides-Extra: claude
40
+ Requires-Dist: anthropic>=0.8; extra == "claude"
41
+ Provides-Extra: test
42
+ Requires-Dist: pytest>=7.0; extra == "test"
43
+ Provides-Extra: dev
44
+ Requires-Dist: pytest>=7.0; extra == "dev"
45
+ Requires-Dist: ruff>=0.6; extra == "dev"
46
+ Provides-Extra: all
47
+ Requires-Dist: yfinance>=0.2; extra == "all"
48
+ Requires-Dist: flask>=3.0; extra == "all"
49
+ Requires-Dist: openai>=1.0; extra == "all"
50
+ Requires-Dist: google-genai>=0.2; extra == "all"
51
+ Requires-Dist: anthropic>=0.8; extra == "all"
52
+ Dynamic: license-file
53
+
54
+ <div align="center">
55
+
56
+ # 🧠 cyberagent
57
+
58
+ ### Physical-bottleneck, reverse-consensus investment analysis — for *every* market
59
+
60
+ A chain of LLM agents that traces any asset down to the **physical constraint**
61
+ that caps its industry, checks whether the market has **already priced it**, and
62
+ **refuses to chase a narrative-driven top**. Stocks (A-share / HK / US) and
63
+ crypto (token / contract). Bring your own LLM key.
64
+
65
+ [![PyPI](https://img.shields.io/pypi/v/cyberagent.svg)](https://pypi.org/project/cyberagent/)
66
+ [![Python](https://img.shields.io/badge/python-3.9%2B-blue.svg)](https://www.python.org/)
67
+ [![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
68
+
69
+ ### 🌐 Language / 蝭荀
70
+
71
+ **English** &nbsp;|&nbsp; [įŽ€äŊ“中文](README.zh.md)
72
+
73
+ </div>
74
+
75
+ ---
76
+
77
+ > 🚧 **Early release.** The analysis engine works end-to-end today; the
78
+ > public API may still evolve before `1.0`.
79
+
80
+ ---
81
+
82
+ ## What makes it different
83
+
84
+ Most open-source "AI analyst" frameworks ask *"is this a good company?"* and
85
+ return a textbook SWOT. cyberagent asks a sharper, **falsifiable, reverse-consensus**
86
+ question, in a fixed order:
87
+
88
+ > **Physical bottleneck → uniqueness → commercialization → financial elasticity → consensus correction**
89
+ >
90
+ > *Where is the physical constraint in this asset's supply chain? Is it unique?
91
+ > Can it be monetized? Does it have non-linear financial elasticity? And has the
92
+ > market already priced it in?*
93
+
94
+ It is built on one idea from Leopold Aschenbrenner's *[Situational Awareness](https://situational-awareness.ai/)*:
95
+ **AI scaling is a massive *industrial* process**, bottlenecked by physical inputs —
96
+ power, transformers, HBM, CoWoS packaging, specific materials. cyberagent
97
+ operationalizes that thesis: it walks the supply chain down to the link
98
+ *"no amount of money can buy"*, and then applies hard anti-narrative discipline so
99
+ it doesn't mistake a headline-driven spike for an opportunity.
100
+
101
+ It does **not** predict prices. It produces facts, a falsifiable logic chain, and
102
+ monitorable physical signals — the final decision is yours.
103
+
104
+ ---
105
+
106
+ ## Intellectual foundations
107
+
108
+ cyberagent stands on two ideas and turns them into a reproducible, falsifiable
109
+ agent chain.
110
+
111
+ ### Leopold Aschenbrenner — *Situational Awareness* (the **why**)
112
+
113
+ In *[Situational Awareness: The Decade Ahead](https://situational-awareness.ai/)*,
114
+ Aschenbrenner argues that **AI scaling is a massive *industrial* process**, not a
115
+ software one: every frontier model needs a bigger cluster, then bigger power
116
+ plants, then bigger fabs. So the binding limits are **physical** — power,
117
+ transformers, HBM, CoWoS packaging, specific materials — and effective compute
118
+ compounds at roughly an order of magnitude (OOM) per year (GPT‑2 → GPT‑4 → ~2027
119
+ AGI). The people with *situational awareness* build conviction from the trendlines
120
+ **years before consensus prices them**. cyberagent treats the market as that
121
+ physical system; the thesis is distilled in [`references/sa-canon.md`](references/sa-canon.md).
122
+
123
+ ### Serenity & Crux — the bottleneck method (the **how**)
124
+
125
+ The practitioner discipline comes from supply-chain bottleneck hunters such as
126
+ **Serenity** ([@aleabitoreddit](https://x.com/aleabitoreddit)) and **Crux Capital**.
127
+ Instead of asking *"which stock goes up?"*, they **take the machine apart and look
128
+ for the chokepoint**:
129
+
130
+ > *What does the machine actually look like? Which part of its BOM is the hardest
131
+ > to replace? If one supplier stopped shipping tomorrow, how long would the whole
132
+ > chain wait?*
133
+
134
+ - **Serenity** is *narrow and deep* — find one decisive choke point and concentrate.
135
+ - **Crux** is *wide and disciplined* — map a ~6-layer stack and size each layer by execution certainty, separating proven executors from early optionality.
136
+
137
+ cyberagent distills that discipline into a fixed, falsifiable chain that any LLM
138
+ can run across any market.
139
+
140
+ > We borrow their **method** — tracing a supply chain to its physical chokepoint,
141
+ > asking *"where does the chain break"*, separating execution from optionality. We
142
+ > do **not** impersonate them, quote them, or present their positions as fact.
143
+
144
+ ---
145
+
146
+ ## How it works
147
+
148
+ The chain is a **telescope** — it zooms from physical reality down to the specific,
149
+ actionable name, one grounded LLM call per stage (each reads the upstream reports):
150
+
151
+ > **Positioning → Physical World → Human Development → Economics → Company Financials → Leaders & Verdict**
152
+
153
+ That telescope is how the five-step *method* above (bottleneck → uniqueness →
154
+ commercialization → elasticity → consensus) actually gets executed.
155
+
156
+ ```mermaid
157
+ flowchart LR
158
+ IN["Any asset<br/>NVDA ¡ 600519 ¡ 0700 ¡ BTC ¡ 0xâ€Ļ"] --> CL{{AssetClassifier}}
159
+ CL --> AD["Data adapters<br/>yfinance ¡ CoinGecko ¡ DefiLlama<br/>+ price action + analyst consensus"]
160
+ AD --> P0["Phase 0 · Positioning<br/>core business → physical-world position"]
161
+ P0 --> D1[physical] --> D2[human_dev] --> D3[economics] --> D4[financials] --> D5[leaders]
162
+ D5 --> R["AnalystReport<br/>ACCUMULATE ¡ HOLD ¡ REDUCE ¡ AVOID"]
163
+ ```
164
+
165
+ **Phase 0 — Positioning.** From the fundamentals, lock down what the company
166
+ actually sells, then pin it to a specific layer of the physical / AI supply chain
167
+ (materials → substrate → equipment → packaging → device → module → system → end
168
+ demand) and a concrete machine (e.g. a *GB300 NVL72 rack*, a *1.6T optical link*).
169
+
170
+ **Five departments**, run in sequence, each reading the upstream reports:
171
+
172
+ | Dept | `key` | What it does |
173
+ |---|---|---|
174
+ | đŸĒ¨ Physical World | `physical` | Locate the binding bottleneck on the SA ladder (power > CoWoS/HBM > raw logic); classify the asset as **owner / adjacent / derivative / none**. Non-owner ⇒ downgraded, scarcity-rent logic forbidden. |
175
+ | 🌍 Human Development | `human_dev` | Place the demand on the AGI / OOM arc — early (runway left) or mature/peaked? |
176
+ | 💱 Economics | `economics` | ore-seller vs processor; **decompose the price move into earnings-growth vs multiple-expansion**; detect valuation-framework switches; is it *already priced* (Gray Rhino vs loud consensus)? |
177
+ | 📈 Company Financials | `financials` | Fundamentals + financial elasticity (linear vs non-linear); attribute earnings anomalies *before* flagging them. |
178
+ | đŸŽ¯ Leaders & Verdict | `leaders` | Two-axis verdict — **bottleneck identity (a) vs pricing position (b)** — steelman + Munger inversion, monitorable exit signals, final decision. |
179
+
180
+ ### The discipline (why it won't chase a top)
181
+
182
+ This is the part textbook frameworks skip:
183
+
184
+ - **Real-time grounding** — with Gemini it *searches why a price moved* (the catalyst, who said what), instead of trusting model memory.
185
+ - **Price-action guardrail** — the data layer flags parabolic / near-high moves; a stock that doubled in days on one headline is an **AVOID / observe** form, never a buy.
186
+ - **Evidence ladder** — every key claim is tagged `Confirmed / Inferred / Weak`; a load-bearing `Inferred` claim caps the confidence.
187
+ - **Two independent axes** — *"is it a bottleneck"* (classification) and *"should you buy it here"* (pricing) are never conflated. A non-bottleneck can be a fine trade at a price; a real bottleneck at a top can be a bad one.
188
+ - **Honest "too late"** — parabolic move + extreme valuation + loud consensus ⇒ the label is *"too late / top"*, not an opportunity.
189
+
190
+ > Educational and research use only. Output quality varies with the model, data,
191
+ > and many non-deterministic factors. **This is not financial, investment, or
192
+ > trading advice.**
193
+
194
+ ---
195
+
196
+ ## Quickstart
197
+
198
+ ```python
199
+ import asyncio
200
+
201
+ from cyberagent import AnalystChain
202
+
203
+ chain = AnalystChain(llm="gemini", api_key="...", lang="en") # grounding on by default
204
+
205
+ report = asyncio.run(chain.analyze("NVDA")) # US ¡ or 600519 (A-share) / 0700 (HK) / BTC / 0x6B17...
206
+
207
+ print(report.final_decision) # ACCUMULATE / HOLD / REDUCE / AVOID
208
+ print(report.confidence) # 0.0 - 1.0
209
+ print(report.positioning) # Phase 0 — core business + physical position
210
+ print(report.departments["physical"].markdown)
211
+ print(report.departments["leaders"].markdown)
212
+ ```
213
+
214
+ (Inside Jupyter or an async app, call `await chain.analyze("NVDA")` directly.)
215
+
216
+ **One import, any market.** Pick the report language with `lang="zh"` / `"en"`;
217
+ the whole report is generated in it.
218
+
219
+ ---
220
+
221
+ ## Install
222
+
223
+ ```bash
224
+ pip install 'cyberagent[stocks,gemini,web]' # recommended: stock data + grounded Gemini + local web UI
225
+ ```
226
+
227
+ Extras: **`stocks`** (yfinance) ¡ **`gemini` / `openai` / `claude`** (providers) ¡
228
+ **`web`** (local UI) ¡ **`all`** (everything). The bare `pip install cyberagent` is
229
+ the zero-dependency core.
230
+
231
+ ## Set up your API key
232
+
233
+ cyberagent is **bring-your-own-key**. Gemini is the default and the only provider
234
+ with real-time grounding — recommended.
235
+
236
+ **1. Get a key** — Gemini is free to start:
237
+ [aistudio.google.com/app/apikey](https://aistudio.google.com/app/apikey).
238
+ (Other providers: [OpenAI](https://platform.openai.com/api-keys) ¡
239
+ [Anthropic](https://console.anthropic.com/) ¡
240
+ [DeepSeek](https://platform.deepseek.com/).)
241
+
242
+ **2. Configure it** — create a `.env` file in the folder you run from:
243
+
244
+ ```bash
245
+ echo 'GOOGLE_API_KEY=your_key_here' > .env
246
+ ```
247
+
248
+ (All supported variables are listed in [`.env.example`](.env.example).)
249
+ The CLI and web UI auto-load `.env`. In code you can pass it directly instead:
250
+
251
+ ```python
252
+ AnalystChain(llm="gemini", api_key="your_key_here")
253
+ ```
254
+
255
+ **3. Run it** — `cyberagent` (interactive) or `cyberagent serve` (web). The model
256
+ picker shows a ✓ next to every key it found in your `.env`.
257
+
258
+ ## Bring your own LLM key
259
+
260
+ Gemini is the default (and the only provider with real-time grounding). You can
261
+ also pass any provider or a custom adapter:
262
+
263
+ ```python
264
+ from cyberagent import AnalystChain, LLMAdapter, MockLLM
265
+
266
+ AnalystChain(llm="gemini", api_key="...") # default, grounded
267
+ AnalystChain(llm="openai", api_key="sk-...")
268
+ AnalystChain(llm="claude", api_key="...")
269
+ AnalystChain(llm="deepseek", api_key="...")
270
+ AnalystChain(llm=MockLLM()) # offline, no key — try the flow
271
+
272
+ class MyLLM(LLMAdapter):
273
+ async def complete(self, system: str, user: str) -> str: ...
274
+ AnalystChain(llm=MyLLM())
275
+ ```
276
+
277
+ Keys are read from the environment / a local `.env` (see [`.env.example`](.env.example)).
278
+
279
+ ## CLI & local web page
280
+
281
+ ```bash
282
+ cyberagent # interactive: pick language + model, then a symbol
283
+ cyberagent analyze NVDA --llm gemini --lang en
284
+ cyberagent analyze BTC --depts physical,economics,leaders # subset, faster
285
+ cyberagent serve # local web UI at http://127.0.0.1:8000
286
+ ```
287
+
288
+ The CLI and web page show a model picker that auto-matches the API key found in
289
+ your `.env` (✓ / ✗), live per-department progress, and the rendered report.
290
+
291
+ ---
292
+
293
+ ## Use as a Claude Skill — no install
294
+
295
+ The whole methodology is also packaged as a self-contained **Claude Skill** in
296
+ [`SKILL.md`](SKILL.md) — it runs the same physical-bottleneck chain in pure-prompt
297
+ form, no Python required. To install it in **Claude Code**:
298
+
299
+ ```bash
300
+ mkdir -p ~/.claude/skills/physical-bottleneck-analyst
301
+ curl -fsSL https://raw.githubusercontent.com/CyberK13/cyberagent/main/SKILL.md \
302
+ -o ~/.claude/skills/physical-bottleneck-analyst/SKILL.md
303
+ ```
304
+
305
+ Then just ask: *"analyze NVDA"* — Claude picks the skill up automatically. (Any
306
+ other agent that loads skills works the same way: give it `SKILL.md`.) The Python
307
+ package adds live data, real-time grounding, and the CLI / web UI on top.
308
+
309
+ ## Methodology & prompts — fully open
310
+
311
+ There is no paywall. *How* to hunt a physical bottleneck is framework knowledge,
312
+ not alpha. The complete system prompts live in
313
+ [`src/cyberagent/prompts/departments.py`](src/cyberagent/prompts/departments.py),
314
+ and the *Situational Awareness* anchor (the physical-bottleneck ladder + the OOM
315
+ development arc) is distilled in [`references/sa-canon.md`](references/sa-canon.md).
316
+
317
+ ---
318
+
319
+ ## Roadmap
320
+
321
+ - [ ] LangChain / LangGraph tool wrapper
322
+ - [ ] MCP server (Claude / Cursor)
323
+ - [ ] EDGAR (US filings) + Tushare (A-share) + Etherscan (EVM) adapters
324
+ - [ ] Segment-level chains for conglomerates
325
+ - [ ] Structured per-department gate verdicts (machine-enforced "stop")
326
+
327
+ ---
328
+
329
+ ## Disclaimer
330
+
331
+ `final_decision`, `confidence`, and the department reports are **AI-generated
332
+ educational outputs**, not financial advice. LLMs make mistakes; markets are
333
+ unpredictable. Do your own research. The authors and contributors are not liable
334
+ for any decision made based on this software. See [`docs/disclaimer.md`](docs/disclaimer.md).
335
+
336
+ ## License
337
+
338
+ MIT. See [LICENSE](LICENSE).
339
+
340
+ <sub>Publication to the [tea Protocol](https://tea.xyz/) is planned.</sub>
@@ -0,0 +1,287 @@
1
+ <div align="center">
2
+
3
+ # 🧠 cyberagent
4
+
5
+ ### Physical-bottleneck, reverse-consensus investment analysis — for *every* market
6
+
7
+ A chain of LLM agents that traces any asset down to the **physical constraint**
8
+ that caps its industry, checks whether the market has **already priced it**, and
9
+ **refuses to chase a narrative-driven top**. Stocks (A-share / HK / US) and
10
+ crypto (token / contract). Bring your own LLM key.
11
+
12
+ [![PyPI](https://img.shields.io/pypi/v/cyberagent.svg)](https://pypi.org/project/cyberagent/)
13
+ [![Python](https://img.shields.io/badge/python-3.9%2B-blue.svg)](https://www.python.org/)
14
+ [![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
15
+
16
+ ### 🌐 Language / 蝭荀
17
+
18
+ **English** &nbsp;|&nbsp; [įŽ€äŊ“中文](README.zh.md)
19
+
20
+ </div>
21
+
22
+ ---
23
+
24
+ > 🚧 **Early release.** The analysis engine works end-to-end today; the
25
+ > public API may still evolve before `1.0`.
26
+
27
+ ---
28
+
29
+ ## What makes it different
30
+
31
+ Most open-source "AI analyst" frameworks ask *"is this a good company?"* and
32
+ return a textbook SWOT. cyberagent asks a sharper, **falsifiable, reverse-consensus**
33
+ question, in a fixed order:
34
+
35
+ > **Physical bottleneck → uniqueness → commercialization → financial elasticity → consensus correction**
36
+ >
37
+ > *Where is the physical constraint in this asset's supply chain? Is it unique?
38
+ > Can it be monetized? Does it have non-linear financial elasticity? And has the
39
+ > market already priced it in?*
40
+
41
+ It is built on one idea from Leopold Aschenbrenner's *[Situational Awareness](https://situational-awareness.ai/)*:
42
+ **AI scaling is a massive *industrial* process**, bottlenecked by physical inputs —
43
+ power, transformers, HBM, CoWoS packaging, specific materials. cyberagent
44
+ operationalizes that thesis: it walks the supply chain down to the link
45
+ *"no amount of money can buy"*, and then applies hard anti-narrative discipline so
46
+ it doesn't mistake a headline-driven spike for an opportunity.
47
+
48
+ It does **not** predict prices. It produces facts, a falsifiable logic chain, and
49
+ monitorable physical signals — the final decision is yours.
50
+
51
+ ---
52
+
53
+ ## Intellectual foundations
54
+
55
+ cyberagent stands on two ideas and turns them into a reproducible, falsifiable
56
+ agent chain.
57
+
58
+ ### Leopold Aschenbrenner — *Situational Awareness* (the **why**)
59
+
60
+ In *[Situational Awareness: The Decade Ahead](https://situational-awareness.ai/)*,
61
+ Aschenbrenner argues that **AI scaling is a massive *industrial* process**, not a
62
+ software one: every frontier model needs a bigger cluster, then bigger power
63
+ plants, then bigger fabs. So the binding limits are **physical** — power,
64
+ transformers, HBM, CoWoS packaging, specific materials — and effective compute
65
+ compounds at roughly an order of magnitude (OOM) per year (GPT‑2 → GPT‑4 → ~2027
66
+ AGI). The people with *situational awareness* build conviction from the trendlines
67
+ **years before consensus prices them**. cyberagent treats the market as that
68
+ physical system; the thesis is distilled in [`references/sa-canon.md`](references/sa-canon.md).
69
+
70
+ ### Serenity & Crux — the bottleneck method (the **how**)
71
+
72
+ The practitioner discipline comes from supply-chain bottleneck hunters such as
73
+ **Serenity** ([@aleabitoreddit](https://x.com/aleabitoreddit)) and **Crux Capital**.
74
+ Instead of asking *"which stock goes up?"*, they **take the machine apart and look
75
+ for the chokepoint**:
76
+
77
+ > *What does the machine actually look like? Which part of its BOM is the hardest
78
+ > to replace? If one supplier stopped shipping tomorrow, how long would the whole
79
+ > chain wait?*
80
+
81
+ - **Serenity** is *narrow and deep* — find one decisive choke point and concentrate.
82
+ - **Crux** is *wide and disciplined* — map a ~6-layer stack and size each layer by execution certainty, separating proven executors from early optionality.
83
+
84
+ cyberagent distills that discipline into a fixed, falsifiable chain that any LLM
85
+ can run across any market.
86
+
87
+ > We borrow their **method** — tracing a supply chain to its physical chokepoint,
88
+ > asking *"where does the chain break"*, separating execution from optionality. We
89
+ > do **not** impersonate them, quote them, or present their positions as fact.
90
+
91
+ ---
92
+
93
+ ## How it works
94
+
95
+ The chain is a **telescope** — it zooms from physical reality down to the specific,
96
+ actionable name, one grounded LLM call per stage (each reads the upstream reports):
97
+
98
+ > **Positioning → Physical World → Human Development → Economics → Company Financials → Leaders & Verdict**
99
+
100
+ That telescope is how the five-step *method* above (bottleneck → uniqueness →
101
+ commercialization → elasticity → consensus) actually gets executed.
102
+
103
+ ```mermaid
104
+ flowchart LR
105
+ IN["Any asset<br/>NVDA ¡ 600519 ¡ 0700 ¡ BTC ¡ 0xâ€Ļ"] --> CL{{AssetClassifier}}
106
+ CL --> AD["Data adapters<br/>yfinance ¡ CoinGecko ¡ DefiLlama<br/>+ price action + analyst consensus"]
107
+ AD --> P0["Phase 0 · Positioning<br/>core business → physical-world position"]
108
+ P0 --> D1[physical] --> D2[human_dev] --> D3[economics] --> D4[financials] --> D5[leaders]
109
+ D5 --> R["AnalystReport<br/>ACCUMULATE ¡ HOLD ¡ REDUCE ¡ AVOID"]
110
+ ```
111
+
112
+ **Phase 0 — Positioning.** From the fundamentals, lock down what the company
113
+ actually sells, then pin it to a specific layer of the physical / AI supply chain
114
+ (materials → substrate → equipment → packaging → device → module → system → end
115
+ demand) and a concrete machine (e.g. a *GB300 NVL72 rack*, a *1.6T optical link*).
116
+
117
+ **Five departments**, run in sequence, each reading the upstream reports:
118
+
119
+ | Dept | `key` | What it does |
120
+ |---|---|---|
121
+ | đŸĒ¨ Physical World | `physical` | Locate the binding bottleneck on the SA ladder (power > CoWoS/HBM > raw logic); classify the asset as **owner / adjacent / derivative / none**. Non-owner ⇒ downgraded, scarcity-rent logic forbidden. |
122
+ | 🌍 Human Development | `human_dev` | Place the demand on the AGI / OOM arc — early (runway left) or mature/peaked? |
123
+ | 💱 Economics | `economics` | ore-seller vs processor; **decompose the price move into earnings-growth vs multiple-expansion**; detect valuation-framework switches; is it *already priced* (Gray Rhino vs loud consensus)? |
124
+ | 📈 Company Financials | `financials` | Fundamentals + financial elasticity (linear vs non-linear); attribute earnings anomalies *before* flagging them. |
125
+ | đŸŽ¯ Leaders & Verdict | `leaders` | Two-axis verdict — **bottleneck identity (a) vs pricing position (b)** — steelman + Munger inversion, monitorable exit signals, final decision. |
126
+
127
+ ### The discipline (why it won't chase a top)
128
+
129
+ This is the part textbook frameworks skip:
130
+
131
+ - **Real-time grounding** — with Gemini it *searches why a price moved* (the catalyst, who said what), instead of trusting model memory.
132
+ - **Price-action guardrail** — the data layer flags parabolic / near-high moves; a stock that doubled in days on one headline is an **AVOID / observe** form, never a buy.
133
+ - **Evidence ladder** — every key claim is tagged `Confirmed / Inferred / Weak`; a load-bearing `Inferred` claim caps the confidence.
134
+ - **Two independent axes** — *"is it a bottleneck"* (classification) and *"should you buy it here"* (pricing) are never conflated. A non-bottleneck can be a fine trade at a price; a real bottleneck at a top can be a bad one.
135
+ - **Honest "too late"** — parabolic move + extreme valuation + loud consensus ⇒ the label is *"too late / top"*, not an opportunity.
136
+
137
+ > Educational and research use only. Output quality varies with the model, data,
138
+ > and many non-deterministic factors. **This is not financial, investment, or
139
+ > trading advice.**
140
+
141
+ ---
142
+
143
+ ## Quickstart
144
+
145
+ ```python
146
+ import asyncio
147
+
148
+ from cyberagent import AnalystChain
149
+
150
+ chain = AnalystChain(llm="gemini", api_key="...", lang="en") # grounding on by default
151
+
152
+ report = asyncio.run(chain.analyze("NVDA")) # US ¡ or 600519 (A-share) / 0700 (HK) / BTC / 0x6B17...
153
+
154
+ print(report.final_decision) # ACCUMULATE / HOLD / REDUCE / AVOID
155
+ print(report.confidence) # 0.0 - 1.0
156
+ print(report.positioning) # Phase 0 — core business + physical position
157
+ print(report.departments["physical"].markdown)
158
+ print(report.departments["leaders"].markdown)
159
+ ```
160
+
161
+ (Inside Jupyter or an async app, call `await chain.analyze("NVDA")` directly.)
162
+
163
+ **One import, any market.** Pick the report language with `lang="zh"` / `"en"`;
164
+ the whole report is generated in it.
165
+
166
+ ---
167
+
168
+ ## Install
169
+
170
+ ```bash
171
+ pip install 'cyberagent[stocks,gemini,web]' # recommended: stock data + grounded Gemini + local web UI
172
+ ```
173
+
174
+ Extras: **`stocks`** (yfinance) ¡ **`gemini` / `openai` / `claude`** (providers) ¡
175
+ **`web`** (local UI) ¡ **`all`** (everything). The bare `pip install cyberagent` is
176
+ the zero-dependency core.
177
+
178
+ ## Set up your API key
179
+
180
+ cyberagent is **bring-your-own-key**. Gemini is the default and the only provider
181
+ with real-time grounding — recommended.
182
+
183
+ **1. Get a key** — Gemini is free to start:
184
+ [aistudio.google.com/app/apikey](https://aistudio.google.com/app/apikey).
185
+ (Other providers: [OpenAI](https://platform.openai.com/api-keys) ¡
186
+ [Anthropic](https://console.anthropic.com/) ¡
187
+ [DeepSeek](https://platform.deepseek.com/).)
188
+
189
+ **2. Configure it** — create a `.env` file in the folder you run from:
190
+
191
+ ```bash
192
+ echo 'GOOGLE_API_KEY=your_key_here' > .env
193
+ ```
194
+
195
+ (All supported variables are listed in [`.env.example`](.env.example).)
196
+ The CLI and web UI auto-load `.env`. In code you can pass it directly instead:
197
+
198
+ ```python
199
+ AnalystChain(llm="gemini", api_key="your_key_here")
200
+ ```
201
+
202
+ **3. Run it** — `cyberagent` (interactive) or `cyberagent serve` (web). The model
203
+ picker shows a ✓ next to every key it found in your `.env`.
204
+
205
+ ## Bring your own LLM key
206
+
207
+ Gemini is the default (and the only provider with real-time grounding). You can
208
+ also pass any provider or a custom adapter:
209
+
210
+ ```python
211
+ from cyberagent import AnalystChain, LLMAdapter, MockLLM
212
+
213
+ AnalystChain(llm="gemini", api_key="...") # default, grounded
214
+ AnalystChain(llm="openai", api_key="sk-...")
215
+ AnalystChain(llm="claude", api_key="...")
216
+ AnalystChain(llm="deepseek", api_key="...")
217
+ AnalystChain(llm=MockLLM()) # offline, no key — try the flow
218
+
219
+ class MyLLM(LLMAdapter):
220
+ async def complete(self, system: str, user: str) -> str: ...
221
+ AnalystChain(llm=MyLLM())
222
+ ```
223
+
224
+ Keys are read from the environment / a local `.env` (see [`.env.example`](.env.example)).
225
+
226
+ ## CLI & local web page
227
+
228
+ ```bash
229
+ cyberagent # interactive: pick language + model, then a symbol
230
+ cyberagent analyze NVDA --llm gemini --lang en
231
+ cyberagent analyze BTC --depts physical,economics,leaders # subset, faster
232
+ cyberagent serve # local web UI at http://127.0.0.1:8000
233
+ ```
234
+
235
+ The CLI and web page show a model picker that auto-matches the API key found in
236
+ your `.env` (✓ / ✗), live per-department progress, and the rendered report.
237
+
238
+ ---
239
+
240
+ ## Use as a Claude Skill — no install
241
+
242
+ The whole methodology is also packaged as a self-contained **Claude Skill** in
243
+ [`SKILL.md`](SKILL.md) — it runs the same physical-bottleneck chain in pure-prompt
244
+ form, no Python required. To install it in **Claude Code**:
245
+
246
+ ```bash
247
+ mkdir -p ~/.claude/skills/physical-bottleneck-analyst
248
+ curl -fsSL https://raw.githubusercontent.com/CyberK13/cyberagent/main/SKILL.md \
249
+ -o ~/.claude/skills/physical-bottleneck-analyst/SKILL.md
250
+ ```
251
+
252
+ Then just ask: *"analyze NVDA"* — Claude picks the skill up automatically. (Any
253
+ other agent that loads skills works the same way: give it `SKILL.md`.) The Python
254
+ package adds live data, real-time grounding, and the CLI / web UI on top.
255
+
256
+ ## Methodology & prompts — fully open
257
+
258
+ There is no paywall. *How* to hunt a physical bottleneck is framework knowledge,
259
+ not alpha. The complete system prompts live in
260
+ [`src/cyberagent/prompts/departments.py`](src/cyberagent/prompts/departments.py),
261
+ and the *Situational Awareness* anchor (the physical-bottleneck ladder + the OOM
262
+ development arc) is distilled in [`references/sa-canon.md`](references/sa-canon.md).
263
+
264
+ ---
265
+
266
+ ## Roadmap
267
+
268
+ - [ ] LangChain / LangGraph tool wrapper
269
+ - [ ] MCP server (Claude / Cursor)
270
+ - [ ] EDGAR (US filings) + Tushare (A-share) + Etherscan (EVM) adapters
271
+ - [ ] Segment-level chains for conglomerates
272
+ - [ ] Structured per-department gate verdicts (machine-enforced "stop")
273
+
274
+ ---
275
+
276
+ ## Disclaimer
277
+
278
+ `final_decision`, `confidence`, and the department reports are **AI-generated
279
+ educational outputs**, not financial advice. LLMs make mistakes; markets are
280
+ unpredictable. Do your own research. The authors and contributors are not liable
281
+ for any decision made based on this software. See [`docs/disclaimer.md`](docs/disclaimer.md).
282
+
283
+ ## License
284
+
285
+ MIT. See [LICENSE](LICENSE).
286
+
287
+ <sub>Publication to the [tea Protocol](https://tea.xyz/) is planned.</sub>