BrainBank

OpenDsStar

7/19/2026, 1:18:29 PM · updated 7/19/2026, 1:21:43 PM · Source

#ai-agents#step-by-step#python#data-science#gemini#uv

An introduction to DS-STAR, an open-source implementation of Google Research's versatile data science agent that orchestrates specialized LLM agents to automate complex data analysis, planning, and execution tasks.

DS-STAR (Data Science - Structured Thought and Action) is an open-source, Python-based agentic framework designed to fully automate complex data science tasks. Based on Google Research's paper, [[DS-STAR]]: A State-of-the-Art Versatile Data Science Agent, this framework orchestrates a collaborative network of specialized AI agents to analyze data, generate code, and iteratively refine solutions to address user queries.

DS-Star GitHub Project OverviewDS-Star GitHub Project Overview


Key Features

  • Agentic Workflow: Implements a pipeline of specialized AI agents (Analyzer, Planner, Coder, Verifier, Router, Debugger, and Finalyzer) that collaborate to solve complex data science tasks.
  • Full Reproducibility: Every phase of the execution is saved locally—including prompts, generated Python code, execution results, and metadata—allowing for complete auditability.
  • Interactive & Resume-able: Execution runs can be paused and resumed. An interactive mode enables step-by-step human evaluation before moving to the next phase.
  • Code Editing & Debugging: Allows users to manually edit generated Python code during a run, and features an auto-debug agent to dynamically resolve code execution errors.
  • Configuration-driven: Project configurations, model parameters, and global run configurations are easily managed through a centralized config.yaml file.

How DS-STAR Works

The DS-STAR pipeline executes in three main phases:

Rendering diagram…
  1. Analysis: The Analyzer agent inspects the initial dataset files (e.g., CSV, Excel) and generates descriptive summaries.
  2. Iterative Planning & Execution:
    • The Planner creates an initial step-by-step plan to answer the user's prompt.
    • The Coder generates Python code to execute the active step of the plan.
    • The system runs the generated code and captures the output.
    • If the code fails, an automatic Debugger agent attempts to fix the logic and syntax.
    • The Verifier checks whether the resulting execution sufficiently answers the target query.
    • The Router determines the next step: either finalize the workflow or loop back to add refinement steps. This loop runs until the plan is complete or the maximum refinement rounds limit is met.
  3. Finalization: The Finalyzer takes the final code execution results and packages them into a clean, specified output structure (such as JSON).

All artifacts generated during a run are structured and saved under the runs/ directory using a unique run_id.


Project Structure

/
├─── dsstar.py               # Main script containing the agent logic and CLI
├─── config.yaml             # Main configuration file
├─── prompt.yaml             # Prompts for the different AI agents
├─── pyproject.toml          # Project metadata and dependencies (uv format)
├─── uv.lock                 # Locked dependency versions for reproducibility
├─── .python-version         # Python version specification for uv
├─── data/                   # Directory for your data files
└─── runs/                   # Directory where all experiment runs and artifacts are stored

Getting Started

Prerequisites

  • Python 3.11+
  • An API key for Google's Gemini models (or other supported providers)
  • uv package manager (recommended for fast dependency resolution)

Installation

To set up the project locally using uv:

# Clone the repository
git clone https://github.com/JulesLscx/DS-Star.git
cd DS-Star

# Install uv (if not already installed)
curl -LsSf https://astral.sh/uv/install.sh | sh

# Install dependencies with uv
uv sync

Configuration

  1. Set your API Key: Set your Gemini API key as an environment variable:

    export GEMINI_API_KEY='your-api-key'
    

    Alternatively, you can add it directly to your config.yaml file.

  2. Customize config.yaml: Create a config.yaml file in the root of the project to customize model parameters:

    # config.yaml
    model_name: 'gemini-1.5-flash'
    max_refinement_rounds: 5
    interactive: false
    # api_key: 'your-api-key' # Alternatively, place it here
    
    # Optional: Configure specific models for different agents
    agent_models:
      PLANNER: 'gpt-4'
      CODER: 'gemini-1.5-pro'
      VERIFIER: 'gemini-1.5-flash'
    

Usage Guide

Place your target data files (e.g., .xlsx, .csv) inside the /data directory.

Running Tasks

  • Start a New Run: Provide target files and a query via the CLI.
    uv run python dsstar.py --data-files file1.xlsx file2.xlsx --query "What is the total sales for each department?"
    
  • Resume a Run: If an agent pipeline is interrupted, resume it using its unique run_id.
    uv run python dsstar.py --resume <run_id>
    
  • Edit Code Mid-Run: You can manually modify the last generated chunk of code and re-run it. This is useful for custom tweaking or manual debugging.
    uv run python dsstar.py --edit-last --resume <run_id>
    
    Note: This command opens the code file in your system's default text editor (e.g., nano, vim). Saving and closing the editor triggers the script to run the updated code.
  • Interactive Mode: To step through and manually approve each phase before executing:
    uv run python dsstar.py --interactive --data-files file1.csv --query "Analyze the year-over-year growth rate"
    

Configuration Reference

The following settings are configurable via config.yaml or can be overridden directly using CLI arguments:

