Docs

Welcome to dspy-go

dspy-go is a native Go implementation of the DSPy framework that brings systematic prompt engineering and automated reasoning capabilities to Go applications. Build reliable and effective Language Model (LLM) applications through composable modules, powerful optimizers, and intelligent tool management.

Why dspy-go?

🎯 Go-Native Architecture

Built from the ground up for Goβ€”not just a port. Idiomatic Go patterns, strong typing, and seamless integration with your existing Go applications.

πŸš€ Zero to Production in Minutes

Get started with zero configuration. One-line setup automatically detects your environment and configures the appropriate LLM provider.

llm, _ := llms.NewGeminiLLM("", core.ModelGoogleGeminiPro)
core.SetDefaultLLM(llm)
// Ready to go!

🧠 Advanced Optimizers

State-of-the-art prompt optimization algorithms that automatically improve your prompts:

  • GEPA: Multi-objective evolutionary optimization with Pareto selection
  • MIPRO: TPE-based systematic prompt optimization
  • SIMBA: Introspective mini-batch learning
  • BootstrapFewShot: Automated few-shot example selection
  • COPRO: Collaborative multi-module optimization

πŸ”§ Intelligent Tool Management

Smart Tool Registry uses Bayesian inference for intelligent tool selection. Automatic performance tracking, capability analysis, and MCP (Model Context Protocol) integration.

⚑ Built for Performance

  • Parallel module execution out of the box
  • Concurrent batch processing
  • Efficient streaming support
  • Optimized for production workloads

🎨 Multimodal from Day One

Native support for:

  • Image analysis and vision Q&A
  • Multimodal chat conversations
  • Streaming multimodal content
  • Content block system for flexible media handling

πŸ€– Intelligent Agents

Build production-ready agents with reasoning, tool use, and memory:

  • ReAct Pattern: Reasoning + Acting with iterative tool execution
  • Memory Management: Buffer and summary memory for conversation context
  • Orchestration: Task decomposition and multi-agent coordination
  • Custom Tools: Easy integration with APIs, databases, and external systems
  • Reflection: Self-improving agents that learn from their actions
  • ACE Framework: Agentic Context Engineering for self-improving agents
// Create a self-improving agent with ACE
aceConfig := ace.Config{
    Enabled:       true,
    LearningsPath: "./learnings/agent.md",
}
agent := react.NewReActAgent("my-agent", "Assistant",
    react.WithACE(aceConfig),  // Enable self-improvement!
)
// Agent automatically:
// 1. Records execution trajectories
// 2. Learns from successes and failures
// 3. Applies learnings to future tasks

What Can You Build?

  • Question Answering Systems: RAG pipelines with retrieval and generation
  • Code Analysis Tools: Automated code review and refactoring suggestions
  • Data Processing Pipelines: Extract, transform, and analyze data with LLMs
  • Intelligent Agents: ReAct patterns with tool use and reasoning
  • Multi-Step Workflows: Chain modules for complex task decomposition
  • Optimization Systems: Automatically improve prompt performance

Key Features at a Glance

FeatureDescription
Modular DesignCompose simple, reusable components into complex applications
Multiple LLMsAnthropic, OpenAI, Google Gemini, Ollama, LlamaCPP, and more
Intelligent AgentsReAct patterns, ACE framework, memory management, and custom tools
A2A ProtocolMulti-agent orchestration with hierarchical composition
RLM ModuleLarge context exploration through sandboxed Go REPL
XML AdaptersStructured output parsing with security controls
Tool ChainingSequential pipelines with data transformation and conditional logic
Dependency ResolutionAutomatic execution planning with parallel optimization
CLI ToolExplore optimizers and view RLM session logs
Compatibility TestingFramework ensures Python DSPy parity
Dataset ManagementAuto-download GSM8K, HotPotQA, and more

Community & Support

Ready to get started? Head to Getting Started β†’