// AGENT FRAMEWORK · DSPY
DSPy
Pattern A · full governance
Configure dspy.LM with an api_base at the gateway. Every module and optimizer call routes through Agentics.
Pattern A — routed through the gateway. Your call travels through Agentics via a base-URL swap, so it is governed (routing, budgets, guardrails) inline and the Proof Ledger writes one verifiable receipt server-side. The receipt hash comes back in the
x-agentics-receipt response header.
Install
shell
pip install dspyPoint the framework's OpenAI client at the gateway
DSPy calls models through LiteLLM, so the openai/ prefix plus api_base points it at the gateway.
Python
import dspy
lm = dspy.LM(
"openai/@anthropic/claude-opus-4-8",
api_base="https://agentics.you/api/v1", # the only change
api_key="ak_…", # AGENTICS_API_KEY
)
dspy.configure(lm=lm)
print(dspy.Predict("q -> a")(q="hi").a)Run one call → see the receipt
Run your normal invocation, then read the receipt for that call off the ledger:
shell
# after your run, the last call's receipt hash:
agentics log tail --limit 1
# → shows x-agentics-receipt: <receipt_hash> (verify it at /trust)Every call the framework makes is now routed, governed, and receipted server-side.