ParameterTypeDescription
run_idstringThe ID of a run to resume.
max_refinement_roundsintMaximum cycles the agent is allowed to refine its plan.
api_keystringYour Google Gemini API key.
model_namestringThe default Gemini model to use (e.g., gemini-1.5-flash).
interactiveboolIf true, waits for user input/verification before executing steps.
auto_debugboolIf true, the Debugger agent automatically attempts to fix failing runtime code.
execution_timeoutintTimeout limit (in seconds) for generated code execution.
preserve_artifactsboolIf true, preserves intermediate artifacts inside the runs/ directory.
agent_modelsdictKey-value pairs mapping specific agents (e.g., PLANNER, CODER) to distinct LLMs.

Supported AI Providers

DS-STAR supports multiple AI model backends. Each provider expects corresponding environment variables:

Google Gemini

  • Provider Identifier: Default provider (no prefix required)
  • Environment Variable: export GEMINI_API_KEY='your-gemini-api-key'
  • Model Examples: gemini-2.5-pro, gemini-2.0-flash, gemini-1.5-pro

OpenAI

  • Provider Identifier: Models prefixed with gpt or o1
  • Environment Variable: export OPENAI_API_KEY='your-openai-api-key'
  • Model Examples: gpt-4, gpt-4-turbo, o1

Ollama (Local LLMs)

  • Provider Identifier: Models prefixed with ollama/
  • Environment Variables:
    export OLLAMA_API_KEY='your-ollama-api-key'  # Optional
    export OLLAMA_HOST='http://localhost:11434'  # Optional, defaults to localhost
    
  • Model Examples: ollama/llama3, ollama/qwen3-coder

Dependency Management with uv

This project uses the fast Python packaging tool uv for dependency resolution.

Benefits of UV

  • Performance: uv resolved installations are 10–100x faster than standard pip.
  • Deterministic Builds: Lockfiles protect environmental stability.
  • Seamless Executions: No virtual environment activation is needed; commands execute natively using uv run.

Common UV Commands

  • Install dependencies: uv sync
  • Add a dependency: uv add <package-name>
  • Remove a dependency: uv remove <package-name>
  • Update packages: uv sync --upgrade
  • Run a script: uv run python <script.py>
  • Show active environment packages: uv pip list

Contributing

Contributions are welcome! Please feel free to submit a pull request or open an issue for any bugs or feature requests directly on the JulesLscx/DS-Star GitHub Repository.


Key Takeaways

  • Multi-Agent Orchestration: Implements specialized roles (planning, coding, debugging, and verification) working in tandem to deliver highly reliable data science execution.
  • Developer-in-the-Loop: Offers flexible manual code intervention, interactive prompt validations, and structured error correction.
  • Auditability & Logging: Tracks execution history and preserves physical pipeline artifacts inside the local runtime logs.
  • Multi-Provider Flexibility: Integrates seamlessly with Google Gemini, OpenAI, and local Ollama models.

Learning map

Stage 1: Core Concepts

  • Multi-Agent Architectures: Learn how specialized agents (Analyzer, Planner, Coder, Verifier) coordinate to break down complex queries into executable steps.
  • State-and-Action Frameworks: Understand the feedback loop of plan creation, code execution, automated debugging, and verification.

Stage 2: Environment & Package Management

  • Astral UV Tooling: Master using uv for fast, reproducible Python dependency resolution without virtual environment activation overhead.
  • API Configurations: Learn how to configure model providers (Gemini, OpenAI, Ollama) and route different sub-tasks to optimal LLM models.

Stage 3: Practical Orchestration

  • Interactive Debugging: Explore manual intervention and code modification during runtime to guide the agent.
  • Run Reproducibility: Dive into audit logs, saved run configurations, and structured output artifact parsing.

Get hands-on — step by step

Step 1: Install UV and Clone the Repository

Begin by installing uv, the fast Python package manager, and cloning the DS-STAR project:

# Install uv
curl -LsSf https://astral.sh/uv/install.sh | sh

# Clone the repository
git clone https://github.com/JulesLscx/DS-Star.git
cd DS-Star

# Sync dependencies
uv sync

Step 2: Configure API Keys and Setup config.yaml

Expose your preferred LLM API keys and set up the local configuration file:

export GEMINI_API_KEY='your-gemini-api-key'

Create a config.yaml file in the root directory:

model_name: 'gemini-2.5-flash'
max_refinement_rounds: 5
interactive: false
auto_debug: true

Step 3: Run Your First Automated Analysis

Add a sample dataset (e.g., sales.csv) to a data/ folder and initiate the agent pipeline:

uv run python dsstar.py --data-files data/sales.csv --query "What are the top 3 highest performing sales regions?"

Step 4: Run in Interactive Mode for Manual Tweaks

To review and edit generated code steps before execution, run DS-STAR with the interactive flag:

uv run python dsstar.py --interactive --data-files data/sales.csv --query "Analyze seasonal trends."

Top 3 sources

  1. 1
    DS-Star GitHub Repository

    The official open-source repository containing the Python implementation, configuration files, and setup guidelines for the DS-STAR framework.

    https://github.com/JulesLscx/DS-Star

  2. 2
    Google Gemini API Documentation

    Official guide to access, configure, and optimize Google's Gemini models which serve as the default LLM backbone for DS-STAR.

    https://ai.google.dev/gemini-api/docs

  3. 3
    Astral UV Documentation

    Complete documentation for the lightning-fast Python package manager utilized by DS-STAR to ensure immediate, locking dependency syncs.

    https://docs.astral.sh/uv/

Links are AI-suggested — worth a quick sanity check before diving in.