@cpod/sdk - v0.2.7
    Preparing search index...

    Function createAppRuntime

    • Create an isolated runtime for a specific app

      Each app runtime provides isolated access to:

      • config - Environment variables, secrets, and app settings
      • analytics - Custom metrics and usage tracking
      • prompts - Prompt templates registration and execution
      • notifications - Send notifications to users
      • tasks - Trigger and schedule background tasks

      Parameters

      • appId: string

        Unique identifier for the app

      Returns AppRuntime

      AppRuntime instance

      import { createAppRuntime } from "@cpod/sdk";

      const weatherApp = createAppRuntime("weather-app");

      // Store API key securely
      await weatherApp.config.setSecret("OPENWEATHER_API_KEY", "xxx");

      // Track custom metric
      await weatherApp.analytics.recordMetric({
      name: "forecast_request",
      value: 1,
      dimensions: { city: "SF" }
      });

      // Send notification
      await weatherApp.notifications.send({
      type: "weather-alert",
      title: "Severe Weather",
      message: "Heavy rain expected",
      priority: "high"
      });