Autonomous Financial Research Agent on GitHub

Dexter is an autonomous financial research agent, developed by Virattt and hosted on GitHub. It's designed to think, plan, and learn as it works, using task planning, self-reflection, and real-time market data to perform complex financial analyses. Dexter decomposes complex queries into structured research steps, executes those tasks using live market data, checks its own work, and refines the results until it has a confident, data-backed answer.

Key capabilities include intelligent task planning, autonomous execution, self-validation, real-time financial data access, and safety features such as loop detection and step limits. To use Dexter, users need Python 3.10 or higher, the uv package manager, and OpenAI and Financial Datasets API keys. Users clone the repository, install dependencies with uv, set up their environment variables, and run Dexter in interactive mode. Dexter can answer queries like "What was Apple's revenue growth over the last 4 quarters?" by breaking down the question into research tasks, fetching necessary financial data, performing calculations and analysis, and providing a comprehensive, data-rich answer.

Dexter's architecture includes a multi-agent system with a Planning Agent, Action Agent, Validation Agent, and Answer Agent. The project structure includes a src directory with Python files for agent orchestration logic, LLM interface, financial data tools, system prompts for each component, Pydantic models, utility functions, and CLI entry point. Users can contribute to the project by forking the repository, creating a feature branch, committing changes, pushing to the branch, and creating a Pull Request. The project is licensed under the MIT License.

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.

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.

It’s not just another chatbot. It’s an agent that plans ahead, verifies its progress, and keeps iterating until the job is done.

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

Quick Start

Prerequisites

  • Python 3.10 or higher
  • uv package manager
  • OpenAI API key
  • Financial Datasets API key (get one at financialdatasets.ai)

Installation

  1. Clone the repository: bash git clone https://github.com/virattt/dexter.git cd dexter
  2. Install dependencies with uv: bash uv sync
  3. Set up your environment variables: ```bash # Copy the example environment file cp env.example .env

# Edit .env and add your API keys OPENAI_API_KEY=your-openai-api-key FINANCIAL_DATASETS_API_KEY=your-financial-datasets-api-key


### Usage

Run Dexter in interactive mode:
```bash
uv run dexter-agent

Example Queries

Try asking Dexter questions like:

  • "What was Apple's revenue growth over the last 4 quarters?"
  • "Compare Microsoft and Google's operating margins for 2023"
  • "Analyze Tesla's cash flow trends over the past year"
  • "What is Amazon's debt-to-equity ratio based on recent financials?"

Dexter will automatically:

  • Break down your question into research tasks
  • Fetch the necessary financial data
  • Perform calculations and analysis
  • Provide a comprehensive, data-rich answer

Architecture

Dexter uses a multi-agent architecture with specialized components:

  • Planning Agent: Analyzes queries and creates structured task lists
  • Action Agent: Selects appropriate tools and executes research steps
  • Validation Agent: Verifies task completion and data sufficiency
  • Answer Agent: Synthesizes findings into comprehensive responses

Project Structure

dexter/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ dexter/
β”‚   β”‚   β”œβ”€β”€ agent.py      # Main agent orchestration logic
β”‚   β”‚   β”œβ”€β”€ model.py      # LLM interface
β”‚   β”‚   β”œβ”€β”€ tools.py      # Financial data tools
β”‚   β”‚   β”œβ”€β”€ prompts.py    # System prompts for each component
β”‚   β”‚   β”œβ”€β”€ schemas.py    # Pydantic models
β”‚   β”‚   β”œβ”€β”€ utils/        # Utility functions
β”‚   β”‚   └── cli.py        # CLI entry point
β”œβ”€β”€ pyproject.toml
└── uv.lock

Configuration

Dexter supports configuration via the Agent class initialization:

from dexter.agent import Agent

agent = Agent(
    max_steps=20,          # Global safety limit
    max_steps_per_task=5   # Per-task iteration limit
)

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.