Skip to content

[Nice to have] expandFields: to apply variable substitution to agent step fields beyond prompt #34

Description

@tbrandenburg

Problem

expandPrompt: true substitutes $VAR tokens from vars steps into the prompt text at runtime. The same substitution is not available for other agent step fields: model, agent, and command.

This means a workflow param for model selection (equivalent to --model in the shell scripts) cannot be threaded into the model: field — it must be hardcoded. Users who want to run the same workflow with different models must either edit the YAML or maintain separate workflow copies.

Proposed feature

Extend the existing expandPrompt mechanism to cover other string fields on agent steps, either via a broader flag or field-by-field:

Option A — single flag covering all expandable fields:

- type: agent
  expandFields: true   # expands model:, agent:, command:, prompt:
  model: $MODEL
  prompt: |
    ...

Option B — explicit per-field opt-in (mirrors expandPrompt pattern):

- type: agent
  expandPrompt: true
  expandModel: true
  model: $MODEL
  prompt: |
    ...

Option A is simpler and consistent with how expandPrompt already works.

Generated bash

Without the feature, model is hardcoded:

opencode run --model 'gpt-4o' "$_prompt"

With expandFields: true and MODEL set via param or vars:

opencode run --model "$MODEL" "$_prompt"

Why nice to have

The workaround — hardcode the model in the YAML — is intentional and explicit. It is only inconvenient when the same workflow needs to be run repeatedly with different models without editing the file each time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions