The Ondemand AI SDK marks a significant step forward for developers seeking to build reliable, cloud-native automations in Python. By wrapping Temporal workers with enhanced logging, graceful shutdown mechanisms, and real-time progress reporting, the SDK reduces boilerplate while increasing observability. This release arrives at a time when platform engineering teams are under pressure to deliver resilient workflows that can scale elastically with demand. The SDKโs opinionated defaults help teams avoid common pitfalls such as zombie processes or lost logs, which often plague long-running automation jobs. For organizations already invested in the Temporal ecosystem, the Ondemand SDK offers a natural extension that aligns with platform best practices without locking them into a proprietary runtime. Its open-source Apache 2.0 license further encourages community contributions and enterprise adoption.
At the heart of the SDK lie two core abstractions: OndemandWorker and ActivityReporter. OndemandWorker is a specialized Temporal worker that automatically captures standard output and error streams, forwarding them to the Ondemand portal for live viewing and long-term storage in Cloudflare R2. It also handles SIGTERM signals gracefully, ensuring that in-flight activities complete before the pod shuts downโa critical feature for Kubernetes environments where pods may be terminated during scaling events. ActivityReporter, meanwhile, provides a simple API for emitting step-level status updates directly to the portal via webhook calls. Each invocation is fire-and-forget, meaning no batching or internal queuing, which guarantees that the UI reflects the most current state of the automation.
The SDK is explicitly optimized for deployment on Google Kubernetes Engine (GKE) Autopilot, leveraging KEDA (Kubernetes Event-driven Autoscaling) to adjust worker pod counts based on the depth of Temporal task queues. This approach enables true scale-to-zero behavior, where no worker pods run when there is no work, dramatically reducing infrastructure costs for intermittent workloads. KEDAโs cooldownPeriod setting prevents premature scale-down by ensuring that pods remain alive long enough to process bursts of tasks that might otherwise trigger rapid scaling oscillations. For teams practicing GitOps, this model aligns well with declarative infrastructure, as the scaling logic is driven by observable queue metrics rather than manual thresholds.
Real-time step reporting is achieved through the STEP_REPORT webhook, which the SDK calls whenever an activity updates its status. The portal receives these calls, writes them to a database, and pushes the updates to connected clients via Server-Sent Events (SSE), creating a live dashboard that mirrors the execution flow. Supported statuses include RUNNING, SUCCEEDED, FAILED, WARNING, and SKIPPED, giving operators granular insight into workflow health. Because each report is sent immediately, there is no risk of stale UI statesโa common issue in systems that rely on periodic polling or aggregated metrics. Moreover, when the ONDEMAND_WEBHOOK_URL environment variable is absent (such as during local development), all reporting functions become no-ops, allowing developers to test workflows without configuring external endpoints.
Logging is another area where the SDK excels by removing configuration friction. Upon startup, OndemandWorker installs a custom logging handler that captures all log records and forwards them to both the console and the portal. The console format follows a clear pattern: timestamp, module name, log level, and message, making it easy to correlate logs with specific activities. In the portal, logs are color-coded by severity and stored in R2 for audit trails and post-mortem analysis. This automatic setup means that developers do not need to manually configure loggers, formatters, or handlers, reducing the chance of misconfiguration that could lead to lost diagnostic information in production.
Beyond standard logging levels, the SDK introduces a custom SUCCESS level (numeric value 25) that sits between INFO and WARNING. This level is intended for logging noteworthy but non-error events, such as the successful completion of a data validation step or the receipt of an external API response. Helper methods are provided to emit structured logs in JSON format, which can be consumed by log aggregation tools like Elasticsearch or Loki. Structured logging enhances searchability and enables the creation of dashboards that track key business metrics directly from workflow execution logs, bridging the gap between DevOps and business intelligence.
Artifact management is handled through seamless integration with Cloudflare R2, an S3-compatible object storage service. The SDK provides simple upload and download functions that internally use boto3, allowing workflows to store intermediate results, models, or reports without writing custom storage code. Because R2 is accessed via standard S3 APIs, teams retain the flexibility to migrate to other compatible storage providers if needed. Artifacts are automatically associated with the workflow run, making them easy to retrieve for debugging, retraining machine learning models, or generating compliance reports. This capability is especially valuable for data-intensive automations that produce large files as part of their output.
Human-in-the-loop (HITL) interactions are facilitated through dedicated helper functions that pause a workflow and await manual approval before proceeding. When invoked, these functions signal the workflow to wait, storing its state durably in Temporal while exposing a user interface in the Ondemand portal for reviewers to approve or reject the pending step. This pattern is essential for automations that involve regulatory compliance, financial transactions, or any scenario where human judgment is required. By leveraging Temporalโs built-in querying and update mechanisms, the SDK ensures that the pause/resume cycle is reliable, survivable across worker restarts, and fully auditable.
Data flow between workflow steps is managed through automatically handled output directories. Each activity receives a dedicated scratch space where it can write temporary files, and the SDK ensures that these directories are cleaned up appropriately after the workflow completes. Developers can also pass data between steps using Temporalโs native mechanism of returning values from activities and assigning them to workflow variables, which are then serialized in the workflow history. This approach maintains consistency with Temporalโs programming model while benefiting from the SDKโs opinionated defaults around file handling and environmental variable injection.
Runtime configuration is largely automated by the platform, with key identifiers such as ONDEMAND_RUN_ID and ONDEMAND_WEBHOOK_URL injected by the activity interceptor at execution time. This design eliminates the risk of manual misconfiguration and ensures that each workflow run is correctly linked to its portal representation and telemetry endpoints. For local development, developers can define these variables manually or rely on a .env file, allowing the SDK to operate in a degraded but functional mode where webhook calls are no-ops and logs appear only in the console. This flexibility supports inner-loop development without sacrificing production fidelity.
From a market perspective, the Ondemand AI SDK addresses a growing demand for opinionated, batteries-included frameworks that simplify the construction of reliable, observable automations. As more organizations adopt event-driven architectures and serverless containers, the need for SDKs that abstract away infrastructure complexities while preserving developer control becomes paramount. The combination of Temporalโs durability guarantees, KEDA-driven scaling, and seamless portal integration positions the Ondemand SDK as a compelling choice for teams building mission-critical workflows in sectors such as finance, healthcare, and logistics. Its permissive license and active maintenance by a dedicated team further reduce adoption barriers.
To get started with the Ondemand AI SDK, developers should first ensure they are using Python 3.9 or later and have access to a Temporal clusterโwhether self-managed or via a cloud provider. Install the package from PyPI, then scaffold a minimal workflow and activity following the examples in the documentation. Enable real-time reporting by setting the ONDEMAND_WEBHOOK_URL environment variable to the portalโs endpoint, and configure Cloudflare R2 credentials if artifact storage is required. For local testing, omit the webhook URL to activate the no-op mode, and use Temporalโs CLI to start a development server. Finally, consider implementing human-in-the-loop checkpoints for any step that involves subjective judgment, and monitor the portalโs live dashboard to identify bottlenecks or failures early in the automation lifecycle.