https://github.com/virattt/dexter
An autonomous agent for deep financial research
https://github.com/virattt/dexter
Last synced: 2 months ago
JSON representation
An autonomous agent for deep financial research
- Host: GitHub
- URL: https://github.com/virattt/dexter
- Owner: virattt
- Created: 2025-10-14T21:02:00.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2026-02-06T02:36:09.000Z (2 months ago)
- Last Synced: 2026-02-06T03:28:15.835Z (2 months ago)
- Language: TypeScript
- Size: 536 KB
- Stars: 10,623
- Watchers: 81
- Forks: 1,285
- Open Issues: 33
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-openclaw-money-maker - **Dexter** - Autonomous agent for deep financial research. AI-powered analysis and investment insights. (Trading Bots / AI Trading Agents)
- awesome - virattt/dexter - An autonomous agent for deep financial research (TypeScript)
- AiTreasureBox - virattt/dexter - 01-22_8365_272](https://img.shields.io/github/stars/virattt/dexter.svg)|An autonomous agent for deep financial research| (Repos)
- awesome-ai-for-economists - Dexter - Autonomous financial research agent with task planning and real-time data.  (Finance-Specific AI / Spatial, Satellite and Alternative Data)
- StarryDivineSky - virattt/dexter
- awesome - virattt/dexter - An autonomous agent for deep financial research (<a name="TypeScript"></a>TypeScript)
README
# Dexter 🤖
Dexter is an autonomous financial research agent that thinks, plans, and learns as it works. It performs analysis using task planning, self-reflection, and real-time market data. Think Claude Code, but built specifically for financial research.

## Table of Contents
- [👋 Overview](#-overview)
- [✅ Prerequisites](#-prerequisites)
- [💻 How to Install](#-how-to-install)
- [🚀 How to Run](#-how-to-run)
- [📊 How to Evaluate](#-how-to-evaluate)
- [🐛 How to Debug](#-how-to-debug)
- [🤝 How to Contribute](#-how-to-contribute)
- [📄 License](#-license)
## 👋 Overview
Dexter takes complex financial questions and turns them into clear, step-by-step research plans. It runs those tasks using live market data, checks its own work, and refines the results until it has a confident, data-backed answer.
**Key Capabilities:**
- **Intelligent Task Planning**: Automatically decomposes complex queries into structured research steps
- **Autonomous Execution**: Selects and executes the right tools to gather financial data
- **Self-Validation**: Checks its own work and iterates until tasks are complete
- **Real-Time Financial Data**: Access to income statements, balance sheets, and cash flow statements
- **Safety Features**: Built-in loop detection and step limits to prevent runaway execution
[](https://twitter.com/virattt)

## ✅ Prerequisites
- [Bun](https://bun.com) runtime (v1.0 or higher)
- OpenAI API key (get [here](https://platform.openai.com/api-keys))
- Financial Datasets API key (get [here](https://financialdatasets.ai))
- Exa API key (get [here](https://exa.ai)) - optional, for web search
#### Installing Bun
If you don't have Bun installed, you can install it using curl:
**macOS/Linux:**
```bash
curl -fsSL https://bun.com/install | bash
```
**Windows:**
```bash
powershell -c "irm bun.sh/install.ps1|iex"
```
After installation, restart your terminal and verify Bun is installed:
```bash
bun --version
```
## 💻 How to Install
1. Clone the repository:
```bash
git clone https://github.com/virattt/dexter.git
cd dexter
```
2. Install dependencies with Bun:
```bash
bun install
```
3. Set up your environment variables:
```bash
# Copy the example environment file
cp env.example .env
# Edit .env and add your API keys (if using cloud providers)
# OPENAI_API_KEY=your-openai-api-key
# ANTHROPIC_API_KEY=your-anthropic-api-key (optional)
# GOOGLE_API_KEY=your-google-api-key (optional)
# XAI_API_KEY=your-xai-api-key (optional)
# OPENROUTER_API_KEY=your-openrouter-api-key (optional)
# (Optional) If using Ollama locally
# OLLAMA_BASE_URL=http://127.0.0.1:11434
# Other required keys
# FINANCIAL_DATASETS_API_KEY=your-financial-datasets-api-key
# Web Search (Exa preferred, Tavily fallback)
# EXASEARCH_API_KEY=your-exa-api-key
# TAVILY_API_KEY=your-tavily-api-key
```
## 🚀 How to Run
Run Dexter in interactive mode:
```bash
bun start
```
Or with watch mode for development:
```bash
bun dev
```
## 📊 How to Evaluate
Dexter includes an evaluation suite that tests the agent against a dataset of financial questions. Evals use LangSmith for tracking and an LLM-as-judge approach for scoring correctness.
**Run on all questions:**
```bash
bun run src/evals/run.ts
```
**Run on a random sample of data:**
```bash
bun run src/evals/run.ts --sample 10
```
The eval runner displays a real-time UI showing progress, current question, and running accuracy statistics. Results are logged to LangSmith for analysis.
## 🐛 How to Debug
Dexter logs all tool calls to a scratchpad file for debugging and history tracking. Each query creates a new JSONL file in `.dexter/scratchpad/`.
**Scratchpad location:**
```
.dexter/scratchpad/
├── 2026-01-30-111400_9a8f10723f79.jsonl
├── 2026-01-30-143022_a1b2c3d4e5f6.jsonl
└── ...
```
Each file contains newline-delimited JSON entries tracking:
- **init**: The original query
- **tool_result**: Each tool call with arguments, raw result, and LLM summary
- **thinking**: Agent reasoning steps
**Example scratchpad entry:**
```json
{"type":"tool_result","timestamp":"2026-01-30T11:14:05.123Z","toolName":"get_income_statements","args":{"ticker":"AAPL","period":"annual","limit":5},"result":{...},"llmSummary":"Retrieved 5 years of Apple annual income statements showing revenue growth from $274B to $394B"}
```
This makes it easy to inspect exactly what data the agent gathered and how it interpreted results.
## 🤝 How to Contribute
1. Fork the repository
2. Create a feature branch
3. Commit your changes
4. Push to the branch
5. Create a Pull Request
**Important**: Please keep your pull requests small and focused. This will make it easier to review and merge.
## 📄 License
This project is licensed under the MIT License.