Bug Description
In explicit context mode, script agent args and sub-workflow input_mapping templates that reference {{ workflow.input.X }} fail with TemplateError because workflow.input is an empty dict {}, even though the inputs were correctly passed via --input.
Reproduction
workflow:
name: explicit-script
entry_point: detector
context:
mode: explicit
input:
work_item_id:
type: number
required: true
agents:
- name: detector
type: script
command: pwsh
args:
- "-Command"
- "Write-Output '{{ workflow.input.work_item_id }}'; exit 0"
routes:
- to: $end
conductor run explicit-script.yaml --input work_item_id=42
Expected: Script outputs 42
Actual: TemplateError: 'dict object' has no attribute 'work_item_id'
Root Cause
WorkflowContext.build_for_agent() in explicit mode initializes workflow.input as {} and only populates entries explicitly declared in the agent's input: list via _add_explicit_input(). Script agents and sub-workflow input_mapping templates typically don't declare workflow inputs in their input: list because they are local template renders (no LLM prompt/token cost concern).
The same {{ workflow.input.X }} template works fine in:
accumulate mode (default) — workflow.input is always fully populated
last_only mode — same
- LLM agent
prompt fields in explicit mode — if workflow.input.X is declared in the agent's input: list
Impact
Any workflow using context.mode: explicit with:
type: script agents whose args reference {{ workflow.input.X }}
type: workflow agents whose input_mapping references {{ workflow.input.X }}
...will fail at runtime with a TemplateError.
Workaround: Add workflow.input.X to the script agent's input: list, or switch to accumulate mode.
Environment
- Conductor v0.1.9
- Python 3.14.2
- Windows 11
Fix
PR #119
Bug Description
In
explicitcontext mode, script agentargsand sub-workflowinput_mappingtemplates that reference{{ workflow.input.X }}fail withTemplateErrorbecauseworkflow.inputis an empty dict{}, even though the inputs were correctly passed via--input.Reproduction
Expected: Script outputs
42Actual:
TemplateError: 'dict object' has no attribute 'work_item_id'Root Cause
WorkflowContext.build_for_agent()inexplicitmode initializesworkflow.inputas{}and only populates entries explicitly declared in the agent'sinput:list via_add_explicit_input(). Script agents and sub-workflowinput_mappingtemplates typically don't declare workflow inputs in theirinput:list because they are local template renders (no LLM prompt/token cost concern).The same
{{ workflow.input.X }}template works fine in:accumulatemode (default) —workflow.inputis always fully populatedlast_onlymode — samepromptfields in explicit mode — ifworkflow.input.Xis declared in the agent'sinput:listImpact
Any workflow using
context.mode: explicitwith:type: scriptagents whoseargsreference{{ workflow.input.X }}type: workflowagents whoseinput_mappingreferences{{ workflow.input.X }}...will fail at runtime with a
TemplateError.Workaround: Add
workflow.input.Xto the script agent'sinput:list, or switch toaccumulatemode.Environment
Fix
PR #119