Aegis Orchestrator
Reference

Template Syntax

Handlebars template variables and helpers available in agent prompt templates and workflow Blackboard templates.

Template Syntax

AEGIS uses Handlebars for template rendering in two places:

  1. Agent prompt templatesspec.task.prompt_template in an agent manifest
  2. Workflow Blackboard templatesinput_template fields in workflow state definitions

Both use {{variable}} syntax, but the available variable namespaces differ.


Agent Prompt Templates

The spec.task.prompt_template field in an agent manifest is rendered once per iteration before the prompt is sent to the LLM.

Available Variables

VariableTypeDescription
{{instruction}}stringThe agent's spec.task.instruction field
{{input}}stringThe execution input provided by the caller
{{iteration_number}}integerCurrent iteration count (1-indexed)
{{previous_error}}stringError message from the previous iteration, if any
{{agentskills}}stringConcatenated Cortex skill content injected by the orchestrator
{{context}}stringConcatenated context attachment strings

Variables that are null or not populated render as an empty string by default (strict mode is disabled). Referencing an undefined variable does not cause an error.

Example

spec:
  task:
    instruction: "Summarise the provided email thread as bullet points."
    prompt_template: |
      {{#if instruction}}Task: {{instruction}}

      {{/if}}{{#if iteration_number}}[Iteration {{iteration_number}}]
      {{/if}}{{#if previous_error}}Previous attempt failed: {{previous_error}}
      Please try a different approach.

      {{/if}}{{#if input}}Input:
      {{input}}{{/if}}

Notes

  • HTML escaping is disabled. Backticks, quotes, <, > in {{input}} and {{instruction}} are passed verbatim to the LLM. You do not need to escape them.

  • If prompt_template is omitted, the orchestrator uses a built-in default:

    {{#if instruction}}Task: {{instruction}}
    
    {{/if}}{{#if input}}Input: {{input}}{{/if}}

Workflow Blackboard Templates (input_template)

Workflow state input_template fields let you compose an agent's input from outputs of earlier states and values stored on the Blackboard.

Available Variables

State Output Variables

Reference the output of any completed state by its name:

{{STATE_NAME.output}}

If the state produced structured JSON output, access nested fields with dot notation:

{{STATE_NAME.output.field_name}}
{{STATE_NAME.output.nested.key}}

Example:

states:
  - name: WRITE_DRAFT
    kind: Agent
    agent_id: draft-agent-uuid

  - name: REVIEW_DRAFT
    kind: Agent
    agent_id: review-agent-uuid
    input_template: |
      Review the following draft and suggest three improvements:

      {{WRITE_DRAFT.output}}

Workflow Context / Blackboard Variables

Access values stored in the Blackboard — the shared mutable context for the workflow execution — using:

{{workflow.context.KEY}}

The Blackboard is populated from the workflow's initial input object and updated by System states that write context variables.

Example:

input_template: |
  Task: {{workflow.context.task_description}}
  Target language: {{workflow.context.language}}
  Prior analysis: {{ANALYSE.output}}

Input Variables

The workflow's initial execution input is available as:

{{input.FIELD_NAME}}

Example:

# Workflow started with: { "repo_url": "https://github.com/...", "pr_number": 42 }
input_template: |
  Review pull request #{{input.pr_number}} in repo {{input.repo_url}}.
  
  Diff:
  {{FETCH_DIFF.output}}

Conditionals

Use {{#if}} to render sections only when a variable is non-empty:

{{#if previous_error}}
A previous attempt failed with: {{previous_error}}
Please take a different approach.
{{/if}}

{{#if workflow.context.additional_instructions}}
Additional instructions: {{workflow.context.additional_instructions}}
{{/if}}

Iteration Over Arrays

Use {{#each}} to iterate over array values in structured state output:

The following issues were identified:
{{#each ANALYSE.output.issues}}
- {{this.severity}}: {{this.description}} (line {{this.line}})
{{/each}}

Missing Variables

  • Undefined variables render as an empty string. Use {{#if}} guards to avoid blank lines in prompts.
  • Nested access on null — if WRITE_DRAFT.output is null and you write {{WRITE_DRAFT.output.title}}, the entire expression renders as empty rather than erroring.

Escaping

To render a literal {{ in template output, use \{{:

The variable syntax looks like \{{variable_name}}.

See Also

On this page