Skip to main content

Working with AI agents

abapctl is built to be driven by an AI agent. Every command is headless, JSON-first, annotated with safety metadata, and previewable, so an agent can read freely, propose writes, and let a human approve before anything commits.

The integration contract

The contract is abapctl tools list --json. It returns the full command catalog with parameter schemas, descriptions, and safety flags (read-only / destructive / idempotent). Drop that JSON into your agent's tool registry and it can plan, route, and reason about every abapctl command.

abapctl tools list --json

A ready-made skill ships with the Clean Core kit and can be copied into your project; see Skills & Agents.

Four flags do most of the work

FlagPurpose
--jsonStable, machine-readable output on stdout (progress prose stays on stderr). Errors carry codes like SAP_AUTH_ERROR, SAP_HTTP_ERROR, and CAPABILITY_NOT_AVAILABLE.
--dry-runPreview destructive commands without writing to SAP. The agent presents the preview; the human approves; a second call without --dry-run commits.
--yesSkip the interactive confirmation prompt on destructive commands. Use after a human has approved the dry-run preview.
--session-file <path>Reuse one SAP login across many calls. Saves ~8s per command on slow-login systems. Stale sessions auto-recover.

For the stdout/stderr split and the error-code contract, see JSON and safety.

The typical agent loop

Read freely, propose a write, show the human the dry-run, then commit:

SESSION=$(mktemp)

# Read freely.
abapctl object info ZCL_FOO --json --session-file $SESSION
abapctl check atc ZCL_FOO --json --session-file $SESSION | jq '.findings[]'

# Propose a write, show the human, commit.
abapctl source put ZCL_FOO --file new.clas.abap --dry-run --json --session-file $SESSION
# ...human reviews the proposed change...
abapctl source put ZCL_FOO --file new.clas.abap --yes --session-file $SESSION

--dry-run works on source put, source push, all workspace writes, all create commands, transport release/delete, object delete/activate, service publish/unpublish, clean-core apply, and bdef create. The full catalog with safety flags is in the Command Reference.

See also