Skip to content

Scale3-Labs/dspyground

Repository files navigation

DSPyground

Optimize Engineer your Prompts for better agent trajectories.

Quick Start

Prerequisites

  • Node.js 18+
  • uv (Python package/runtime manager)
  • OpenAI API key and AI Gateway API key

Setup & Run

# Install dependencies
npm install

# Start the web app and the Python optimizer together
npm run dev:all

The web app runs at http://localhost:3000. The optimizer service runs locally and is started for you.

Teach Mode: How to Use

  1. Start with a base prompt by updating data/prompt.md.
  2. Enter Teach Mode and provide a scenario (what the AI should do).
  3. Chat, then collect ideal samples by selecting your question and the AI's answer.
  4. Collect as many samples as you like to cover different cases.
  5. Go to the Optimize tab and click Optimize.
  6. Watch live optimization in the History tab.
  7. The final prompt is saved to data/prompt.md and shown in the Prompt tab.
  8. Optimization versions are saved in data/versions and listed in the History tab.
  9. Try the Chat again using the updated prompt from the latest run.

Custom Tools

  • Edit src/lib/tools.ts to add or replace tools. It contains placeholder tools; anything you define/export there (using tool(...)) is automatically available to the agent in chat and optimization—no extra wiring needed.

DSPy and GEPA

  • DSPy provides the optimization framework used by this project.
  • GEPA (Genetic-Pareto) is a reflective optimizer that evolves prompts using textual feedback and Pareto-based selection.
  • A lightweight Python service exposes the optimizer; the web app calls it via /api/optimize.
  • Artifacts written by optimization:
    • data/prompt.md — current optimized prompt
    • data/complete-optimization.json — full optimization results and metadata
    • data/versions/ — versioned optimization runs and histories

Learn more: DSPy Documentation · GEPA Optimizer · GEPA Tweet · GEPA Paper

About

Built by the team that built Langtrace AI and Zest AI.

License

Apache-2.0. See LICENSE.

About

A tool kit for generating high quality prompts using DSPy GEPA optimizer

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published