agentleFS
williamcorrea23williamcorrea23/sap-router-skill/.agents/skills/automation-pilot-executor-httprequest/SKILL.md

automation-pilot-executor-httprequest

Skill1 starsChanged 4 months agoMITView on GitHub

Master the HTTP executor for Automation Pilot commands. Covers HTTP executor parameters, expression sanitization, timeout/retry configuration, response transformers, and HTTP-specific error handling. Use when building commands that make HTTP/REST API calls.

The file

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 1 is distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    CRITICAL: Only use expression functions that exist in the codebase.

    line 33
  2. Very specific:

    Only use functions listed in ../automation-pilot-command-generation/references/expressions.md or the official SAP documentation.

    line 42
  3. Very specific:

    ⚠️ CRITICAL: Use "logic" NOT "delayType".

    line 162
  4. Very specific:

    Error body access: Use toObject.error.message for single-error APIs, toObject.errors[0].detail for array-style APIs (e.g.

    line 274

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

HTTP Executor Guide

The HTTP executor (http-sapcp:HttpRequest:1) is the most commonly used executor in Automation Pilot. This guide covers everything you need to build robust HTTP-based commands.

Parameters Reference

ParameterTypeRequiredDefaultNotes
urlstring✅-Use toUrlEncoded for dynamic parts
methodstring✅-GET, POST, PUT, PATCH, DELETE
headersobject❌-JSON object: {"Content-Type": "application/json"}
bodystring❌-Use toEscapedJson for dynamic JSON values
timeoutnumber❌5Seconds (1-90, recommend ≤10)
responseBodyTransformerstring❌-toObject, toString, toNumber, .nested.path
userstring❌-Basic auth username OR OAuth client ID
passwordstring❌-Basic auth password OR OAuth client secret
tokenUrlstring❌-OAuth token endpoint
clientIdstring❌-OAuth client ID for client credentials flow
clientSecretstring❌-OAuth client secret for client credentials flow
clientCertstring❌-X509 certificate + key (PEM) for mTLS/cert-based OAuth; use with certurl-based tokenUrl
refreshTokenstring❌-OAuth refresh token; when provided, user/password are ignored
successResponseCodesstring❌-JSON array of HTTP status codes treated as success, e.g. "[\"503\"]". Overrides default success check.

⚠️ Valid Expression Functions

CRITICAL: Only use expression functions that exist in the codebase. Common functions:

  • URL/JSON Sanitization: toUrlEncoded, toEscapedJson (MANDATORY for dynamic values)
  • Response Parsing: toObject, toNumber, toString
  • Header Access: getCaseInsensitive (MANDATORY for headers - case-insensitive)
  • Validation: length, contains, isGuid, valueIn
  • Array/Object: filter, map, select, any, all, keys, values

Do not invent functions like type, isBool, isString - they don't exist in Automation Pilot.

Only use functions listed in ../automation-pilot-command-generation/references/expressions.md or the official SAP documentation.


Expression Sanitization (CRITICAL)

URL Parameters - Always Use toUrlEncoded

"url": "$(.execution.input.serviceKey.endpoints.service_url)/v1/resources/$(.execution.input.resourceId | toUrlEncoded)"

Dynamic URL path/query parts must be wrapped in toUrlEncoded. Without it, special characters break the URL.

Patterns:

"url": "https://example.com/v1/items/$(.execution.input.name | toUrlEncoded)"
"url": "https://example.com/v1/search?q=$(.execution.input.query | toUrlEncoded)"
"url": "https://example.com/v1/items?name=$(.execution.input.name | toUrlEncoded)&type=$(.execution.input.type | toUrlEncoded)"

JSON Body Values - Always Use toEscapedJson

String values embedded in a JSON body must use toEscapedJson. Numbers and booleans: no escaping, no quotes.

"body": "{\"name\": \"$(.execution.input.name | toEscapedJson)\", \"count\": $(.execution.input.count), \"enabled\": $(.execution.input.enabled)}"

Response Headers - Use getCaseInsensitive

HTTP headers in the response must be accessed with getCaseInsensitive — header names are case-insensitive.

"expression": "$(.apiCall.output.headers | getCaseInsensitive(\"content-type\"))"
"expression": "$(.apiCall.output.headers | getCaseInsensitive(\"location\"))"
"expression": "$(.apiCall.output.headers | getCaseInsensitive(\"x-api-version\") | length)"

Response Transformers

TransformerExampleResult
toObject{"name":"test"} → {name: "test"}Parse JSON
toObject.data.id{"data":{"id":"123"}} → "123"Extract nested
toObject.resources[0].guid{"resources":[{"guid":"abc"}]} → "abc"Extract from array
toString123 → "123"Convert to string
toNumber"123" → 123Convert to number
(none)Raw responseNo transformation

Timeout Configuration

Default Rules

Recommended: ≤ 10 seconds Default: 5 seconds (if not specified)

{
  "timeout": "5"
}

Note: value is a STRING (seconds), not a number and not milliseconds.

When to Adjust Timeout

ScenarioRecommended Timeout
Simple GET3-5s
POST/PUT10s
Long-running async trigger5-10s
File upload / heavy processing60-90s

Maximum allowed: 90 seconds. For operations that take longer, use repeat polling instead.


Retry Logic (autoRetry)

📘 UNIVERSAL PROPERTY: autoRetry works with ALL executor types (HTTP, Script, ForEach, etc.), not just HTTP requests. The examples below use HTTP, but the same configuration applies to any executor.

Retry Configuration Structure

"autoRetry": {
  "maxCount": 3,
  "delay": "5s",
  "logic": "INCREMENTAL",
  "applyOnValidation": false,
  "when": {
    "semantic": "OR",
    "conditions": [{
      "semantic": "OR",
      "cases": [{
        "expression": "$([408, 429, 500, 502, 503, 504, -1] | filter(. == $.aliasName.output.status) | length)",
        "operator": "EQUALS",
        "semantic": "OR",
        "values": ["1"]
      }]
    }]
  }
}

Fields:

  • maxCount: Maximum retry attempts (number)
  • delay: Wait between retries (string with unit, e.g., "5s")
  • logic: INCREMENTAL | FIXED (only these two exist)
  • applyOnValidation: If true, also retries when validate fails. Default: false
  • when: Condition for when to retry (typically checks status codes)

⚠️ CRITICAL: Use "logic" NOT "delayType". Use "when" block with filter expression, NOT "statusCodes" array.

Unconditional Retry

Set "when": null to retry on any failure, regardless of status code:

"autoRetry": {
  "maxCount": 3,
  "delay": "5s",
  "logic": "FIXED",
  "applyOnValidation": false,
  "when": null
}

Delay Types

TypeBehaviorExample (5s base, 3 retries)Best For
INCREMENTALAdds delay each time5s, 10s, 15sGeneral use, backoff
FIXEDSame delay each time5s, 5s, 5sRate limiting, polling

Status Codes for autoRetry

MethodRetry on
GET, DELETE, HEAD408, 429, 500, 502, 503, 504, -1
POST, PUT, PATCH429, 502, 503, 504

-1 = network error / no response.


Authentication

User/Password with OAuth:

{
  "url": "$(.regionData.cfApiUrl)/v3/spaces",
  "method": "GET",
  "user": "$(.execution.input.user)",
  "password": "$(.execution.input.password)",
  "tokenUrl": "$(.regionData.uaaTokenUrl)"
}

Service Key (client credentials):

{
  "url": "$(.execution.input.serviceKey.endpoints.service_url)/v1/resources",
  "method": "GET",
  "clientId": "$(.execution.input.serviceKey.uaa.clientid)",
  "clientSecret": "$(.execution.input.serviceKey.uaa.clientsecret)",
  "tokenUrl": "$(.execution.input.serviceKey.uaa.url)/oauth/token"
}

Service Key with mTLS (clientCert):

{
  "url": "$(.execution.input.serviceKey.endpoints.service_url)/v1/resources",
  "method": "GET",
  "clientCert": "$(.execution.input.serviceKey.uaa.certificate + .execution.input.serviceKey.uaa.key)",
  "clientId": "$(.execution.input.serviceKey.uaa.clientid)",
  "clientSecret": "$(.execution.input.serviceKey.uaa.clientsecret)",
  "tokenUrl": "$((if (.execution.input.serviceKey.uaa.certificate == null) and (.execution.input.serviceKey.uaa.key == null) then .execution.input.serviceKey.uaa.url else .execution.input.serviceKey.uaa.certurl end) + \"/oauth/token\")"
}

Refresh token:

{
  "user": "$(.execution.input.user)",
  "password": "$(.execution.input.password)",
  "refreshToken": "$(.execution.input.refreshToken)",
  "tokenUrl": "$(.regionData.uaaTokenUrl)"
}

Error Handling

📘 UNIVERSAL PROPERTY: errorMessages works with ALL executor types, not just HTTP.

Error Message Structure

"errorMessages": [
  {
    "message": "Resource '$(.execution.input.resourceName)' does not exist",
    "when": {
      "semantic": "OR",
      "conditions": [
        {
          "semantic": "OR",
          "cases": [
            {
              "expression": "$(.aliasName.output.status)",
              "operator": "EQUALS",
              "semantic": "OR",
              "values": ["404"]
            }
          ]
        }
      ]
    }
  }
]

Error body access: Use toObject.error.message for single-error APIs, toObject.errors[0].detail for array-style APIs (e.g. CF API v3). Always check the actual response shape.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.