Skip to main content

Use Variables in the Quick Commands

You can use Jinja in StackSpot AI. You can interpolate variables and apply conditional logic in automation flows using Quick Commands (QCs).

Jinja variable interpolation flow

Jinja expressions are interpolated before the execution of each Quick Command step.

See the available variables below:

1. Variables available in Quick Commands (QC)

1.1. Default input variable:

This is equivalent to selected_code in the IDE:


{{input_data}}

1.2. Variables by step type:

  • Step of type LLM prompt. The response generated by the model:

{{step_name.answer}}

  • The Knowledge Sources used in the response:

{{step_name.sources}}

  • Steps of type Web Request:

The dictionary with the response headers:


{{step_name.headers}}

Example:


{{step_name.headers['Content-Type']}}

  • The HTTP status of the request response:

{{step_name.status}}

  • The body of the response as a plain text string:

{{step_name.data}}

  • The body of the response as a dictionary, if the response is JSON:

{{step_name.json.variable_name}}

  • {{<STEP_NAME>.answer_status.success}} = true or false: Indicates whether a Prompt step was successful or failed.
  • {{<STEP_NAME>.answer_status.failure_message}}: The error message, available only when the step fails.
  • {{<STEP_NAME>.answer_status.input_tokens}}: The number of input tokens.
  • {{<STEP_NAME>.answer_status.output_tokens}}: The number of output tokens generated by the model. S

Global variables in Quick Commands

There are some global variables available, as shown below:

  • {{stk_ai.account_slug}}: The Quick Command’s account slug.
  • {{stk_ai.command}}:
  • {{stk_ai.step_name}}: The current step name.
  • {{stk_ai.user_mail}}: The email of the user executing the command.
  • {{stk_ai.user_name}}: The name of the user.
  • {{stk_ai.conversation_id}}: The conversation ID in the LLM.
  • {{stk_ai.execution_id}}: The identifier of the RQC execution (not available for IDE Quick Commands).