leoflow_runtime

Leoflow task runtime: the helper that runs inside every task container.

It runs the user's Python callable, captures its return value as an XCom, and exposes upstream XCom inputs. The leoflow-agent invokes python -m leoflow_runtime <module:callable> and ships the captured return value back to the control plane.

def run(entrypoint: str) -> None:

Import and call module:callable, writing a non-None return as JSON.

The agent reads the file and pushes it as the task's return_value XCom. A None return writes nothing, so downstream tasks see no XCom.

Emits three lifecycle lines so the UI's log panel is informative even when the user function is silent: loading <entrypoint>, resolved kwargs: {...} (when any), and returned <repr> (success) or no extra line on raise (the agent wraps the traceback). All three use [leoflow] prefix via _lifecycle() so they are distinguishable from user print().

def xcom_pull(name: str, default: Any = None) -> Any:

Return the upstream XCom mapped to name, or default if absent.

The agent injects each declared input as LEOFLOW_XCOM_<NAME>=<json>; the name is matched case-insensitively.