Skip to content

logicrw/dexter

 
 

Repository files navigation

Dexter πŸ€–

Note: This is a fork of virattt/dexter with modifications to support Anthropic Claude API instead of OpenAI.

An autonomous financial research agent that performs deep analysis using task planning, introspection, and real-time market data. Inspired by Claude Code, but built specifically for financial research.

πŸ”§ Changes in This Fork

  • LLM Provider: Migrated from OpenAI GPT-4 to Anthropic Claude Sonnet 4.5
  • Dependencies: Replaced langchain-openai with langchain-anthropic
  • Model: Now using claude-sonnet-4-5-20250929 (the latest and most capable Claude model)
  • API Key: Updated environment configuration to use ANTHROPIC_API_KEY instead of OPENAI_API_KEY

All core functionality remains unchanged - task planning, tool execution, and financial analysis work exactly the same way. Screenshot 2025-10-14 at 6 12 35β€―PM

Overview

Dexter breaks down complex financial queries into actionable tasks, executes them intelligently using real-time data APIs, and synthesizes comprehensive, data-driven answers. Unlike simple chatbots, Dexter plans ahead, validates its progress, and iterates until it gathers the information needed to thoroughly answer your questions.

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

Twitter Follow

Quick Start

Prerequisites

Installation

  1. Clone the repository:
git clone <repository-url>
cd dexter
  1. Install dependencies with uv:
uv sync
  1. Set up your environment variables:
# Copy the example environment file
cp env.example .env

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

Usage

Run Dexter in interactive mode:

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:

  1. Break down your question into research tasks
  2. Fetch the necessary financial data
  3. Perform calculations and analysis
  4. 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.

About

An autonomous agent for deep financial research

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 99.3%
  • JavaScript 0.7%