Skip to content

CLI for coding agents ​

The agent CLI, sap-ui-automation, gives coding agents that can run shell commands (Claude Code, Codex, Cursor) the same tools as shell commands: the agent runs sap-ui-automation look, reads a short answer, and opens the screen file only when it needs it. This keeps screens out of the conversation until they matter, and works in agents that have no MCP support.

Set up ​

sh
npm install -g sap-ui-automation             # puts sap-ui-automation on the PATH
sap-ui-automation install --skills --target all        # in your project: the skills for Claude Code, Codex and Cursor
sap-ui-automation sessions                             # what it finds now

npx -y sap-ui-automation setup installs the skills for your user instead, in every coding agent it finds (setup). Then open SAP (for Web GUI and Fiori: log on in the Chrome window it opens, see Chrome) and ask your agent to work in it with sap-ui-automation. Without a global install, every command also runs as npx -y sap-ui-automation <command>.

Commands ​

With no arguments, sap-ui-automation serves MCP over stdio.

CommandDoesSame as
sap-ui-automation sessionslists the SAP sessions open nowsap_sessions
sap-ui-automation new-session VA03 --session <source-id>opens a second SAP GUI or Web GUI session and returns both IDs for use with --sessionsap_act with newSession
sap-ui-automation use <ref>makes a session the active onesap_use
sap-ui-automation look [--full] [--diff] [--id <id> [--rows 0-50] [--cols A,B]] [--print]writes the screen to a file and prints a few short lines (where the screen is, the status bar) and the file's path (--print prints the screen)sap_look
sap-ui-automation act '<json>' [--full]runs one action (actions)sap_act
sap-ui-automation act '[<json>, ...]' [--full]runs one screen's actions in one callsap_act with actions
sap-ui-automation act set <id> <value>, press <id>, key <n>, okcode <cmd>, select <id>, check <id> [true|false], combo <id> [key], f4 <id>, dblclick <id>, scroll <id> <to>, open <intent>shorthand for one actionsap_act
sap-ui-automation okcode <cmd>same as act okcode <cmd>: it submits, no Enter after itsap_act
sap-ui-automation open <intent>same as act open <intent>: a Fiori app, e.g. '#SalesOrder-manage'sap_act
sap-ui-automation screenshotwrites a PNG of the window or tabsap_screenshot
sap-ui-automation record <op> ['<json>']start <name>, assert '{"check":"status","contains":"saved"}', stop, list, ...sap_record
sap-ui-automation daemon status|stopthe background process that keeps the session attached between commands

act, okcode and open print the whole answer, as sap_act gives it (the notes, then the lines that changed or the new screen); look prints a short summary. Each also prints the path of a file that holds the whole answer. look, act, okcode, open, new-session, screenshot and record take --session <ref>. Exit codes: 0 done, 1 error or refused, 2 usage.

VariableDefaultMeaning
SAP_CLI_DIR.sap-gui/screenswhere answers and screens are written
SAP_CLI_IDLE30minutes without a command before the daemon exits
SAP_CLI_SESSIONone daemon per directorya name: one daemon for every directory that sets it

Several actions in one call ​

A JSON list in place of one action sends the list as actions: up to 20 actions, run in order, with one answer.

sh
sap-ui-automation act '[{"do":"set","id":"ctxtVBAK-VKORG","value":"1000"},{"do":"set","id":"ctxtVBAK-VTWEG","value":"10"},{"do":"key","key":0}]'

Quote the list as one argument. Each entry is an action, and may add expect, show and unseen (Several actions in one call). The printed summary starts with the Ran k of n actions. line, which says why the batch stopped when it did. The exit codes are the same: a batch that stops at a popup or a status message exits 0, one where an action failed or was refused exits 1.

The daemon keeps the SAP_* settings it started with. A later command with different settings is refused: run sap-ui-automation daemon stop first.

The same settings apply as for the MCP server: writes run unless SAP_WRITE=off (configuration). The CLI asks nothing itself: your approval of each command is the only question before a write. The settings are yours: the bundled skill tells the agent never to set SAP_* itself, but an agent with a shell could put SAP_WRITE=on in front of a command, and only your command approval stops that (Security).

Teaching the agent ​

sap-ui-automation install --skills copies the bundled skills, among them sap-ui-automation and a sap-ui-automation-cli skill on driving SAP through these commands, into the agent's folder: .claude/skills (Claude), .agents/skills (Codex) or .cursor/rules/<name>.mdc (Cursor), chosen with --target claude|codex|cursor|all (default claude); --global uses ~/.claude/skills and ~/.agents/skills instead. setup installs them for the user as well. sap-ui-automation init does this as part of setting a project up. The skill tells the agent how SAP screens behave: fields take effect on Enter, popups come first, value help instead of guessed codes, and never work around the write setting.

MCP or CLI? ​

Use MCP when the client supports it: the answers arrive as tool results and the client can ask you before each sap_act. Use the CLI when the agent has only a shell, or when you want the agent to write SDK scripts and tests from what it did (while a recording is on, every action also prints its SDK line, see Writing tests).

MIT licence. Independent open-source project, not affiliated with, endorsed by or sponsored by SAP SE. SAP and SAP Cloud ALM are trademarks of SAP SE.