Deterministic Agent Harness
Ground agent decisions in semantic code models and executable recipes
- Difficulty
- Expert
- Time to result
- ~months to results
- Steps
- 5
- Confidence
- 98%
A deterministic agent harness divides software work between probabilistic reasoning and reliable execution. A compiler-accurate semantic model gives the system type resolution, symbol attribution, and cross-file understanding rather than relying on text matching. Executable recipes then encode known transformations as programs, allowing an agent to identify a goal and invoke a repeatable operation instead of improvising every edit. At a higher level, orchestration sequences agents and tools inside governed, auditable workflows. The agent still plans, chooses, and handles uncovered cases, but stable work is offloaded to faster deterministic components. This reduces hallucinations, token use, and variability while preserving agent flexibility. Its ultimate test is not whether an agent proposes a plausible change, but whether the harness makes the change land safely and consistently.
Origin
Extracted from Code Story: Insights from Startup Tech Leaders during Patrick Vuong's description of Moderne's lossless semantic trees, recipes, and factory orchestration.
Core principles
- 01Use compiler-level code understanding instead of text approximation
- 02Encode repeatable transformations as programs rather than prompts
- 03Let agents select tools while deterministic systems perform bounded work
- 04Govern and audit execution across the software lifecycle
How to run it
- 1
Model code semantically
Represent the code as a compiler-accurate semantic structure with full type resolution, symbol attribution, and cross-file relationships. Preserve enough information to reuse the model across many operations.
Pro tip Treat the semantic model as durable agent context rather than rebuilding understanding from raw files each time.
Watch out Text matching and approximate syntax trees may miss relationships needed for safe transformations.
- 2
Encode deterministic recipes
Turn known transformations into executable programs built on the semantic model. Define their matching conditions, changes, and safety constraints explicitly.
Pro tip Start with frequent migrations or vulnerability fixes that already have well-understood outcomes.
Watch out A prompt describing a transformation is not equivalent to an executable recipe.
- 3
Let agents select bounded tools
Allow an agent to interpret the goal and choose the appropriate recipe or search capability. Keep the actual repeatable transformation inside the deterministic tool.
Pro tip Expose tools through a standard interface so multiple agent clients can use them.
Watch out Do not let the agent recreate a recipe ad hoc when a verified implementation exists.
- 4
Orchestrate the workflow
Sequence planning, execution, validation, and exception handling in a governed workflow. Route uncovered cases to agents or humans without weakening the deterministic path.
Pro tip Record which agent and recipe produced each change.
Watch out High-volume generation without orchestration can simply move the bottleneck into review queues.
- 5
Verify that work lands
Validate transformations against repository rules and preserve an audit trail. Measure successful completion rather than counting generated suggestions.
Pro tip Use repeatability across many repositories as a core acceptance test.
Watch out A plausible patch is not a successful outcome until it is validated and integrated.
In the wild
An agent receives a goal to migrate services to Spring Boot 4. It consults the semantic representation to identify affected code and then selects a verified recipe that applies the migration consistently across thousands of repositories, with validation and exception handling built into the workflow.
→ A complex migration becomes repeatable and auditable instead of depending on independently generated edits.
Common mistakes
Using prompts as recipes
Prompts can guide reasoning, but they do not guarantee the same transformation will be applied safely and repeatedly.
Ignoring the landing workflow
Generating changes without validation, governance, and integration merely shifts work into manual review and approval queues.
Automating unknown work too early
Deterministic tools are strongest for understood operations; novel or ambiguous cases still require agent or human judgment.
Is it for you?
Best for
Organizations performing repeatable, high-volume code transformations across complex repositories.
Not ideal for
Open-ended product design tasks that cannot be expressed as bounded transformations or checks.
From the transcript
“These are programs and they're not prompts and it essentially allows you to drive a transformation that is deterministic.”
“So think about it as agent does the work.”
“The harness make sure the work actually lands.”
From the episode
Making AI Deterministic for Developers and their Agents, with Patrick Vuong of Moderne
Patrick Vuong