# Overview The terminal client is a runtime to execute simple inference queries or more complex pipelines involving language models. Principles: - **Declarative**: the features to execute are declared in an easy to edit human readable format - **Composable**: compose agents, actions, workflows and custom commands ## Features Different types of features can be declared: agents, actions, workflows and commands. ### Agents An agent is a language model definition with a prompt, template, sampling parameters and model preset. The format to declare an agent is YAML. Quick example: ```yaml name: explain description: Explain code prompt: |- I have this code: ''' {prompt} ''' Explain what the code does in details template: system: You are an AI programmer assistant model: qwen35b inferParams: top_k: 20 top_p: 0.95 min_p: 0 temperature: 0.6 ``` For a detailed reference of the format see the Agents section. ## Actions An action is a system command or custom code run. It is used to retrieve or process data. An action can be: - A system command - A Javascript script - A Python script A system command is declared in YAML. Example: ```yaml cmd: git args: - diff ``` A Javascript action: ```js import { execute } from "@agent-smith/core"; async function action(args) { const diff = await execute("git", ["diff", ...args]); if (options?.verbose || options?.debug) { console.log("Executing", "git diff", args.join(" ")); } let msg = diff; const stagedDiff = await execute("git", ["diff", "--staged", ...args]); if (options?.verbose || options?.debug) { console.log("Executing", "git diff --staged", args.join(" ")); } if (stagedDiff.length > 0) { msg += "\n" + stagedDiff; } if (options?.debug) { console.log(msg); } const res = { prompt: msg }; return res; } export { action }; ``` A Python action is just a Python script: ```python print("result data") ``` Note: actions are not listed as independent commands. They are used in workflows and custom commands. ## Workflows A workflow is a suite of actions, agents, or commands. It is declared in YAML: ```yaml title: "Generate a git commit message from a git diff" steps: - action: git_diff - agent: commit_msg ``` The result of the action is automatically passed as a parameter for the next step: here the git diff message is passed to the language model agent. ## Commands Custom commands are scripts used to run multiple steps pipelines with user interactivity. Run the `lm` command to launch the client, and then run commands. Example to list the available agents: ```bash lm > agents ``` Example of the same command as a single terminal command: ```bash lm agents ``` See the Commands section Next: Config