DSPy-Go

Build composable, optimizable LLM workflows and agents in native Go.

Stars
★ 203
Last updated
4d ago
License
MIT
Primary language
Go

At a glance

How it runs
CLILibrary / SDKFramework
Works with
Universal · cross-platformOpenAI API · Claude APICodex (Partial support)
Cost
Free software; you pay for model usage
Setup effort
Medium · a few setup steps
You'll need
Go toolchainllm-goProvider API credentials or an OpenAI-compatible local endpointShell / CLINetwork accessLocal filesystem
Typical use
A Go backend team adding contract-based question answering, classification, or generation can combine a Signature with Predict or ChainOfThought.
Not a fit if
  • Teams wanting built-in OAuth login and credential storage
  • Teams needing published latency, cost, or quality benchmarks

What does this agent do, and when should you use it?

DSPy-Go is a native Go implementation of DSPy for teams building modular LLM applications and agents. It defines input and output contracts with Signatures and supplies composable Predict, ChainOfThought, ReAct, RLM, Refine, and Parallel modules. At execution time, a module resolves its model from SetLLM, request-scoped core.WithRuntime configuration, or the package default set by core.SetDefaultLLM. The pkg/llms compatibility layer connects to Anthropic, OpenAI, Google Gemini, Ollama, llama.cpp, and OpenAI-compatible services, while llm-go owns generation, streaming, structured output, and tool calls. The repository also documents A2A multi-agent composition, ACE self-improving agents, MCP integration, intelligent tool selection, and optimizers including GEPA, MIPRO, and SIMBA. It is delivered primarily as a Go library with a buildable dspy-cli, leaving deployment, credentials, and OAuth lifecycle management to the host application.

A program defines named inputs, outputs, descriptions, and instructions with core.NewSignature, then passes that contract to modules such as NewChainOfThought, Predict, ReAct, RLM, Refine, or Parallel. Calling Process(context.Context, map[string]interface{}) resolves the configured LLM, sends the task to that provider, and returns a field-keyed result; the introductory example reads result["answer"]. ReAct combines reasoning with tool use, while the tool system supports Bayesian selection, chaining, composition, and MCP integration; A2A provides hierarchical multi-agent composition. For machine-readable results, WithStructuredOutput() enables JSON output, while interceptors.ApplyXMLInterceptors configures the XML alternative. Optimization can run through GEPA, MIPRO, SIMBA, BootstrapFewShot, or COPRO, and the CLI can enumerate optimizers, try one against a dataset, and inspect RLM JSONL session logs.

  1. A Go backend team adding contract-based question answering, classification, or generation can combine a Signature with Predict or ChainOfThought.
  2. Developers whose models must invoke external capabilities can build ReAct flows with tool chaining, composite tools, and the smart tool registry.
  3. Teams exploring large contexts can use RLM with full, checkpointed, or adaptive replay policies and inspect recorded sessions through the CLI.
  4. Prompt-optimization researchers can try MIPRO on a dataset such as GSM8K and evaluate GEPA, SIMBA, BootstrapFewShot, or COPRO.
  5. Go developers building research or collaboration systems can compose agents hierarchically with A2A or experiment with ACE self-improving agents.
  6. Products that need backend flexibility can configure Anthropic, OpenAI, Gemini, Ollama, llama.cpp, or another OpenAI-compatible endpoint.

How do you install or deploy this agent?

Install the package in an existing Go module:

go get github.com/XiaoConstantine/dspy-go

The supplied material does not state a minimum Go version. To build the CLI from the repository, run:

cd cmd/dspy-cli && go build -o dspy-cli

Configure credentials for the chosen provider; the documented CLI example uses:

export GEMINI_API_KEY="your-api-key"

Ollama and llama.cpp must expose an OpenAI-compatible endpoint. OpenAI Codex subscription generation additionally requires the host application to own OAuth login, token refresh, and credential storage.

How do you use this agent?

For an initial CLI run, use:

./dspy-cli list
./dspy-cli try mipro --dataset gsm8k
./dspy-cli view session.jsonl --stats

In Go, create a provider with llms.NewGeminiLLM("", core.ModelGoogleGeminiPro) and register it using core.SetDefaultLLM(llm). Define question and answer fields with core.NewSignature, construct modules.NewChainOfThought(signature), then call cot.Process(context.Background(), map[string]interface{}{"question": "What is the capital of France?"}) and read result["answer"]. Production callers should handle errors from both model construction and Process. Use SetLLM for a module-specific override or core.WithRuntime for a request-scoped model.

What are this agent's strengths and limitations?

