Worker Module Functions
Functions for managing workers, channels, and registered functions.engine::channels::create
Create a streaming channel pair for real-time communication.Channel buffer size (default: 64, max: 1024)
Writer channel reference for sending data
Reader channel reference for receiving data
engine::functions::list
List all registered functions in the engine.Include internal engine functions (engine.* prefix)
Array of function information objects
engine::workers::list
List all connected workers with metrics.Filter by specific worker ID
Array of worker information objects
Query timestamp (milliseconds)
engine::triggers::list
List all registered triggers.Include internal engine triggers
Array of trigger information objects
engine::workers::register
Register or update worker metadata.Worker ID (automatically injected)
Runtime environment (e.g., “node”, “rust”, “python”)
Worker version
Worker name
Operating system information
Telemetry metadata
Registration success status
KV Server Functions
Key-value storage functions for persistent state.kv_server::get
Get a value by key from the KV store.Index name (namespace)
Key to retrieve
The stored value, or null if not found
kv_server::set
Set a value by key in the KV store.Index name (namespace)
Key to set
Value to store (any JSON-serializable data)
The key that was set
The value that was stored
Whether this was a new key (true) or update (false)
kv_server::delete
Delete a value by key from the KV store.Index name (namespace)
Key to delete
Whether the key was deleted
The previous value, if it existed
kv_server::update
Update a value with atomic operations.Index name (namespace)
Key to update
Array of update operations
The value before the update
The value after the update
Set { path, value }- Set a field at the specified pathMerge { path, value }- Merge an object with the existing valueIncrement { path, by }- Add a numeric value to a fieldDecrement { path, by }- Subtract a numeric value from a fieldRemove { path }- Remove a field at the specified path
kv_server::list
List all values in an index.Index name (namespace)
Array of all values in the index
kv_server::list_keys_with_prefix
List all keys with a specific prefix.Key prefix to filter by
Array of matching keys
Observability Functions
Functions for logging, tracing, metrics, and monitoring.Logging Functions
OTEL-native logging functions with structured data support.engine::log::info
Log an informational message.Log message
Structured data/attributes
Trace ID for correlation
Span ID for correlation
Service name (defaults to function name)
engine::log::warn
Log a warning message. Parameters are identical toengine::log::info.
engine::log::error
Log an error message. Parameters are identical toengine::log::info.
engine::log::debug
Log a debug message. Parameters are identical toengine::log::info.
engine::log::trace
Log a trace-level message. Parameters are identical toengine::log::info.
Baggage Functions
Access and manage OpenTelemetry baggage for context propagation.engine::baggage::get
Get a baggage item value from the current context.Baggage key to retrieve
Baggage value, or null if not found
engine::baggage::set
Set a baggage item value.Baggage in OpenTelemetry is immutable. This function creates a new context but cannot propagate it back to the caller. For real baggage propagation, use SDK-level baggage headers.
Baggage key to set
Baggage value
engine::baggage::get_all
Get all baggage items from the current context.Object with all baggage key-value pairs
Traces Functions
Query and manage distributed traces.Trace storage is only available when the OTEL exporter is set to
memory or both in configuration.engine::traces::list
List stored traces with filtering and pagination.Filter by specific trace ID
Pagination offset
Maximum number of spans to return
Filter by service name (substring match)
Filter by span name (substring match)
Filter by status (substring match)
Minimum span duration in milliseconds
Maximum span duration in milliseconds
Start time in Unix timestamp milliseconds
End time in Unix timestamp milliseconds
Sort field: “duration”, “start_time”, or “name”
Sort order: “asc” or “desc”
Filter by attributes (array of [key, value] pairs)
Include internal engine traces
Array of span objects
Total number of matching spans
Current offset
Current limit
engine::traces::tree
Get trace tree with nested children for a specific trace.Trace ID to build the tree for
Array of root span tree nodes with nested children
engine::traces::clear
Clear all stored traces from memory.Clear operation success status
Metrics Functions
Query engine and SDK metrics.engine::metrics::list
List current metrics values.Start time in Unix timestamp milliseconds
End time in Unix timestamp milliseconds
Filter by metric name
Aggregate interval in seconds
Engine internal metrics
SDK-recorded metrics
Time-aggregated metrics (if aggregate_interval specified)
Query timestamp
engine::rollups::list
Get pre-aggregated metrics rollups.Start time in Unix timestamp milliseconds (default: 1 hour ago)
End time in Unix timestamp milliseconds (default: now)
Rollup level: 0 = 1 minute, 1 = 5 minutes, 2 = 1 hour
Filter by metric name
Array of metric rollups
Array of histogram rollups
Rollup level used
Logs Functions
Query and manage stored logs.engine::logs::list
List stored OTEL logs with filtering.Filter by trace ID
Filter by span ID
Minimum severity number (1-24, higher = more severe)
Filter by severity text (e.g., “ERROR”, “WARN”, “INFO”)
Start time in Unix timestamp milliseconds
End time in Unix timestamp milliseconds
Pagination offset
Maximum number of logs to return
Array of log entries
Total number of matching logs
engine::logs::clear
Clear all stored OTEL logs.Clear operation success status
Health and Diagnostics
engine::health::check
Check system health status.Overall health status
Health status of individual components
Check timestamp
Engine version
engine::sampling::rules
Get active sampling rules configuration.Trace sampling configuration
Log sampling configuration
Alerts Functions
Manage and query alert states.engine::alerts::list
List current alert states.Array of alert state objects
Number of currently firing alerts
engine::alerts::evaluate
Manually trigger alert evaluation.Whether evaluation occurred
Array of alerts that triggered
Error Handling
All built-in functions return errors in a consistent format:memory_exporter_not_enabled- Trace/log storage not availableserialization_error- Failed to serialize response datainvalid_input- Invalid input parameters
Best Practices
Use Internal Filtering
Set
include_internal: false when querying functions, triggers, or traces to exclude engine internals from results.Batch KV Operations
Use
kv_server::update with multiple operations instead of multiple set calls for better performance.Monitor Memory Usage
When using memory exporters, regularly clear old traces and logs to prevent memory growth.
Use Structured Logging
Always include the
data parameter with structured attributes in log functions for better queryability.Related Resources
Modules Overview
Learn about iii framework modules
Observability
Configure OTEL and monitoring
State Management
Using the KV store for state
Custom Modules
Creating custom modules