Runtime Reference
Tasks running on Airplane have access to special environment variables / APIs.
The Airplane SDKs serve as idiomatic wrappers around the underlying Airplane Runtime API. For languages without an official SDK, you can instead create your own unofficial SDK by implementing the Runtime SDK.
Even if you're using an SDK, you may find access to the environment variables useful.

Environment Variables

When a run is executing, Airplane will set the following environment variables:
AIRPLANE_SCHEDULE_ID - the ID (if any) of the schedule that triggered the run.
AIRPLANE_TASK_ID - the ID of the task the run belongs to.
AIRPLANE_RUNNER_ID - the ID of the user who executed the run. If this run was requested, it is the user who executed the run, not the requester.
AIRPLANE_RUNNER_EMAIL - the email of the user who executed the run.
AIRPLANE_RUN_ID - the ID of the run.

Outputs

Airplane outputs are produced by writing to stdout using the airplane_output prefix. For example:
1
airplane_output "Hello World!"
Copied!
See the outputs documentation for further details:

Task Execution

Airplane tasks can themselves trigger other Airplane tasks. This allows users to compose together their tasks into interesting ways. To do this, the Runtime API exposes an endpoint for triggering runs by task ID.
The API host (e.g. https://api.airplane.dev) is available as an environment variable AP_TASK_RUNTIME_API_HOST. Use the environment variable rather than hardcoding the API host.
To start a task, use the following endpoint:
post
${AP_TASK_RUNTIME_API_HOST}
/v0/runs/create
Run Task
Once a run has been started, you can then poll the status of the run until it has completed, when you will then receive its output:
get
${AP_TASK_RUNTIME_API_HOST}
/v0/runs/getOutputs
Fetch Run Output
Last modified 4mo ago