Skip to content

Hooks and environment variables ​

Supply each hook as script text with a shebang in configuration.hooks. The working directory is the session workspace. Choose an interpreter installed in the template.

VariableAvailabilityPurpose
ORPHEUS_SESSION_IDAll executed hooksSession UUID
ORPHEUS_WORKSPACE_PATHAll executed hooksAbsolute workspace path
ORPHEUS_HOOK_OPERATION_IDAll executed hooksStable hook operation ID
ORPHEUS_RUN_IDbefore_run, after_runRun UUID
ORPHEUS_INPUT_FINGERPRINTbefore_run, after_run, when suppliedInput snapshot version
ORPHEUS_AGENT_STATUSafter_run, when knowncompleted, failed, cancelled
ORPHEUS_STOP_REASONafter_run, when knownStop reason

Run variables do not become agent environment variables. Pass necessary non-secret context through a prepared file or task text.

When names overlap, top-level run env, env_from and services override session values for before_run and after_run. They do not affect after_create or the agent process.

after_create runs after environment creation, before_run before an assignment and after_run after confirmed agent completion. before_remove is not executed.

A nonzero exit code or timeout is recorded as a hook error. The retained stdout/stderr limit does not stop the script. Give network calls a shorter timeout than the overall hook deadline.

Practical guide · Publish a reply