DSPy System One patterns
Six-file DSPy coding agent where Jev answers closed questions (safety, tool fit, history, delegation) and Python owns policy.
Overview
This repository builds one coding agent in six small files, each adding a single design pattern on top of DSPy's RLM and TypeSafe's Jev. The frontier model writes code inside a dspy.RLM sandbox, a cheaper sub-model reads and summarises, and Jev answers closed questions with probabilities: is this command safe, which tool fits, how much does this past turn matter, and could a helper take this step. Plain Python turns those probabilities into actions using named thresholds.
The series progresses from a baseline through a permission gate, relevant-tool finding, history relevance, delegation and a final combined agent, plus a script that fits thresholds. Every demo resets a sample repository with one known bug and a failing test and sends the same request with eight fake prior turns. Commands in the gate's ask band are denied unless AUTO_APPROVE is set. The rule throughout: the signature states the question, Jev returns the probability, Python owns the policy.
What the decision model decides
| Type | Question | Answers |
|---|---|---|
| Yes / no | Is this command safe to run? | yes · no |
| Choice | Which tool fits this step? | — |
| Score | How much does this past turn matter to the current request? | — |
| Yes / no | Could a cheaper helper take this step? | yes · no |
How it works
- Frontier model plans and writes code in the RLM sandbox
- Jev answers typed questions via DSPy signatures
- Python applies named thresholds (allow/ask/deny, delegate, keep history)
- fit_thresholds.py tunes thresholds
Strengths
- Clear, incremental teaching structure
- Policy stays in plain Python
- Threshold fitting included
Caveats
- Teaching example on a toy repository
- Requires both OpenAI and TypeSafe keys
Getting started
uv pip install "dspy[typesafe]==3.4.0" dspy-monty-interpreter pytest python-dotenv, add keys to .env, then run agent_v0_baseline.py through agent_v5_final.py.At a glance
- Type
- Project
- Status
- prototype
- Language
- Python
- Runtime
- DSPy scripts
- Has code
- yes
- Has tests
- yes
Use cases and integrations
How curated lists describe it
Six files, one coding agent, one pattern each, on a single rule: the signature states the question, Jev returns the probability, and plain Python owns the policy.
MrJev/awesome-jev
Frequently asked questions
What does Jev answer?
Whether commands are safe, which tool fits, how relevant past turns are, and whether to delegate.
Who makes the final decision?
Plain Python using named thresholds.
What do I need to run it?
OpenAI and TypeSafe keys plus DSPy 3.4.0 with the typesafe extra.
Related projects
Composio agent SDK with an optional TypeSafe provider that uses Jev to shortlist and pick tools and closed-set arguments.
ProjectproductionTypeScriptDeepSeek Harness plugin with 12 opt-in Jev or Luna Decisions judgments: skill and file selection, supervision, filtering and approval help.
PluginbetaTypeScriptDecision middleware for AI agents that uses local Laya to pick tools and judge results, falling back to an LLM when unsure.
ProjectbetaPythonopencode plugin that routes the agent's small multiple-answer decisions to Jev and labels each answer auto or escalate by confidence.
PluginbetaTypeScriptSkill and CLI that compares a shortlist of agents, MCP servers or skills against a task and permission ceiling, abstaining on weak leads.
MCP serverprototypeTypeScriptStrict-allowlist shell harness where Jev walks a TOML decision tree to pick a bash command, flags and paths, confirming writes.
ProjectprototypePython