DSPy

Run predictions using self-hosted DSPy programs

DSPy is an open-source framework for programming—rather than prompting—language models. DSPy enables you to build interpretable and modular LLM-powered agents using Python functions, structured modules, and declarative signatures, making it easy to compose, debug, and reliably deploy language model applications.

With DSPy in Sim, you can:

  • Run custom predictions: Connect your self-hosted DSPy server and invoke prediction endpoints for a variety of natural language tasks.
  • Chain of Thought and ReAct reasoning: Leverage advanced DSPy modules for step-by-step reasoning, multi-turn dialogs, and action-observation loops.
  • Integrate with your workflows: Automate LLM predictions and reasoning as part of any Sim automation or agent routine.
  • Provide custom endpoints and context: Flexibly call your own DSPy-powered APIs with custom authentication, endpoints, input fields, and context.

These features let your Sim agents access modular, interpretable LLM-based programs for tasks like question answering, document analysis, decision support, and more—where you remain in control of the model, data, and logic.

Usage Instructions

Integrate with your self-hosted DSPy programs for LLM-powered predictions. Supports Predict, Chain of Thought, and ReAct agents. DSPy is the framework for programming—not prompting—language models.

Tools

dspy_predict

Run a prediction using a self-hosted DSPy program endpoint

Input

ParameterTypeRequiredDescription
baseUrlstringYesBase URL of the DSPy server (e.g., https://your-dspy-server.com\)
apiKeystringNoAPI key for authentication (if required by your server)
endpointstringNoAPI endpoint path (defaults to /predict)
inputstringYesThe input text to send to the DSPy program
inputFieldstringNoName of the input field expected by the DSPy program (defaults to "text")
contextstringNoAdditional context to provide to the DSPy program
additionalInputsjsonNoAdditional key-value pairs to include in the request body

Output

ParameterTypeDescription
answerstringThe main output/answer from the DSPy program
reasoningstringThe reasoning or rationale behind the answer (if available)
statusstringResponse status from the DSPy server (success or error)
rawOutputjsonThe complete raw output from the DSPy program (result.toDict())

dspy_chain_of_thought

Run a Chain of Thought prediction using a self-hosted DSPy ChainOfThought program endpoint

Input

ParameterTypeRequiredDescription
baseUrlstringYesBase URL of the DSPy server (e.g., https://your-dspy-server.com\)
apiKeystringNoAPI key for authentication (if required by your server)
endpointstringNoAPI endpoint path (defaults to /predict)
questionstringYesThe question to answer using chain of thought reasoning
contextstringNoAdditional context to provide for answering the question

Output

ParameterTypeDescription
answerstringThe answer generated through chain of thought reasoning
reasoningstringThe step-by-step reasoning that led to the answer
statusstringResponse status from the DSPy server (success or error)
rawOutputjsonThe complete raw output from the DSPy program (result.toDict())

dspy_react

Run a ReAct agent using a self-hosted DSPy ReAct program endpoint for multi-step reasoning and action

Input

ParameterTypeRequiredDescription
baseUrlstringYesBase URL of the DSPy server (e.g., https://your-dspy-server.com\)
apiKeystringNoAPI key for authentication (if required by your server)
endpointstringNoAPI endpoint path (defaults to /predict)
taskstringYesThe task or question for the ReAct agent to work on
contextstringNoAdditional context to provide for the task
maxIterationsnumberNoMaximum number of reasoning iterations (defaults to server setting)

Output

ParameterTypeDescription
answerstringThe final answer or result from the ReAct agent
reasoningstringThe overall reasoning summary from the agent
trajectoryarrayThe step-by-step trajectory of thoughts, actions, and observations
thoughtstringThe reasoning thought at this step
toolNamestringThe name of the tool/action called
toolArgsjsonArguments passed to the tool
observationstringThe observation/result from the tool execution
statusstringResponse status from the DSPy server (success or error)
rawOutputjsonThe complete raw output from the DSPy program (result.toDict())

On this page

Start building today
Trusted by over 60,000 builders.
Build Agentic workflows visually on a drag-and-drop canvas or with natural language.
Get started