Skip to content

Getting Started Skill ​

Build embedded IoT applications using the Ioto Device Agent SDK. This skill guides you through app scaffolding, templates, integration models, and the fiber execution model.

Invoke with: /getting-started

Prerequisites ​

  • GCC or compatible C compiler
  • Make (GNU Make)
  • OpenSSL or MbedTLS for TLS support
  • TestMe (tm) for unit tests: npm install -g testme
  • Vite for building a UI: npm install -g vite

App Directory Layout ​

A user's app lives in its own directory with the Ioto agent installed as a subdirectory:

myapp/
├── src/                    # Your application source code
├── Makefile                # Your build file
├── ioto/                   # Extracted Ioto source distribution
│   ├── include/            # Ioto headers (ioto.h and dependencies)
│   ├── build/
│   │   └── bin/            # Built library and tools
│   │       └── libioto.a   # Static library (Linux/macOS)
│   └── ...
└── state/
    └── config/             # Runtime configuration files
        ├── ioto.json5      # Main Ioto configuration
        ├── device.json5    # Device identification
        └── web.json5       # Web server config (if web enabled)

Sample Apps ​

The Ioto agent source distribution includes sample apps under ioto/apps/ that provide working configuration and source code for common use cases:

AppUse CaseIncludes
blankMinimal skeletonJust ioStart()/ioStop(), no services
httpWeb server with authHTTP/HTTPS, database, REST APIs, user/admin roles
aiAI-enabled deviceOpenAI integration, streaming, agentic workflows
blinkESP32 demoMinimal example for microcontroller targeting
unitTest harnessComprehensive unit test execution framework

Creating a New App ​

  1. Create the app directory and install the Ioto agent:
bash
mkdir myapp && cd myapp
tar xf ioto-VERSION.tar.gz && mv ioto-* ioto
  1. Copy configuration from a sample app:
bash
mkdir -p src state/config
cp ioto/apps/http/*.json5 state/config/
  1. Configure services in ioto/include/config.h and rebuild with make -C ioto clean && make -C ioto.

  2. Create src/myapp.c with entry points and a Makefile.

Integration Models ​

Own Main (Full Control) ​

c
#include "ioto.h"

int main()
{
    ioStartRuntime(1);
    ioRun(NULL);
    ioStopRuntime();
    return 0;
}

int ioStart(void)
{
    rInfo("app", "Hello World");
    return 0;
}

void ioStop(void) {}

Ioto-Managed Main (Simpler) ​

c
#include "ioto.h"

PUBLIC int ioStart(void)
{
    rInfo("app", "Hello World");
    return 0;
}

PUBLIC void ioStop(void) {}

Building and Running ​

bash
make -C ioto              # Build libioto.a
cc -c -I ioto/include src/myapp.c
cc -o myapp myapp.o ioto/build/bin/libioto.a -lssl -lcrypto
./myapp

Configuring Services ​

Services are controlled at two levels:

  1. Compile-time — Edit ioto/include/config.h (SERVICES_* defines).
  2. Runtime — Edit state/config/ioto.json5 (services property).
json5
{
    services: {
        database: true,
        web: true,
        url: true,
    },
    limits: { fiberStack: '64k' },
}

Fiber Model ​

Ioto uses single-threaded cooperative fiber scheduling:

  • All code runs in fibers — never block in a tight loop
  • Use fiber-aware I/O: rSleep(), webRead(), urlFetch(), mqttPublish()
  • Configure stack size via limits.fiberStack in ioto.json5
  • Avoid large stack allocations (>4KB); use rAlloc() for heap instead