Analysis Overview

Analysis Overview

Analysis lets you run custom code inside TagoIO to process data in real time, call third‑party APIs, and work with your own TagoIO resources.

Common things people do with Analyses:
  1. Convert units and run math on variables
  2. Write new values into other devices
  3. Read across devices to correlate events
  4. Send email/SMS/webhooks or push data back to a device or dashboard
  5. Automate user workflows to create devices, read files and user tags

Analyses can be triggered by Actions (schedule or condition), by Dashboard UI elements, or by external services through API endpoints. It’s a straightforward way to plug your logic into the rest of your application.



Environments

Analyses run in TagoIO as an asynchronous, serverless service. There’s no strict queue order, and multiple executions can run at the same time. Usage counts against your profile’s Analysis Run limits.

If you prefer to host code yourself, you can run External Analyses from your own infrastructure. TagoIO provides the TagoIO CLI and Javascript SDKs for Deno/Node.js, as well as a Python SDK to help with local development, packaging, and deployment.

Runtimes

TagoIO supports three runtimes for Analysis. Each runtime has different approaches to dependency management and development workflows.

All runtimes support the same TagoIO SDK functionality for working with devices, buckets, and other platform features. The main differences are in language features and how you manage external dependencies.

Deno Runtime

Deno runs TypeScript and JavaScript with built-in TypeScript support—no compilation step needed. The standout feature is remote imports: you can import packages directly from URLs without any bundling or upload process.
  1. import { Analysis, Device } from "jsr:@tago-io/sdk";
  2. import { DateTime } from "npm:luxon";
  3. import { z } from "https://deno.land/x/zod/mod.ts";
This means you can write your entire Analysis in the TagoIO editor, add imports as you need them, and run immediately. The editor includes linting and formatting to help catch issues early.
Info
Dependencies are fetched and cached on first run, so initial executions may take a bit longer.

Node.js Runtime

Node.js runs JavaScript and requires you to bundle dependencies before uploading. Unlike Deno, you can't import npm packages directly in your Analysis code—you'll need to use the Analysis Builder CLI locally to create a bundle that includes all your dependencies.

  1. # Local development workflow
  2. npm install @tago-io/sdk axios
  3. tagoio-builder pack
  4. # Upload the generated .tago file
This approach gives you full control over your dependencies and build process, but requires local development tools. If you're already comfortable with Node.js workflows or have existing code to migrate, this runtime fits naturally.

Python Runtime

Python supports remote package installation at runtime. When your Analysis runs, it automatically installs any imported packages that aren't part of the standard library.
  1. # /// script
  2. # dependencies = [
  3. #    "tagoio-sdk",
  4. #     "pandas",
  5. #     "requests<3",
  6. # ]
  7. # ///

  8. from tagoio_sdk import Analysis, Device
  9. import pandas as pd
  10. import requests
  11. from datetime import datetime, timedelta
Just write your imports and TagoIO handles the UV installation behind the scenes. This makes Python ideal for data processing tasks where you need libraries like pandas, numpy, or scipy without the hassle of packaging them yourself.

The runtime uses standard Python package resolution, so you can import from PyPI just like you would locally. First runs will be slower while packages install, but subsequent runs use the cached environment.

Getting Started

Here’s the short path to get an Analysis running:
  1. Create an Analysis and choose your runtime
    In your Admin, go to the Analysis module, create an analysis and choose a runtime: Deno, Node.js, or Python based on your stack and dependency needs.
  2. Grant the needed permissions to your analysis.
    When you create an analysis, it doesn't have the needed permissions to access data or run services. For that reason, you need to generate a policy that gives access only to operations.and data within scopes your Analysis needs (e.g., users, devices, entities). Read more about Creating a Policy.
  3. Code your script
    Use the SDK for your runtime to read/write data, call external APIs, and log output. Keep functions idempotent when possible.
  4. Add triggers (optional)
    1. Actions: schedule (cron) or condition (e.g., variable thresholds)
    2. Dashboards: buttons, inputs, or other UI hooks
    3. External: expose an endpoint for webhooks
  5. Run and monitor
    Execute on demand to test, then let triggers handle it. Check logs, run history, and usage.



    • Related Articles

    • Running Analysis as External using Deno

      Analysis enables you to create powerful applications on TagoIO. When creating an Analysis, you can choose between running it at TagoIO or External, which means running it on your own infrastructure. Running Analysis externally with Deno provides ...
    • Creating Analysis

      Creating your own analysis is easy. First, click on Analysis on the sidebar, then click the + Add Analysis button in the upper right of the analysis main screen. Just write a name and you’re ready to go! 1. Name What you usually use to identify your ...
    • Python SDK

      You can access our SDK documentation on: https://py.sdk.tago.io/ Installation pip install tagoio-sdk Quick Start from tagoio_sdk import Account account = Account({"token": "your-token"}) devices = account.devices.list() Remote Imports in Analysis ...
    • Running Analysis as External using Node.JS

      Analysis is what allows you to create powerful applications on TagoIO. When creating analysis you have to choose between running it at TagoIO or External, which means that you will run on your machine. You can choose to run the analysis on an ...
    • Script Editor

      With the script editor, developers can create and edit their own scripts at TagoIO. These scripts will be executed as defined in the Analysis section. To use the script editor, go to Analysis, then create or edit one. Set the name, interval, and set ...