API Exposure Guide

Executing Actions

Triggering execution steps via REST endpoints dynamically generated from your module.

Executing Generated Actions (REST API)

Actions are pre-configured execution steps tied to a resource (e.g., “Deploy via SSH”, “Apply Terraform”).

  • GET /api/actions: Lists all available actions.
  • POST /api/actions/:module_id/:action_name: Queues the action for execution by connected Runners (Agent or Daemon). Passing required arguments via JSON payload will package the context and assign it to an available runner with matching capabilities.
  • POST /api/actions/:module_id/:action_name?download=true: Triggers the compilation of an action but bypasses the agent queue. Instead, it directly downloads a .tar.gz archive containing the executed context, rendered configurations, and a manifest.json for manual execution by a local runner.
  • GET /api/action-queue: Lists all queued actions and their current state (Pending, Running, Completed, Failed, etc.).
  • POST /api/action-queue/:execution_id/cancel: Cancels a queued action while it is still Pending.
  • GET /api/action-queue/:execution_id/logs: Returns persisted log lines as JSON, useful for loading history before streaming.
  • GET /api/action-queue/:execution_id/logs/stream: Streams live execution logs via Server-Sent Events (SSE). Emits JSON log lines and a final done event.

Async Execution Callbacks

Actions declared with an execution [runtime] can define async callbacks. This is useful for writing execution results back to the graph automatically when the runtime finishes, avoiding the need for continuous polling.

[runtime]
engine = "api"
result_callback = "{{ rescile_endpoints.controller }}/api/actions/result/{{ execution_id }}"

[[runtime.on_complete]]
target_asset = "certificate"
action = "change"
lookup_by = "{{ input.domain }}"
record = {
  status = "active",
  pem = "{{ step.finalize.certificate }}"
}