Skip to content

Scripts

igardev edited this page Aug 7, 2026 · 2 revisions

Scripts

Overview

Llama-vscode supports scripts. Scripts are actions within llama-vscode and could automate some tasks. For example select models, agents, change settings, etc... The scripts are in a simple language (DSL), which supports execution of llama-vscode commands, variables and if/else statements. However, the language is very simple and doesn't support the feature of the modern programming languages. It is just for automating llama-vscode tasks. They are similar to macroses in Excel (or Office applications).

Example script:

set maxParallelCompl getSetting max_parallel_completions
if $maxParallelCompl > 3
  setSetting max_parallel_completions 3
endif

if $maxParallelCompl < 1
  setSetting max_parallel_completions 1
endif

return The parallel completions are set in correct range

Variables: Use set to set value (no need to define variables). value just a string, number or could be a llama-vscode command (as in the above script). Use $varName to get the value (note the $ prefix). Variables have no types for now. They are represented internally as strings. However, in the if statement, if the values of the both operands are numbers, the comparison is done as a comparison of numbers.

llama-vscode commands: Some examples are getSetting <setting_name>, setSetting <setting_name> setToolsModel <model_name>, setCompletionModel <model_name>, setEnv <env_name>, deselectToolsModel, deselectCompletionModel, runTerminalCommand , etc.

if else endif: As is visible from the example above, there are no brackets, but endif is required. The if condition supports comparison operators (>, <, ==, !=, >=, <=), but just one (and, or, not are not supported).

Comments: The lines starting with // are comments and are ignored during execution.

How to use it

For example the scripts could be used in agent commands. If the field "is script" of the agent command is true, the content of the prompt field of the agent command is interpreted as a script and is executed. If the prompt contains a path to a file, the content of the file is executed.

Settings:

  • scripts_folder: The folder where the script files are searched by default. All script files with suffix .lvs are considered agent script commands and are shown on entering "/" in the agent prompt field. Those commands do not send prompt to the agent.

Clone this wiki locally