Pros
  • One Go API covers direct prediction, chain-of-thought processing, tool-using ReAct, large-context exploration, iterative refinement, and parallel batches.
  • Anthropic, OpenAI, Gemini, and local or hosted OpenAI-compatible backends are supported, reducing dependence on a single model provider.
  • GEPA, MIPRO, SIMBA, BootstrapFewShot, and COPRO are included as optimization choices, with CLI commands for discovery and immediate trials.
  • Both JSON structured output and an XML interceptor path are documented, including security controls for the XML adapter.
  • A2A, ACE, MCP integration, tool selection, chaining, and composition support projects ranging from individual agents to hierarchical systems.
Limitations
  • Provider protocols and model metadata now come from the separate llm-go project, adding a dependency and cross-project upgrade surface.
  • Ollama and llama.cpp must provide an OpenAI-compatible endpoint rather than using an arbitrary native interface.
  • The OpenAI Codex subscription path has no interactive authentication subsystem; the host must implement OAuth login, refresh, and secure credential storage.
  • The installation material does not identify a minimum Go version or fully document feature differences among providers.
  • The supplied material gives no comparative latency, cost, or quality benchmarks for its modules and optimizers, so adopters must validate them.

How does this agent compare with similar options?

Compared with the original DSPy framework, DSPy-Go's stated distinction is a native implementation for Go applications. At the provider layer, users can choose Anthropic, OpenAI, Gemini, Ollama, llama.cpp, or another OpenAI-compatible service; Ollama and llama.cpp specifically require a compatible endpoint. For structured results, JSON output and the interceptor-based XML adapter are documented alternatives.

Key facts side by side with the most closely related agents.

Agent Source review Form / cost Stars Updated Language Full support on
DSPy-Go This agent 49 · Major gaps CLIFree + model costs ★ 203 4d ago Go OpenAI API · Claude API
npcpy Agent Framework 43 · Major gaps Library / SDKFree + model costs ★ 1.5k 4d ago Python Codex · Claude Code · OpenAI API · Claude API
Selectools 65 · Some gaps Library / SDKFree + model costs ★ 11 3d ago Python OpenAI API · Claude API
Nausicaa 85 · Good CLIFree + model costs ★ 33 1mo ago TypeScript ChatGPT · OpenAI API · Claude API

How does FollowAgents rate this agent?

FollowAgents source review · FARS-2.1
Major gaps
49/ 100 5-point scale 2.5 / 5
This review covers the source as of Sep 17, 2026. The project has shipped 2 stable release(s) since, which have not been re-reviewed. The score and verdict describe the reviewed version only. Recent releases ↓
Trust 11/29
Reliability 6/14
Adaptability 10/18
Convention 11/18
Effectiveness 7/13
Verifiability 4/8
Why each dimension lost points
Trust11 / 29 · 1.9/5

The CI workflow grants read-only contents permission, while the README identifies external LLM calls, local compatible endpoints, and application ownership of OAuth credentials; the license also supplies author attribution. However, the evidence does not show isolation of agent-tool permissions, per-action user confirmation, a complete sensitive-data lifecycle, or general controls over external side effects. Dependencies are version-pinned, but no vulnerability scanning, verification policy, or supply-chain response process is shown. Save, restore, and replay apply only to selected optimization/RLM workflows and are not a general rollback mechanism for external actions.

Reliability6 / 14 · 2.1/5

The modules, providers, and llm-go responsibility described in the README are broadly consistent with go.mod, and CI performs vetting, testing, or builds across Linux, macOS, and CGO-disabled Linux/Windows configurations. This provides reasonable evidence for ordinary dependency availability. Deductions apply because no execution results are supplied, the quick-start example discards the Process error, and the provided files do not demonstrate the quality of user-facing failure messages.

Adaptability10 / 18 · 2.8/5

The material addresses Go application developers through a zero-code CLI, programming APIs, local and remote models, composable modules, and multi-agent scenarios. It also defines model-resolution precedence, authentication ownership, embedding responsibility, and compatible-endpoint requirements. Boundaries remain incomplete, while smart tool selection and agent triggering are primarily asserted without thresholds, ambiguity handling, or false-trigger safeguards. Full prerequisites and CGO/SQLite deployment constraints are also absent.

Convention11 / 18 · 3.1/5

The README has clear navigation for installation, quick start, concepts, providers, documentation, and examples. The MIT text matches the license metadata, justifying full license and information-architecture marks. Installation is actionable but lacks complete prerequisites and troubleshooting, and examples are plentiful without an evident FAQ. Compatibility adapters and preferred helper names support stability, but no deprecation policy is shown. Some authentication and endpoint limitations are documented, yet there is no centralized limitations section, version policy, or changelog. Maintenance responsibility is only partly inferable from the copyright holder, repository namespace, and main-branch documentation deployment, with no explicit support or update commitment.

Effectiveness7 / 13 · 2.7/5

