Welcome to DSPy Code
Develop DSPy Applications âĸ Optimize with GEPA
The Complete Platform for Building and Optimizing DSPy Applications
đĄ Note: DSPy Code is in its initial release and under active development. The quality and effectiveness of generated code depends on several factors: the language model you connect, MCP (Model Context Protocol) servers you integrate, and the context you provide to DSPy Code. We're continuously improving based on community feedback.
đ¯ What is DSPy Code?
đī¸ Develop DSPy Applications
Build, learn, and create DSPy programs with natural language. Generate signatures, modules, and complete applications with AI-powered assistance.
- Natural language to code
- Codebase understanding
- Validation & best practices
- 20+ templates
đ§Ŧ Optimize with GEPA
Transform your DSPy code into production-ready applications using GEPA (Genetic Pareto). Automatically improve accuracy and achieve better performance.
- Real GEPA execution
- Automated metrics
- Prompt evolution
- Production-ready code
The Complete Workflow
From idea to production-ready DSPy application in one platform
đĄ Who is This For?
-
Complete Beginners
Never used DSPy before? Perfect! Start here and learn by doing. The CLI teaches you DSPy concepts as you build real programs.
No prerequisites needed.
-
DSPy Developers
Already know DSPy? Supercharge your workflow with AI-powered code generation, validation, and optimization.
Build faster, optimize smarter.
-
Production Teams
Building production DSPy applications? Get validated, optimized, production-ready code with GEPA optimization and best practices built-in.
Ship with confidence.
đ Complete Development + Optimization Workflow
-
Phase 1: Development
Build your DSPy application from scratch or enhance existing code.
Steps: 1.
/init- Initialize project 2. Natural language commands to generate code 3./validate- Ensure best practices 4. Test and iterate -
Phase 2: Optimization
Optimize your working code with GEPA for production.
Steps: 1.
/data- Generate training examples 2./optimize- Run GEPA optimization 3./eval- Evaluate improvements 4./export- Package for deployment
đ¯ The Result
Production-ready DSPy applications with optimized performance, evolved prompts, and documented improvements
đ Use Cases: When to Use DSPy Code
1. đī¸ Starting a New DSPy Project
Perfect for:
- Building a new AI application from scratch
- Prototyping ideas quickly
- Learning DSPy fundamentals
What you get:
â
Complete project structure
â
Configuration files
â
Example programs
â
Best practices setup
â
Ready to code in 2 minutes
Example: "I want to build a customer support chatbot with sentiment analysis and automated responses."
2. đ§Ŧ Optimizing DSPy Programs with GEPA
Perfect for: - Improving accuracy of existing programs - Automatic prompt engineering - Production optimization
What you get:
# Generate training data
â Generate 100 examples for sentiment analysis
# Optimize automatically
/optimize my_program.py training_data.jsonl
â
Real GEPA execution (not just code generation)
â
Automated metric functions
â
Progress tracking & resumption
â
Production-ready optimized code
â
Performance improvements documented
Real results: 75% â 92% accuracy automatically!
Example: "My sentiment analyzer is 75% accurate. Optimize it with GEPA to reach 90%+"
3. Adding DSPy to Existing Projects
Perfect for:
- Enhancing existing Python applications
- Adding AI capabilities to current systems
- Modernizing legacy code
What you get:
â
Minimal setup (no disruption)
â
Scans your existing code
â
Understands your project structure
â
Generates code that fits your style
â
Works alongside your current code
Example: "I have a Django app. I want to add AI-powered document summarization."
4. Learning DSPy (No Docs Required!)
Perfect for:
- First time using DSPy
- Understanding DSPy concepts
- Exploring different patterns
How it works:
Just ask questions in natural language:
â What is a DSPy Signature?
â How does ChainOfThought work?
â Show me an example of ReAct
â When should I use GEPA optimization?
The CLI answers using YOUR installed DSPy version and provides working code examples!
No reading required. Learn by building.
5. Connecting to MCP Servers for Powerful DSPy Programs
DSPy Code is an MCP Client!
Connect to any MCP (Model Context Protocol) server to supercharge your DSPy programs with external tools, APIs, and data sources.
What you can do:
# Add MCP server
/mcp-add web-tools --transport stdio --command "python server.py"
# Connect to server
/mcp-connect web-tools
# Use tools in your DSPy programs
â Create a DSPy module that searches the web and summarizes results
â
Access external tools - Web search, databases, APIs
â
Read from data sources - Files, documents, databases
â
Execute commands - System operations, scripts
â
Integrate services - Third-party APIs and tools
â
Build powerful workflows - Combine DSPy with external capabilities
Example: "Build a RAG system that uses MCP to query my company's database and generate answers."
6. Building Production AI Applications
Perfect for:
- Enterprise applications
- Production deployments
- Mission-critical systems
What you get:
â
Validated, production-ready code
â
Best practices built-in
â
Error handling and logging
â
Type hints and documentation
â
Optimized performance
â
Export as packages
Quality score: 90+ out of 100 automatically!
⨠Key Features
-
Natural Language Interface
Describe what you want in plain English. The CLI generates complete, working DSPy code.
Done! Complete code generated.
-
Built-in MCP Client
Connect to any MCP server to access external tools, APIs, databases, and services in your DSPy programs.
Build powerful, connected AI applications.
-
Version-Aware Intelligence
Adapts to YOUR installed DSPy version. Answers questions using your actual code, not outdated docs.
Always current. Always accurate.
-
Real GEPA Optimization
Not mocked. Real GEPA (Genetic Pareto) optimization that improves your programs by 10-30% automatically.
Production-grade results.
-
Smart Validation
Every generated code is validated for quality, best practices, and correctness. Score: 90+/100.
Ship with confidence.
-
Codebase Knowledge
Indexes your DSPy installation and project. Ask questions about your own code!
"Explain my RAG module" - Done!
-
Universal Model Support
Connect to any LLM: Ollama (local), OpenAI, Anthropic, Gemini. Switch anytime.
Your choice, your control.
-
Learn as You Build
No docs, books, or tutorials needed. Ask questions, get answers from your code, build in real-time.
Interactive learning experience.
đŦ See It In Action
Quick Example
# Start DSPy Code
dspy-code
# Initialize project
â /init --fresh
# Connect to model
â /model
# Generate code in natural language
â Create a sentiment analyzer with confidence scores
# Validate
â /validate
# Save
â /save sentiment_analyzer.py
# Generate training data
â Generate 50 examples for sentiment analysis
# Optimize with GEPA
â /optimize sentiment_analyzer.py training_data.jsonl
Result: Production-ready, optimized sentiment analyzer in 5 minutes!
đ Quick Start
1. Install
pip install dspy-code 2. Start
dspy-code 3. Build
/init
/model
Create a [your app] Complete Quick Start Guide â
đŦ Real Workflows
Workflow 1: Complete Beginner
Day 1:
â Install DSPy Code
â /init --fresh
â "What is DSPy?"
â "Create a simple text classifier"
â /save my_first_program.py
â /run
Result: Working DSPy program, understanding of basics
Workflow 2: Building Production App
Week 1:
â dspy-code /init in existing project
â Generate signatures, modules, programs
â Generate 200 training examples
â Optimize with GEPA
â Validate (95/100 quality score)
â Export as package
â Deploy
Result: Production-ready AI application
Workflow 3: Learning Advanced Patterns
â "Show me how ReAct works"
â "Create a multi-agent system"
â "Explain GEPA optimization"
â "Build a RAG system with custom retrieval"
Result: Deep understanding through hands-on building
đ¯ Common Questions
Do I need to know DSPy first?
No! That's the whole point. DSPy Code teaches you as you build. Just start creating and ask questions when you need help.
Can I use this with my existing DSPy code?
Yes! Run /init in your project directory. DSPy Code will scan your code and help you extend it.
What models can I use?
Any! Ollama (local), OpenAI, Anthropic, Gemini. Connect easily with /model or directly with /connect <provider> <model>.
Is the optimization real or mocked?
Real GEPA optimization! Actual Genetic Pareto optimization that improves accuracy by 10-30%.
Do I need to read documentation?
No! Just ask DSPy Code. It answers questions using your actual installed DSPy version.
đ Ready to Start?
Start Building in 2 Minutes
No docs to read. No tutorials to follow. Just start building.
đ Documentation Structure
-
Getting Started
Installation, quick start, first program, understanding the architecture
-
User Guide
Interactive mode, code generation, validation, optimization, project management
-
Tutorials
Step-by-step guides for building real applications
-
Reference
Commands, configuration, FAQ, troubleshooting
-
Advanced
MCP integration, custom modules, deployment
đ¤ Technical Support
Need help? Check these resources:
- FAQ - Common questions answered
- Troubleshooting - Fix common issues
- GitHub Issues - Report bugs or request features
DSPy Code by Superagentic AI
Comprehensive CLI to Optimize Your DSPy Code - Learn by building. No docs required.