The Ondemand AI SDK represents a notable step forward for developers seeking to build scalable, event‑driven automations on the Ondemand platform. By bundling a ready‑made Temporal worker, a real‑time progress reporter, and utilities for logging, artifact storage, and human‑in‑the‑loop interactions, the kit removes much of the boilerplate that traditionally slows down workflow creation. Rather than stitching together disparate libraries, teams can now focus on the business logic that distinguishes their processes while relying on the SDK to handle infrastructure concerns such as graceful shutdown, log aggregation, and step status propagation. This approach aligns with a broader industry shift toward opinionated frameworks that reduce cognitive load and accelerate time‑to‑market for automation projects. In the following sections we will unpack each component, examine how the SDK leverages Kubernetes‑native scaling via KEDA on GKE Autopilot, and discuss practical considerations for adopting it in both greenfield and brownfield environments.
At the heart of the SDK lies the OndemandWorker class, which wraps a Temporal worker with automatic log capture and graceful shutdown handling. When the process receives a SIGTERM signal—common in container orchestration systems—the worker finishes in‑flight activities, flushes pending logs, and exits cleanly, preventing orphaned tasks or lost progress. Alongside the worker, the ActivityReporter provides a straightforward mechanism for sending step‑level updates directly to the Ondemand portal via STEP_REPORT webhooks. Each call to the reporter triggers an immediate HTTP POST, ensuring that the portal’s database is updated and the change is broadcast to connected clients through Server‑Sent Events without any batching delay. This design guarantees that stakeholders see near‑real‑time visibility into workflow execution, a feature that is especially valuable for long‑running or complex automations where manual monitoring would be impractical.
The SDK is deliberately tuned for deployments on Google Kubernetes Engine Autopilot clusters, leveraging KEDA (Kubernetes Event‑Driven Autoscaling) to adjust worker pod counts based on the depth of the Temporal task queue. As the number of pending tasks rises, KEDA provisions additional pods up to a user‑defined maximum; when the queue drains, it scales back down after a configurable cooldown period to avoid thrashing. This autoscaling model matches the serverless ethos of paying only for compute that is actively doing work, while still providing the isolation and security benefits of a managed Kubernetes service. By delegating pod lifecycle decisions to KEDA, the OndemandWorker can remain stateless and focused solely on polling its assigned task queue, registering workflows and activities, and reacting to platform signals.
Real‑time step reporting is implemented through a series of lightweight webhook calls that the ActivityReporter makes whenever a workflow step changes state. The portal treats each incoming STEP_REPORT as an immutable event, writes it to a durable store, and pushes the update to any subscribed UI components via Server‑Sent Effects. Because the reporter does not accumulate state or batch requests, latency from the moment an activity updates its status to the moment it appears in the dashboard is limited primarily to network round‑trip time. The SDK defines five canonical statuses—RUNNING, SUCCEEDED, FAILED, WARNING, and SKIPPED—each of which maps to a distinct color coding in the portal, allowing operators to quickly gauge health at a glance. Importantly, when the ONDEMAND_WEBHOOK_URL environment variable is absent, all reporter methods become no‑ops, enabling developers to run and test automations locally without hitting external endpoints.
Logging within the SDK is handled by a custom Python logger that automatically captures stdout and stderr and forwards them to both the portal’s log viewer and Cloudflare R2 for long‑term archival. Upon initialization of the OndemandWorker, the logger configures a handler that formats each line as a timestamp, module name, log level, and the original message, mirroring the familiar console output developers expect. The logger also introduces a SUCCESS level (numeric value 25) that sits between INFO and WARNING, providing a semantic middle ground for marking non‑error but noteworthy outcomes. Structured logging helpers are available for those who wish to emit JSON‑compatible fields, facilitating downstream parsing and analytics. Because the logger is attached at worker startup, there is no need for manual configuration in each module, reducing the chance of misconfiguration and ensuring consistent log capture across the entire automation.
Before the introduction of the ActivityReporter, the SDK offered a query‑based step tree reporter that stored step state inside the Temporal workflow itself and relied on the Temporal Query API for the portal to poll for updates. While functional, this approach introduced additional latency due to polling intervals and placed extra load on the Temporal service as the number of concurrent workflows grew. The documentation clearly marks the query‑based reporter as legacy, recommending that new automations adopt the webhook‑driven ActivityReporter for its immediate push‑model advantages. Teams maintaining existing workflows can continue to use the legacy reporter, but migrating to ActivityReporter is straightforward: replace calls to the query‑based API with ActivityReporter methods, remove any manual query handling, and rely on the webhook endpoint for portal updates.
Artifact management is another area where the SDK adds convenience, offering thin wrappers around boto3 for interacting with Cloudflare R2, an S3‑compatible object store. Developers can upload files generated by an activity—such as reports, images, or binary blobs—using a simple put_object‑style call, and later retrieve them in subsequent steps via a get_object helper. Since the SDK abstracts away endpoint configuration, authentication, and retry logic, teams can focus on what data to store rather than how to store it. All uploads and downloads are automatically logged, and the resulting objects inherit the same retention and access policies set at the bucket level, ensuring compliance with organizational data governance standards. This seamless integration with R2 enables patterns like caching intermediate results, sharing large payloads between steps, or persisting final outputs for downstream consumption.
Human‑in‑the‑loop (HITL) interactions are a common requirement in approval‑driven processes, and the SDK provides a dedicated helper to pause a workflow until a manual decision is rendered. By invoking the HITL function within an activity or workflow, the execution engine creates a waiting state that persists until an external signal—typically a webhook callback from the Ondemand portal—resumes it. During the pause, the workflow retains its state in Temporal’s durable execution model, allowing recovery from infrastructure failures without losing progress. The SDK also supplies utilities for passing data between the paused step and the approving user, such as rendering a form, collecting responses, and injecting the results back into the workflow. This pattern reduces the need for custom polling loops or external schedulers, providing a reliable, observable way to incorporate human judgment into otherwise automated pipelines.
Configuration for the SDK is driven primarily by environment variables that the platform injects at runtime, including ONDEMAND_RUN_ID and ONDEMAND_WEBHOOK_URL, which are set automatically by the activity interceptor and should never be hard‑coded. For local development, developers can mirror these values in a .env file or export them manually, enabling the SDK to function in a offline mode where webhook calls become no‑ops and logging defaults to the console. This design eliminates a frequent pain point: forgetting to unset hard‑coded production URLs when running tests on a laptop. Additionally, the SDK expects a PyPI API token for publishing internal packages, which can be stored in ~/.pypirc or supplied via the TWINE_PASSWORD environment variable, aligning with standard Python packaging practices.
Licensed under the Apache 2.0 license, the Ondemand AI SDK benefits from the permissive terms that allow both proprietary and open‑source projects to incorporate it without concern for viral copyleft effects. The library targets Python 3.9 and later, ensuring compatibility with recent language features such as union types and enhanced dictionary merge operators while remaining accessible to organizations that have not yet migrated to the newest interpreter releases. Maintenance is carried out by the Python Software Foundation and the broader Python community, signaling a commitment to long‑term stability and responsiveness to user feedback. The project’s presence on PyPI simplifies installation via pip, and its dependency list is intentionally lightweight, relying on battle‑tested packages like temporalio, boto3, and kubernetes‑client where needed.
From a market perspective, the release of the Ondemand AI SDK reflects a growing demand for opinionated automation frameworks that abstract away the intricacies of distributed systems while preserving flexibility. Enterprises are increasingly adopting event‑driven architectures powered by technologies like Temporal, Kafka, and cloud‑native orchestration platforms to replace brittle cron‑based scripts and monolithic batch jobs. The combination of Temporal’s durable execution guarantees with KEDA‑based autoscaling addresses two critical concerns: reliability under failure conditions and cost‑efficiency under variable load. By offering a turnkey solution that integrates logging, artifact storage, and human‑in‑the‑loop capabilities, Ondemand positions itself to capture teams that want to accelerate digital transformation without investing heavily in bespoke infrastructure engineering.
For engineering leaders evaluating whether to adopt the Ondemand AI SDK, the first step is to run the minimal example provided in the documentation—a single workflow with one activity—to verify that the local development loop behaves as expected. Next, map your existing automation candidates to the SDK’s concepts: identify which steps can be expressed as Temporal activities, where human approvals are needed, and what artifacts must be persisted. Consider setting up a pilot on a GKE Autopilot cluster with KEDA enabled, monitor pod scaling metrics, and observe the real‑time step updates in the Ondemand portal. Finally, establish a checklist for production readiness: validate log retention policies, configure R2 bucket lifecycle rules, test HITL webhooks end‑to‑end, and ensure that your CI/CD pipeline can publish new versions of the automation code via PyPI. By following these steps, teams can harness the SDK’s strengths while mitigating risks associated with adopting a new automation foundation.