KRYONOS
Math, Security & Services

KryonOS Cloud & AI Engine

Cloud pairing, fleet telemetry synchronization, and on-device AI assistant integration API in KryonOS.

KryonOS Cloud & AI Engine

The Kryon.ai (or System.ai) and Kryon.cloud modules connect microcontroller applications with the KryonOS Cloud infrastructure, enabling fleet management, telemetry synchronization, and natural language AI assistant integrations.

Cloud platform integrations are documented in the KryonOS GitHub Repository.


1. Cloud Telemetry & Pairing

Kryon.cloud.sync(payload)

Synchronizes device status, sensor metrics, and battery state with the paired cloud account.

  • Parameters: payload (Object): Key-value dictionary of metrics.
  • Returns: Boolean (true if enqueued/sent).

Kryon.cloud.getDeviceToken()

Returns the provisioned authentication token used for cloud communication.

  • Parameters: None
  • Returns: String (or null if unprovisioned).

2. On-Device AI Queries

Kryon.ai.query(prompt, options)

Dispatches a prompt to the AI backend and returns a structured response.

  • Parameters:
    • prompt (String): User input query.
    • options (Object, optional): Configuration parameters (temperature, maxTokens, systemPrompt).
  • Returns: Object { text: String, tokens: Integer, model: String }

Kryon.ai.stream(prompt, onChunk, onDone)

Streams token responses in real time, ideal for updating on-screen UI text letter-by-letter.

  • Parameters:
    • prompt (String)
    • onChunk (Function): Callback function(tokenString).
    • onDone (Function): Callback function(fullText).
  • Returns: undefined

Code Example: Interactive AI Assistant Terminal

// Check cloud connectivity
if (!Network.isWiFiConnected()) {
  System.print("Wi-Fi connection required for Cloud AI");
} else {
  System.print("Querying KryonOS AI assistant...");
  
  Kryon.ai.stream(
    "Summarize current temperature and battery status",
    function(token) {
      // Print tokens to the serial console and TFT screen in real-time
      System.print(token);
    },
    function(fullResponse) {
      System.print("\n--- Generation Completed ---");
      System.notify("AI Completed", "Response generated successfully", 3000, "sparkles", true);
    }
  );
}

On this page