Signatures, structured output, modules, and concrete Go examples make results reasonably usable in applications. Combining providers, reasoning modules, optimizers, and tool orchestration offers plausible value over assembling these pieces independently. Scores are reduced because the broad capability set is chiefly described rather than benchmarked in the supplied evidence, and token, latency, concurrency, infrastructure, and maintenance costs are not quantified.

Verifiability4 / 8 · 2.5/5

Installation details, module names, provider ownership, and licensing can be cross-checked among the README, go.mod, workflows, and LICENSE, while CI definitions make some engineering claims traceable. Many advanced features appear only in the feature table or links to material not supplied here, without matching implementation or test evidence. Marketing claims, design intentions, inferences, and verified facts are not systematically separated.

Risks and how to mitigate them
  • Not found in source: confirmation before actingTurn on (or add) a confirmation step before it acts, and try it in a sandbox or test environment before real data.
  • This is a low-confidence static review; no code, tests, model calls, or tool calls were executed.
  • Before using the framework for agents with external side effects, verify tool permissions, per-action confirmation, network destination restrictions, and recovery behavior.
  • API keys and OAuth tokens are managed by the host application; storage, log redaction, refresh, and revocation policies require separate validation.
  • The dependency tree is substantial and includes remote-model SDKs, MCP, SQLite, an interpreter, and cloud components; perform version, license, and vulnerability review before adoption.
  • The quick-start example ignores the Process error and should not be copied as production error-handling practice.
Evidence confidence: Low Reviewed Sep 17, 2026 Reviewed revision 3a6acf505b30 New commits since this review; the score may not cover them
See the full review method →

Recent releases

Latest entries from the project's GitHub Releases. Notes are quoted from upstream as written, not rewritten or tested by FollowAgents.

  1. v0.89.1
    Release notes excerpt
    Changes _From v0.89.0 to v0.89.1_ - b0c3273 build(deps): bump thulite theme packages and Hugo for docs (#385) - 0599943 build(deps): bump Go dependencies and fix x/net vulnerabilities (#378) - 686b915 build(deps): bump docs npm dependencies and fix audit alerts (#379) - 7242bb1 fix: use modernc.org/sqlite for CGO-free SQLite stores (#367) - b96618b build(deps): consolidate open Go dependency updates - ee9c335 fix(deps): patch docs brace-expansion vulnerabilities - be36e3a build(deps): bump google.golang.org/genai in / (#368) …
    View on GitHub ↗
  2. v0.89.0
    Release notes excerpt
    Changes _From v0.88.1 to - d68228d fix(cli): sync llm-go dependency - 95f3845 fix(rlm): hide failed batch responses - d58dca9 fix(rlm): preserve subquery token totals - cad2f00 fix(rlm): preserve provider token totals - 171f594 fix(rlm): preserve failed query accounting - d89a0fc fix(rlm): propagate query accounting failures - 84bfeb1 fix(rlm): make async cleanup deterministic - e0e69e0 fix(rlm): enforce budgets between subcalls - 0717a26 fix(core): normalize incomplete token totals - 29b544d fix(rlm): enforce tree-wide token budgets - 92a4530 fix(config): wrap metrics with tracing …
    View on GitHub ↗
  3. v0.88.1
    Release notes excerpt
    Changes _From v0.88.0 to - 57bf1f1 bump llm-go to v0.3.1 - e4f58b8 configure grouped Go dependency updates - 67c2a8a fix Apache Thrift vulnerability - 10394ca fix vulnerable dependencies - b5ba0d3 bump llm-go dep - ee8649e fix cli dep - 3f0d2a0 bump llm-go - 732ea61 refactor: remove direct Anthropic SDK dependency
    View on GitHub ↗

FAQ

Does DSPy-Go require a paid model provider?
No single paid provider is mandatory. It supports several cloud providers and can connect to Ollama, llama.cpp, LiteLLM, or LocalAI through an OpenAI-compatible endpoint; actual cost depends on the selected backend.
Who manages API keys and OAuth credentials?
The host application supplies provider credentials. For OpenAI Codex subscription generation, it must also implement OAuth login, token refresh, and credential storage.
Can different requests or modules use different models?
Yes. Resolution order is module-local SetLLM, request-local core.WithRuntime, and finally the package default configured through core.SetDefaultLLM.
Is an MCP server required?
No. MCP is an available tool-management integration, not a prerequisite for ordinary Predict, ChainOfThought, or other workflows that do not use it.
Does it document production failure handling?
The APIs return errors during model creation and Process execution, although the quick-start example ignores the latter. Timeout, retry, rate-limit, and recovery policies are not described in the supplied material and require adopter evaluation.
View on GitHub ↗ Install ↓

Compare agents like this one

The same FARS review applied across the shortlist this agent qualifies for.

Related agents