feat(validate): catch template reference errors before runtime#125
Open
PolyphonyRequiem wants to merge 1 commit intomicrosoft:mainfrom
Open
feat(validate): catch template reference errors before runtime#125PolyphonyRequiem wants to merge 1 commit intomicrosoft:mainfrom
PolyphonyRequiem wants to merge 1 commit intomicrosoft:mainfrom
Conversation
4744356 to
c2b107f
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #125 +/- ##
=======================================
Coverage ? 84.85%
=======================================
Files ? 53
Lines ? 7261
Branches ? 0
=======================================
Hits ? 6161
Misses ? 1100
Partials ? 0 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Enhanced `conductor validate` to scan Jinja2 templates in agent prompts,
script args, input_mapping, and workflow output for reference errors:
Level 1 — Template reference resolution:
- {{ X.output.Y }} where X is not a valid agent name → error
- {{ workflow.input.X }} where X is not a declared input → error
- In explicit mode, LLM agents referencing agent outputs not in their
input: list → warning
Also wires semantic validation (validate_workflow_config) into the CLI
`conductor validate` command, which previously only ran Pydantic schema
validation.
Catches errors like: stale agent name references after renames, missing
workflow input declarations, and undeclared dependencies in explicit mode
— all before runtime, at zero cost.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
c2b107f to
aaac6dd
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Enhanced
conductor validateto catch Jinja2 template reference errors before runtime. Previously,conductor validateonly checked YAML schema (Pydantic) — stale agent references, missing workflow inputs, and undeclared dependencies only surfaced at runtime after minutes of execution and real API costs.What it catches
Errors (validation fails)
{{ old_agent_name.output.field }}whereold_agent_namedoesn't exist{{ workflow.input.missing_field }}wheremissing_fieldisn't declared ininput:Warnings (validation passes with notes)
{{ a.output.val }}but doesn't declarea.outputin itsinput:listExample
Changes
src/conductor/config/validator.py:_TEMPLATE_REF_PATTERNand_WORKFLOW_INPUT_REF_PATTERNfor scanning templates_collect_template_strings()to gather all Jinja2 template strings from an agent_validate_template_references()with agent name, workflow input, and explicit mode checksvalidate_workflow_config()signature to accept optionalworkflow_pathsrc/conductor/cli/validate.py:validate_workflow_config) into the CLIvalidatecommand — it previously only ran Pydantic schema validationTesting