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.
Built from the ground up for Goβnot just a port. Idiomatic Go patterns, strong typing, and seamless integration with your existing Go applications.
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!State-of-the-art prompt optimization algorithms that automatically improve your prompts:
Smart Tool Registry uses Bayesian inference for intelligent tool selection. Automatic performance tracking, capability analysis, and MCP (Model Context Protocol) integration.
Native support for:
Build production-ready agents with reasoning, tool use, and memory:
// 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| Feature | Description |
|---|---|
| Modular Design | Compose simple, reusable components into complex applications |
| Multiple LLMs | Anthropic, OpenAI, Google Gemini, Ollama, LlamaCPP, and more |
| Intelligent Agents | ReAct patterns, ACE framework, memory management, and custom tools |
| A2A Protocol | Multi-agent orchestration with hierarchical composition |
| RLM Module | Large context exploration through sandboxed Go REPL |
| XML Adapters | Structured output parsing with security controls |
| Tool Chaining | Sequential pipelines with data transformation and conditional logic |
| Dependency Resolution | Automatic execution planning with parallel optimization |
| CLI Tool | Explore optimizers and view RLM session logs |
| Compatibility Testing | Framework ensures Python DSPy parity |
| Dataset Management | Auto-download GSM8K, HotPotQA, and more |
Ready to get started? Head to Getting Started β