Environment:AI4Finance Foundation FinRobot Python 3 11
| Knowledge Sources | |
|---|---|
| Domains | Infrastructure, Finance, LLMs |
| Last Updated | 2026-10-19 00:00 GMT |
Overview
Python 3.11+ runtime with PydanticAI, FastAPI, yfinance, EdgarTools, rank-bm25, and keyring — the base stack for every FinRobot compute operator, pipeline, and server.
Description
This is the standard CPU-based Python environment for the FinRobot V2 desktop platform. It is built on Python 3.11 (also compatible with 3.12 and 3.13 per the `pyproject.toml` classifiers) and uses `hatchling` as the build backend. The stack is oriented around deterministic financial compute (DCF, DDM, LBO, comps, backtest) with an LLM orchestration layer (PydanticAI agents) and a FastAPI server fronting a Tauri desktop shell. No GPU acceleration is required — all valuation arithmetic is pure-Python deterministic computation, and the LLM calls go to remote provider APIs.
The runtime uses `pydantic-settings` for typed configuration that reads ONLY from app storage (`settings.json` + OS keychain), never from environment variables or `.env` files, so a packaged desktop app has a single source of truth for user config.
Usage
Use this environment for any FinRobot compute operator, pipeline step, or server route. It is the mandatory prerequisite for every Implementation page in the knowledge graph — the DCF/DDM/LBO/comps operators, the equity-research and IC-memo pipelines, the RAG/BM25 retrieval, the catalyst/earnings analysis, and the FastAPI server all run on this stack. The only Implementation that requires an additional environment is BackTraderAdapter_run, which also needs BackTrader.
System Requirements
| Category | Requirement | Notes |
|---|---|---|
| OS | Linux / macOS / Windows | Cross-platform desktop app via Tauri shell; server runs on any OS Python supports |
| Hardware | Any modern CPU | No GPU required — all compute is deterministic pure-Python arithmetic; LLM calls are remote API |
| Disk | ~500MB Python deps + SQLite cache | `aiosqlite` run-store and quote-cache grow with usage |
| Python | >= 3.11 | `requires-python = ">=3.11"`; also classified for 3.12, 3.13 |
| Network | Outbound HTTPS | Required for yfinance, SEC EDGAR, FMP/Finnhub data providers, and LLM provider APIs |
Dependencies
System Packages
- Python 3.11+ runtime
- OS keyring backend (for `keyring` secret storage — macOS Keychain, Linux Secret Service, Windows Credential Vault)
- No CUDA/GPU libraries required
Python Packages
- `pydantic-ai` >= 1.70.0 (LLM agent orchestration)
- `pydantic-settings` >= 2.0 (typed config, app-storage-only)
- `fastapi` >= 0.115 (server factory)
- `uvicorn` >= 0.34 (ASGI server)
- `aiosqlite` >= 0.20 (async SQLite run-store + cache)
- `yfinance` >= 0.2 (market data, fallback provider)
- `click` >= 8.1 (CLI)
- `pyyaml` >= 6.0 (skill/config loading)
- `matplotlib` >= 3.8 (equity-curve chart rendering, Agg backend)
- `jinja2` >= 3.1 (report templating)
- `rank-bm25` >= 0.2.2 (BM25 retrieval for RAG)
- `keyring` >= 25.0 (OS keychain secret storage)
- `edgartools` >= 5.31.5 (SEC EDGAR XBRL/filings)
- `ddgs` >= 9.14.4 (DuckDuckGo news search)
Credentials
The following secrets are stored in the OS keychain (NOT environment variables) and hydrated at boot via `FinRobotSettings`:
LLM provider keys (keychain under `provider_key:<id>`):
- `provider_key:openai` — OpenAI API key (optional, user-wired)
- `provider_key:anthropic` — Anthropic API key (optional, user-wired)
- `provider_key:<custom_id>` — any user-added OpenAI-compatible provider key
Data provider keys (keychain under fixed field names):
- `fmp_api_key` — Financial Modeling Prep API key (optional — yfinance handles fallback)
- `finnhub_api_key` — Finnhub API key (optional)
- `alpha_vantage_api_key` — Alpha Vantage API key (optional)
- `adanos_api_key` — Adanos API key (optional)
Infrastructure (environment-only, not user-facing):
- `FINROBOT_SKILLS_DIR` — skills directory override (infra knob)
- `FINROBOT_CACHE_DB_PATH` — SQLite cache path override (infra knob)
- `FINROBOT_BACKTEST_STRATEGY_MODULE_PREFIXES` — strategy module prefixes (infra knob)
- `FINROBOT_CAPABILITY_TOKEN` — capability-token auth (infra/security)
- `sec_user_agent` — SEC EDGAR User-Agent string (stored in settings.json, required by SEC policy)
Quick Install
# Core install (V2 desktop platform)
pip install finrobot
# Or from source (editable dev install with all core deps)
cd finrobot_desktop
pip install -e .
# With backtest support (BackTrader extra)
pip install 'finrobot[backtest]'
# With dev tooling (pytest, ruff, mypy, hypothesis)
pip install 'finrobot[dev]'
Code Evidence
Python version constraint from `pyproject.toml:11`:
requires-python = ">=3.11"
Ruff/mypy target version from `pyproject.toml:103,107`:
[tool.ruff]
target-version = "py311"
[tool.mypy]
python_version = "3.11"
App-storage-only config resolution (no env/dotenv) from `config.py:176-192`:
@classmethod
def settings_customise_sources(cls, settings_cls, init_settings, env_settings,
dotenv_settings, file_secret_settings):
"""Read ONLY from constructor kwargs — drop the env and .env sources."""
return (init_settings,)
Optional-backtrader import guard from `backtrader_adapter.py:72-80`:
def _check_backtrader() -> None:
"""Raise ImportError with a helpful message if backtrader is not installed."""
try:
import backtrader # noqa: F401
except ImportError:
raise ImportError(
"backtrader is required for backtesting. "
"Install it with: pip install 'finrobot[backtest]'"
) from None
Common Errors
| Error Message | Cause | Solution |
|---|---|---|
| `No AI model configured` | `model_name` is empty in settings.json | Choose a model in Settings → AI Model (e.g. `anthropic:claude-sonnet-4-6`) |
| `No API key configured for provider 'X'` | LLM provider key missing from keychain | Add the key in Settings → AI Model |
| `FMP API key not set — falling back to yfinance` | `fmp_api_key` not set (optional) | Add FMP key in Settings → Data Sources for better data quality (free at financialmodelingprep.com) |
| `backtrader is required for backtesting` | `[backtest]` extra not installed | `pip install 'finrobot[backtest]'` |
| `Unknown provider 'X' in model_name` | Unsupported LLM provider prefix | Use format `provider:model_id` (e.g. `anthropic:claude-sonnet-4-6`) |
| `ImportError: edgartools` / `rank_bm25` | Core dependency not installed | `pip install -e finrobot_desktop/` to install all core deps |
Compatibility Notes
- Python 3.12/3.13: Classified in `pyproject.toml` and tested; `StrEnum` (used in `dcf.py`) requires 3.11+ so all three versions are supported.
- edgartools: Ships without `py.typed` (pyproject.toml:117), so mypy `ignore_missing_imports = true` is configured for the `edgar.*` module.
- backtrader: Optional extra (`finrobot[backtest]`); mypy `disallow_subclassing_any = false` is needed because backtrader exposes `Strategy` as `Any`.
- yfinance: Treated as untyped by mypy (`ignore_missing_imports = true`); used as the fallback data provider when FMP is unavailable.
- Keyring backends: macOS Keychain, Linux Secret Service (gnome-keyring/KWallet), Windows Credential Vault — the desktop app uses whichever the OS provides.
- No `.env` support: Deliberately removed (`settings_customise_sources` drops env/dotenv sources) to prevent a packaged desktop app from depending on a `.env` file that may not ship in the bundle.
Related Pages
This environment is required by every FinRobot implementation:
- Implementation:AI4Finance_Foundation_FinRobot_calculate_dcf
- Implementation:AI4Finance_Foundation_FinRobot_seed_dcf_inputs
- Implementation:AI4Finance_Foundation_FinRobot_calculate_wacc
- Implementation:AI4Finance_Foundation_FinRobot_calculate_ddm
- Implementation:AI4Finance_Foundation_FinRobot_seed_ddm_inputs
- Implementation:AI4Finance_Foundation_FinRobot_calculate_lbo
- Implementation:AI4Finance_Foundation_FinRobot_seed_lbo_inputs
- Implementation:AI4Finance_Foundation_FinRobot_calculate_multiples
- Implementation:AI4Finance_Foundation_FinRobot_calculate_peer_statistics
- Implementation:AI4Finance_Foundation_FinRobot_execute_peer_analysis
- Implementation:AI4Finance_Foundation_FinRobot_extract_catalysts_from_news
- Implementation:AI4Finance_Foundation_FinRobot_calculate_earnings_surprises
- Implementation:AI4Finance_Foundation_FinRobot_execute_financial_data_step
- Implementation:AI4Finance_Foundation_FinRobot_compute_ownership_governance
- Implementation:AI4Finance_Foundation_FinRobot_build_technical_analysis
- Implementation:AI4Finance_Foundation_FinRobot_resolve_canonical_thesis
- Implementation:AI4Finance_Foundation_FinRobot_execute_ic_recommendation
- Implementation:AI4Finance_Foundation_FinRobot_BacktestConfig_BacktestResult
- Implementation:AI4Finance_Foundation_FinRobot_BackTraderAdapter_run
- Implementation:AI4Finance_Foundation_FinRobot_BM25Index_search
- Implementation:AI4Finance_Foundation_FinRobot_sanitize_untrusted_block
- Implementation:AI4Finance_Foundation_FinRobot_LLM_Narrative_Agent_run