Terminal-native autonomous financial research agent with deterministic planning and validation gating.
Project description
Jasper Finance
The terminal-native autonomous financial research agent.
Deterministic planning. Tool-grounded data. Reflection-driven recovery. Human-trustworthy answers.
๐ฏ Why Jasper?
Financial AI is often unreliable. Most tools produce confident-sounding answers that are frequently backed by hallucinations or missing data. Jasper takes a different approach: it treats every question as a mission.
Instead of just "chatting," Jasper follows a rigorous 5-stage pipeline:
- Plan โ Decomposes your question into structured research tasks with intent classification.
- Execute โ Fetches real-time data from authoritative APIs (Alpha Vantage, yfinance).
- Reflect โ Retries transient failures, degrades gracefully on permanent ones.
- Validate โ Analyzes data completeness and financial logic with partial-success support.
- Synthesize โ Generates a report with a confidence score and full audit trail.
Partial data? Jasper continues with caveats and a penalised confidence score โ no silent hallucinations.
๐ What's New in v1.1.6
๐ Hybrid Tier 1/Tier 2 Terminal Streaming Architecture
- Tier 1 (Advanced Terminals): Windows Terminal, ConEmu, macOS, Linux continue using Rich Live widget with real-time streaming preview and persistent board updates.
- Tier 2 (Basic Terminals): Plain PowerShell.exe now gets line-by-line event output without Live rendering artifacts, showing phases (PLANNING, EXECUTING, SYNTHESIS) with progress indicators.
- Unified UX: All terminal types now provide real-time feedback with zero artifacts. Users get appropriate visual feedback for their environment.
- Legacy Windows Mode: Console now uses Rich's
legacy_windowsparameter for plain PowerShell.exe, which handles ANSI codes differently to prevent rendering glitches. - Environment-Specific Rendering: Intelligently detects
WT_SESSION(Windows Terminal),ConEmuPID(ConEmu), andTERM_PROGRAM(VS Code) to choose optimal rendering strategy.
๐ What's New in v1.1.4
๐จ Terminal Output Improvements
- Fixed ANSI Escape Codes in VS Code Terminal: Rich's
Livecontext manager was emitting ANSI escape codes that rendered as visible green lines in VS Code's integrated PowerShell terminal. Now intelligently detects TTY environments and disables Live rendering in non-TTY contexts (e.g., VS Code, IDEs) while preserving full UI in real terminals. - Proper Terminal Detection: Added
sys.stdout.isatty()checks to determine if running in a real terminal. Fallback to plain output when not detected. - Null-Safe Live Updates: All
Live.update()calls now safely check forNoneto prevent errors in non-Live modes.
๐ What's New in v1.1.3
๐ Bug Fixes & Stability
- Exception Hierarchy: Introduced a cohesive exception model with
JasperErrorbase class for all custom exceptions (EntityExtractionError, PlannerError, DataFetchError, ValidationError, ConfigurationError, SynthesisError). Enables precise error handling and recovery strategies. - Logger Output Control: Fixed logger to never print to stdout. All session events are now captured cleanly without terminal pollution. RichLogger correctly updates the Live panel instead.
- Version Command: Now uses
importlib.metadatainstead of parsingpyproject.tomldirectly. Guarantees version consistency across all deployment methods (pip, Docker, executables).
โจ New Features & Enhancements
- Balance Sheet Data: New
balance_sheettool now dispatched by executor. Fetch total assets, liabilities, equity, debt ratios alongside income statements for complete financial picture. - Cash Flow Statements: New
cash_flowtool provides operating, investing, and financing cash flows. Critical for understanding liquidity and capital allocation. - Real-time Quotes: New
realtime_quotetool fetches live price, market cap, P/E ratio, 52-week range, and trading volume. Always bypasses cache for latest data. - Async Provider Execution: Both
YFinanceClientandAlphaVantageClientnow properly useasyncio.run_in_executor()to prevent blocking the event loop. Non-blocking concurrent data fetches. - Smart Fallback Routing:
FinancialDataRoutertries Alpha Vantage first, then seamlessly falls back to yfinance. Automatic.NSsuffix retry for Indian stocks (e.g., plainRELIANCEโRELIANCE.NS). - In-Memory Response Caching: API responses cached in-memory with TTL (default 15 minutes, configurable via
JASPER_CACHE_TTL_SECS). Saves quota on repeated queries. Real-time quotes always bypass cache.
๐ฏ Reliability & Recovery
- Reflector Retry Loop: Post-execution reflector now intelligently retries transient failures (timeouts, rate limits, service unavailable) up to configurable
max_retriestimes per task before gracefully skipping. - Partial-Success Validation: Validation gate now explicitly accepts โฅ50% task completion rate. Synthesis proceeds with a confidence penalty and visible data-gap caveats. No more hard failures on partial data.
- Validator Confidence Breakdown: Calculates transparency score as:
data_coverage ร data_quality ร inference_strength. Penalises missing data automatically. - Task Error Tracking: All task failures now logged with detailed error messages. Audit trail clearly shows which data sources succeeded/failed.
๐จ UI & Export Improvements
- Conditional PDF Status Badges: PDF report now uses Jinja2 conditionals to dynamically render status badges based on actual data retrieval results. No more hardcoded "SUCCESS" labels when data is missing.
- PDF Context Truncation: Long synthesis contexts (>10K chars) automatically truncated with a truncation note appended. Prevents LLM context overflow and keeps reports concise.
- Cross-Process Report Persistence: Research reports now automatically persisted to disk as JSON cache.
_load_report_from_disk()enables session continuity and easy re-export. - Live Streaming Synthesis: Real-time Rich Live panel updates during synthesis. No blank screens while LLM generates responses.
๐ Developer Experience
- Public Python API: New
run_research()async function andFinalReportPydantic model exported fromjasperpackage. Use Jasper programmatically in notebooks, FastAPI routes, or CI pipelines. - Detailed Docstrings: All agent classes (Planner, Executor, Reflector, Synthesizer, Validator) now have comprehensive docstrings explaining intent, parameters, and return values.
- Demo Mode Warning: When using demo Alpha Vantage key, explicit warning message mentions "IBM" to alert users that demo responses are dummy data, not real market information.
๐ง Internal Improvements
- Entity Extractor: Improved ticker/company name extraction from complex queries. Better handling of multi-company comparisons.
- Context Window Management: Synthesizer now actively manages context window size to avoid exceeding LLM limits. Graceful truncation with notes.
- Executor Task Dispatching: Unified task dispatch logic. Supports income_statement, balance_sheet, cash_flow, realtime_quote, financial_statement (alias), and key_metrics tools.
๐ Data Provider Enhancements
- Alpha Vantage: Now properly parses and surfaces both annual and quarterly reports. Better error messages for rate-limited responses and missing data.
- yfinance: Eliminated use of deprecated
quarterly_financialsattribute. Uses modernquarterly_income_stmtAPI exclusively. - Provider Abstraction: Providers without requested method (e.g., missing balance_sheet) silently skipped instead of erroring out.
๐งช Testing
- 16 new comprehensive test suites covering all critical fixes.
- Full round-trip testing for report save/load persistence.
- Async provider mocking with proper executor simulation.
- Conditional template rendering validation via CSS class detection.
โจ Key Features
- ๐ง Autonomous Planning: Automatically breaks down complex questions into executable sub-tasks with query-intent classification (
quantitative/qualitative/mixed). - โ๏ธ Tool-Grounded Data: Income statements, balance sheets, cash flow, and real-time quotes via Alpha Vantage and yfinance. Supports US and Indian (NSE
.NS) stocks. - ๐ Reflector Agent: Post-execution recovery loop that retries transient network/rate-limit failures up to
max_retriestimes per task before gracefully skipping. - โ Partial-Success Validation: If โฅ 50 % of tasks complete, synthesis proceeds with a confidence penalty and a visible data-gap caveat instead of hard-failing.
- ๐ Confidence Breakdown: Transparent
data_coverage ร data_quality ร inference_strengthscoring per report. - โก LLM Streaming: Synthesis tokens stream to the terminal in real-time via a Rich
Livepanel โ no more blank screens. - ๐ฌ Session Memory: Interactive mode carries the last 3 Q&A pairs as context so follow-up questions work naturally.
- ๐ Qualitative Queries: Questions without a ticker (e.g. "Explain yield curve inversion") are answered directly from LLM domain knowledge.
- ๐๏ธ TTL Response Cache: API responses are cached in-memory for 15 minutes (configurable via
JASPER_CACHE_TTL_SECS) to save Alpha Vantage quota. Real-time quotes always bypass the cache. - ๐ Public Python API: Use Jasper programmatically in notebooks, web APIs, or CI pipelines via
from jasper import run_research. - ๐ PDF & HTML Export: Professional research reports with timestamped unique filenames and persistent JSON cache across sessions.
- ๐จ Rich Terminal UI: Live progress boards, tree views, and structured reports.
๐ Installation
Option 1: Python pip (All Platforms)
pip install jasper-finance
jasper interactive
Option 2: Pre-Built Executable
No Python needed. Everything bundled including PDF renderer.
Windows:
git clone https://github.com/ApexYash11/jasper.git
cd jasper
.\scripts\build.ps1
.\dist\jasper\jasper.exe interactive
Linux/macOS:
git clone https://github.com/ApexYash11/jasper.git
cd jasper
chmod +x scripts/build.sh && ./scripts/build.sh
./dist/jasper/jasper interactive
Option 3: Docker (Production)
docker build -t jasper-finance:1.1.6 .
docker run -it jasper-finance:1.1.6 interactive
๐ฅ๏ธ Platform-Specific Setup with Conda
Using Conda ensures isolated environments and avoids dependency conflicts.
macOS
# Install Homebrew (if not installed)
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Install system dependencies
brew install miniforge pkg-config cairo
# Initialize Conda
conda init zsh
source ~/.zshrc
# Create and activate environment
conda create -n jasper python=3.11 -y
conda activate jasper
# Install Jasper
pip install jasper-finance
Linux (Ubuntu/Debian)
# Install system dependencies
sudo apt update
sudo apt install -y pkg-config libcairo2-dev
# Install Miniforge
wget https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-x86_64.sh
bash Miniforge3-Linux-x86_64.sh -b
~/miniforge3/bin/conda init bash
source ~/.bashrc
# Create and activate environment
conda create -n jasper python=3.11 -y
conda activate jasper
# Install Jasper
pip install jasper-finance
Windows
# Install Miniforge from: https://github.com/conda-forge/miniforge/releases
# Run the installer, then open Miniforge Prompt
# Create and activate environment
conda create -n jasper python=3.11 -y
conda activate jasper
# Install Jasper
pip install jasper-finance
Daily Usage (All Platforms)
# Activate environment
conda activate jasper
# Run Jasper
jasper interactive
# Deactivate when done
conda deactivate
๐ ๏ธ Setup (2 Minutes)
Step 1: Get API Keys
You need two free API keys:
| API | Purpose | Get Key |
|---|---|---|
| OpenRouter | LLM synthesis & planning | openrouter.ai/keys |
| Alpha Vantage | Financial data (statements) | alphavantage.co/support (free) |
Step 2: Configure Environment
macOS/Linux:
export OPENROUTER_API_KEY="sk-or-v1-xxxxxxxxxxxxx"
export ALPHA_VANTAGE_API_KEY="your-alpha-vantage-key"
To make permanent, add to ~/.zshrc (macOS) or ~/.bashrc (Linux).
Windows PowerShell:
$env:OPENROUTER_API_KEY="sk-or-v1-xxxxxxxxxxxxx"
$env:ALPHA_VANTAGE_API_KEY="your-key"
Or use a .env file in your working directory:
OPENROUTER_API_KEY=sk-or-v1-xxxxxxxxxxxxx
ALPHA_VANTAGE_API_KEY=your-alpha-vantage-key
Step 3: (Optional) Choose a Model
Jasper defaults to stepfun/step-3.5-flash:free via OpenRouter. Override with:
export OPENROUTER_MODEL="openai/gpt-4o-mini" # recommended for production
export OPENROUTER_MODEL="anthropic/claude-haiku-20240307"
Step 4: Verify Setup
jasper doctor
Expected output:
โ
OPENROUTER_API_KEY is set
โ
ALPHA_VANTAGE_API_KEY is set
โ
Python 3.9+ installed
โ
All dependencies available
๐ Quick Start
Single Query (One-off Research)
jasper ask "What is Nvidia's revenue trend over the last 3 years?"
Interactive Mode (Multiple Queries with Session Memory)
jasper interactive
Session memory is automatic โ follow-up questions like "and what about their cash flow?" retain context from the previous 3 exchanges.
Qualitative / Macro Queries (No Ticker Required)
jasper ask "Explain yield curve inversion and its impact on equities"
jasper ask "What is quantitative tightening?"
Indian & International Stocks
jasper ask "What is Reliance Industries revenue trend?" # auto-resolves RELIANCE.NS
jasper ask "Analyze Infosys operating margins" # INFY.NS
jasper ask "Compare HDFC Bank and ICICI Bank" # HDFCBANK.NS, ICICIBANK.NS
Export to PDF
jasper export "Analyze Tesla's operating margins"
# Saves as: exports/jasper_report_20260222_143012.pdf (unique per run)
๐ Python API
Use Jasper programmatically in notebooks, FastAPI routes, or CI pipelines:
import asyncio
from jasper import run_research, FinalReport
report: FinalReport | None = asyncio.run(
run_research("What is Apple's revenue trend over the last 3 years?")
)
if report:
print(report.synthesis_text)
print(f"Confidence: {report.confidence_score:.0%}")
print(f"Tickers analysed: {report.tickers}")
print(f"Data sources: {report.data_sources}")
run_research() returns a fully populated FinalReport Pydantic model or None if the pipeline failed.
๐๏ธ How It Works (Architecture)
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ YOUR QUESTION โ
โ "What is Apple's revenue trend?" โ
โโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโ
โ 1๏ธโฃ PLANNER AGENT โ
โ Intent classification โ
โ (quant / qual / mixed) โ
โ Task decomposition โ
โโโโโโโโโโโโโโฌโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโ
โ 2๏ธโฃ EXECUTION ENGINE โ
โ Income statement โ
โ Balance sheet โ
โ Cash flow โ
โ Real-time quote โ
โ (Alpha Vantage + yf) โ
โโโโโโโโโโโโโโฌโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโ
โ 3๏ธโฃ REFLECTOR โ
โ Retry transient errors โ
โ Degrade on permanent โ
โ ones gracefully โ
โโโโโโโโโโโโโโฌโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโ
โ 4๏ธโฃ VALIDATION GATE โ
โ โฅ50% tasks โ partial โ
โ
โ <50% tasks โ fail โ โ
โ Confidence breakdown โ
โโโโโโฌโโโโโโโโโโโโฌโโโโโโโโโ
โ โ
โ
PASS โ FAIL
โ โ
โผ โผ
โโโโโโโโโโโโโโโ Research Failed
โ 5๏ธโฃ SYNTHESIZEโ (partial data
โ (streaming) โ reported)
โโโโโโโโฌโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโ
โ FINAL REPORT โ
โ + Confidence Score โ
โ + Audit Trail โ
โโโโโโโโโโโโโโโโโโโโโโโ
๐ง All Commands
| Command | What It Does |
|---|---|
jasper ask "question" |
Execute a single research mission |
jasper interactive |
Enter multi-query mode with session memory |
jasper export <query> |
Generate research and export as PDF report |
jasper doctor |
Verify API keys and setup |
jasper version |
Show installed version |
jasper --help |
View all commands |
๐ Available Data Tools
| Tool | Description | Providers |
|---|---|---|
income_statement |
Annual + quarterly P&L (revenue, EBIT, net income) | Alpha Vantage, yfinance |
balance_sheet |
Assets, liabilities, equity, debt ratios | Alpha Vantage, yfinance |
cash_flow |
Operating / investing / financing cash flows | Alpha Vantage, yfinance |
realtime_quote |
Live price, market cap, P/E, 52-week range, volume | yfinance (always fresh) |
key_metrics |
EV/EBITDA, ROE, ROA, margins, growth rates | yfinance |
Alpha Vantage is tried first; yfinance is the automatic fallback. Both providers support US and Indian NSE stocks (
.NSsuffix).
โ๏ธ Environment Variables
| Variable | Default | Description |
|---|---|---|
OPENROUTER_API_KEY |
(required) | Your OpenRouter API key |
ALPHA_VANTAGE_API_KEY |
demo |
Alpha Vantage key (demo = IBM only) |
OPENROUTER_MODEL |
google/gemini-2.0-flash-exp:free |
LLM model override |
JASPER_CACHE_TTL_SECS |
900 |
API response cache TTL in seconds |
โ Troubleshooting
| Problem | Solution |
|---|---|
Research Failed |
By design. Check validation issues. Usually incomplete data or invalid ticker. |
Partial data โ confidence penalised |
Normal for rate-limited sessions. Report still generated with caveats. |
API Rate Limit Hit |
Free Alpha Vantage: ~25 calls/day. Jasper's TTL cache reduces redundant calls. |
API KEY not set |
Run jasper doctor and export missing keys. |
Ticker not found |
Use symbol (AAPL), not name (Apple). Indian: add .NS suffix (RELIANCE.NS). |
pycairo build fails |
Install Cairo: brew install cairo (macOS) or sudo apt install libcairo2-dev (Linux). |
nan in report output |
Fixed in v1.0.9 โ upgrade with pip install --upgrade jasper-finance. |
โ๏ธ License
Jasper Finance is released under the MIT License (2026, ApexYash).
- โ Commercial Use
- โ Modification
- โ Distribution
- โ Private Use
- โ ๏ธ No Warranty
See LICENSE for full legal text.
๐ Links
| Resource | Link |
|---|---|
| ๐ฆ PyPI Package | pypi.org/project/jasper-finance/ |
| ๐ป GitHub Source | github.com/ApexYash11/jasper |
| ๐ Report Issues | github.com/ApexYash11/jasper/issues |
| ๐ Data: Alpha Vantage | alphavantage.co |
| ๐ Data: yfinance | github.com/ranaroussi/yfinance |
| ๐ค LLM: OpenRouter | openrouter.ai |
Built by analysts, for analysts. Stop guessing. Start researching. Jasper Finance v1.1.6
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file jasper_finance-1.1.6.tar.gz.
File metadata
- Download URL: jasper_finance-1.1.6.tar.gz
- Upload date:
- Size: 90.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
74ab3b34b528a9c2c2e85f7dfd1c7cb655463314d857a2be6df9d32e27a44c6e
|
|
| MD5 |
7bb452eebf8f78d754c0c856ae99a405
|
|
| BLAKE2b-256 |
32609d972416a5d3afa7ddfc3367ab43b3b7726d2b3eb03c33de7b02a166ad7c
|
Provenance
The following attestation bundles were made for jasper_finance-1.1.6.tar.gz:
Publisher:
publish.yml on ApexYash11/jasper
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
jasper_finance-1.1.6.tar.gz -
Subject digest:
74ab3b34b528a9c2c2e85f7dfd1c7cb655463314d857a2be6df9d32e27a44c6e - Sigstore transparency entry: 1043678959
- Sigstore integration time:
-
Permalink:
ApexYash11/jasper@62b7404ef66a84cb5b71e5ba30e4c08774986510 -
Branch / Tag:
refs/tags/v1.1.6 - Owner: https://github.com/ApexYash11
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@62b7404ef66a84cb5b71e5ba30e4c08774986510 -
Trigger Event:
push
-
Statement type:
File details
Details for the file jasper_finance-1.1.6-py3-none-any.whl.
File metadata
- Download URL: jasper_finance-1.1.6-py3-none-any.whl
- Upload date:
- Size: 67.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
601fb4aaae6f9cb716e06caff4603017e1afbf6711311b33b799dca03819d484
|
|
| MD5 |
8e8c452793324fd382b529117b966f75
|
|
| BLAKE2b-256 |
f4b1d561db7ec58253e0ab4a7d96fb799a494b57ccfddf40a6802847331961bd
|
Provenance
The following attestation bundles were made for jasper_finance-1.1.6-py3-none-any.whl:
Publisher:
publish.yml on ApexYash11/jasper
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
jasper_finance-1.1.6-py3-none-any.whl -
Subject digest:
601fb4aaae6f9cb716e06caff4603017e1afbf6711311b33b799dca03819d484 - Sigstore transparency entry: 1043679039
- Sigstore integration time:
-
Permalink:
ApexYash11/jasper@62b7404ef66a84cb5b71e5ba30e4c08774986510 -
Branch / Tag:
refs/tags/v1.1.6 - Owner: https://github.com/ApexYash11
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@62b7404ef66a84cb5b71e5ba30e4c08774986510 -
Trigger Event:
push
-
Statement type: