dspy-reasoning-modules
Installation
Review the source and dependencies with a prompt. A package is available to download.
Install with an AI assistant
Copy the prompt so your assistant can review the pinned revision and dependencies first.
View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "dspy-reasoning-modules" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-bd324604380c9197203f44fc94540b82cd91f845a9242bebc854dda3370e721e. Verify the upstream source and version against https://github.com/OmidZamani/dspy-skills before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.
Source and setup
github.com
Setup guidance pending
See the original source for supported tools, dependencies, and permissions.
Installation test pending
A collection of reasoning modules for DSPy, covering RLM, ProgramOfThought, CodeAct, Parallel execution, sandboxed execution, and long-context workflow patterns for reasoning and execution.
Introduction source: third_party · OmidZamani · 1.0.0 Reference
SkillPi interpretation
- Tasks
- Use for DSPy reasoning modules including RLM, ProgramOfThought, CodeAct, Parallel, sandboxed execution, and long-context workflows.
- Audience
- Not specified in the source documentation.
- Inputs and outputs
- Not specified in the source documentation.
- Software, accounts and paid services
- Not specified in the source documentation.
- Limits and differences
- Not specified in the source documentation.
- Testing
- Not tested
Browse files
Frontmatter
name: dspy-reasoning-modules
version: "1.0.0"
dspy-compatibility: "3.2.1"
tags: ["reasoning"]
requires-extras: []
description: Use for DSPy reasoning modules including RLM, ProgramOfThought, CodeAct, Parallel, sandboxed execution, and long-context workflows.
allowed-tools:
- Read
- Write
- Glob
- GrepDSPy Reasoning Modules
Goal
Choose the appropriate DSPy reasoning module for long-context exploration, code-assisted reasoning, or parallel execution.
Module Selection
| Module | Use it for | Important constraint |
|---|---|---|
dspy.RLM |
Exploring very large contexts with iterative REPL code and recursive sub-LM calls | Experimental; requires Deno by default |
dspy.ProgramOfThought |
Solving tasks by generating and executing Python | Requires Deno by default |
dspy.CodeAct |
Combining generated Python with predefined tool functions | Functions only; requires Deno |
dspy.Parallel |
Running (module, example) pairs concurrently |
Tune threads and error handling |
RLM for Large Contexts
RLM treats long inputs as external data in a sandbox rather than placing the full context in each LM prompt.
import dspy
dspy.configure(lm=dspy.LM("openai/gpt-4o"))
rlm = dspy.RLM(
"document, question -> answer",
max_iterations=12,
max_llm_calls=30,
sub_lm=dspy.LM("openai/gpt-4o-mini"),
)
result = rlm(
document=very_long_document,
question="What were the main revenue drivers?",
)
print(result.answer)
Use max_iterations, max_llm_calls, and max_output_chars as explicit cost and output bounds.
Sandboxed Execution
The default dspy.PythonInterpreter uses Deno and Pyodide. It denies host filesystem, environment, and network access unless explicitly enabled.
from pathlib import Path
import dspy
with dspy.PythonInterpreter(
enable_read_paths=[Path("./inputs")],
enable_network_access=["api.example.com"],
) as interpreter:
print(interpreter.execute("print('ready')"))
Grant only the minimum paths, environment variables, and network hosts needed by the task.
ProgramOfThought and CodeAct
import dspy
dspy.configure(lm=dspy.LM("openai/gpt-4o-mini"))
math = dspy.ProgramOfThought("question -> answer")
print(math(question="What is the sum of the first 100 integers?").answer)
Use CodeAct when generated code also needs curated host-side tools:
def lookup_rate(currency: str) -> float:
"""Return a trusted exchange rate from the application service."""
return rates[currency]
agent = dspy.CodeAct("amount, currency -> converted", tools=[lookup_rate])
Parallel Execution
parallel = dspy.Parallel(num_threads=8, return_failed_examples=True)
results, failed_examples, exceptions = parallel(
[(program, {"question": question}) for question in questions]
)
Best Practices
- Prefer
PredictorChainOfThoughtuntil code execution or long-context exploration is justified. - Treat
RLMas experimental and load-test before production deployment. - Bound loops and sub-LM calls.
- Keep sandbox permissions narrow.
- Create separate interpreters for concurrent custom-interpreter use.
Official Documentation
- RLM API: https://dspy.ai/api/modules/RLM/
- ProgramOfThought API: https://dspy.ai/api/modules/ProgramOfThought/
- CodeAct API: https://dspy.ai/api/modules/CodeAct/
- Parallel API: https://dspy.ai/api/modules/Parallel/
Current listing version
1.0.0
Safety and assessment details
Quality assessment
Out of 100 · Assessment report from SkillPi LAB.
Highlights
- 提供 DSPy 高级推理模块的完整使用指南
- 包含 RLM、ProgramOfThought、CodeAct、Parallel 四大核心模块
- 面向开发者解决长上下文、代码执行、并行处理等实际痛点
Highlights
- description 明确描述技能用途和覆盖模块
- frontmatter 中 description 字段位置正确且内容完整
- 触发词边界清晰,无歧义
Highlights
- 结构清晰:模块选择表、各模块示例、最佳实践分层展示
- frontmatter 完整包含版本、兼容性、标签等必要信息
- 提供端到端代码示例和官方文档链接
Highlights
- 工具来源明确(DSPy 官方模块)
- 参数约束清晰(max_iterations、sandbox permissions)
- 覆盖异常处理和安全最佳实践
The arithmetic mean of the first four original scores, rounded to a whole number.
Static text checks
100 / 100 · skillpi-20261123-no-r3-v1
No current rules matched the text.
This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.
Permissions and checks before use
Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.
These common operations were not identified in the main document. This does not mean no permissions or risks exist.
Domains or addresses referenced in the document
These addresses may be documentation links or examples, not an approved network allowlist. Verify actual destinations and outgoing data before use.
- dspy.ai
Security rating and access scope
safe · Static evidence review; not a runtime safety guarantee.
Not specified in the source documentation.
Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.
User discussion
No verified reviews yet.