Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/MotiaDev/motia/llms.txt

Use this file to discover all available pages before exploring further.

The III SDK provides a unified interface for building distributed applications with function registration, invocation, and trigger management. It enables seamless communication between services through a WebSocket-based engine.

Supported Languages

The III SDK is available in three languages:

Node.js

TypeScript/JavaScript SDK with full async support and OpenTelemetry integration

Python

Async Python SDK with function registration and trigger management

Rust

High-performance async Rust SDK with automatic reconnection

Core Concepts

Functions

Functions are the basic unit of work in the III Engine. You register functions that can be invoked by other services or triggered by events.

Triggers

Triggers are event sources that invoke functions. Common trigger types include:
  • HTTP - API endpoints that invoke functions
  • Events - Event-driven function invocation
  • Schedules - Time-based function execution
  • Custom - Define your own trigger types

Invocations

Invocations are how you call functions:
  • Synchronous - Wait for the function result
  • Asynchronous - Fire-and-forget (no result returned)

Architecture

The III SDK communicates with the III Engine via WebSocket connections. The engine acts as a central orchestrator for:
  • Function Registry - Keeps track of all registered functions
  • Function Routing - Routes invocations to the appropriate worker
  • Trigger Management - Manages trigger registration and execution
  • Inter-service Communication - Enables workers to call each other’s functions
  • Telemetry & Observability - Collects traces, metrics, and logs

Key Features

Function Registration

Register callable functions that can be invoked by other services or triggers:
iii.registerFunction({ id: 'myFunction' }, (req) => {
  return { status_code: 200, body: { message: 'Hello, world!' } }
})

Function Invocation

Call functions synchronously or asynchronously:
// Synchronous
const result = await iii.call('myFunction', { param: 'value' })

// Asynchronous (fire-and-forget)
iii.callVoid('myFunction', { param: 'value' })

Trigger Management

Create triggers to automatically invoke functions:
iii.registerTrigger({
  type: 'http',
  function_id: 'myFunction',
  config: { api_path: '/hello', http_method: 'POST' },
})

Context-Aware Logging

Built-in logging with execution context:
import { getContext } from 'iii-sdk'

iii.registerFunction({ id: 'myFunction' }, (req) => {
  const { logger } = getContext()
  logger.info('Processing request', { data: req })
  return { status_code: 200 }
})

OpenTelemetry Integration

Full observability with traces, metrics, and logs (Node.js and Rust):
  • Automatic trace context propagation
  • Distributed tracing across function calls
  • Metrics collection and reporting
  • Structured logging with correlation IDs

Automatic Reconnection

Resilient WebSocket connections with automatic reconnection:
  • Exponential backoff with jitter
  • Configurable retry limits and delays
  • Automatic re-registration of functions and triggers
  • Connection state monitoring

Installation

npm install iii-sdk

Quick Start

See the language-specific documentation for detailed usage:

Engine Functions

The III Engine provides built-in functions that you can call from any SDK:
  • engine::functions::list - List all registered functions
  • engine::workers::list - List all connected workers
  • engine::workers::register - Register worker metadata
  • engine::channels::create - Create streaming channels for data transfer

Next Steps

Node.js API

Explore the Node.js SDK API reference

Python API

Explore the Python SDK API reference

Rust API

Explore the Rust SDK API reference

Examples

Browse SDK examples and tutorials

Build docs developers (and LLMs) love