greentic-runner
Greentic runner host for executing agentic flows packaged as Wasm components.
The workspace hosts the runner binary in crates/host plus integration tests in crates/tests and sample bindings under examples/bindings/.
Getting Started
On startup the host loads the supplied pack, enumerates flows, and exposes the messaging webhook for Telegram under /messaging/telegram/webhook.
Architecture
- Legacy host (
legacy-hostfeature, default): HTTP server that loads packs, exposes Telegram/webhook adapters, and schedules timers. Production deployments continue to use this path unchanged. - New runner (
new-runnerfeature): Library + CLI built aroundRunnerApi, a policy-governedStateMachine, and anAdapterRegistry. Dependencies (sessions/state, telemetry, secrets) are injected through host traits so the legacy integrations can be bridged without duplication. - Host bundle: Secrets, telemetry, session, and state providers packaged as a
HostBundleand shared between the server and the new runner. - Adapter registry: Connectors register under stable names (
messaging.telegram,email.google, …); the state machine resolves outbound calls via the registry and enforces idempotent sends.
TenantCtx → RunnerApi → StateMachine → Host Bundle (session/state/secrets/telemetry)
↘ AdapterRegistry → Connectors
Quickstart (new runner)
# Build the CLI behind the new-runner feature
sample_flows.json is a JSON array of flow definitions that the new runner ingests. Each definition declares summaries, schemas, and a linear set of steps. Adapter steps reference registry names such as demo.adapter.
Telemetry
Telemetry initialises automatically through the greentic_types::telemetry::main macro. Configure exporters and logging via environment variables:
OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317
RUST_LOG=info
OTEL_RESOURCE_ATTRIBUTES=deployment.environment=dev
Runner API Usage
use RunnerBuilder;
use Policy;
use AdapterRegistry;
use ;
use HostBundle;
use ;
use FlowSummary;
use ;
use ;
use ;
use Arc;
async
Maintenance Notes
- Features:
legacy-host(default) keeps existing HTTP server;new-runnerenables the new CLI, API, and state machine.redisis reserved for future session/state backends;schemawill emit JSON schemas for public structs. - Runtime selection:
- Stable (default) enables
stable-wasmtime, which pins Wasmtime to<38for compatibility with the stable toolchain. - Nightly workloads can opt into
nightly-wasmtimeto compile against Wasmtime38. This requires building with--no-default-features --features legacy-host,nightly-wasmtime(or the equivalent for the CLI) and the repo-local nightly toolchain. - Non-execution commands (for example, schema inspection) do not require either runtime feature.
- Stable (default) enables
- Policy & retry:
src/newrunner/policy.rscentralises exponential backoff with jitter. Both the new runner and the legacy server can reuse this helper to keep retry semantics aligned. - Adapters: Register legacy adapters through
glue::FnAdapterBridgeor migrate them to implementnewrunner::Adapterdirectly. - Testing:
cargo test --workspace --all-featuresexercises the new state machine (requires enablingnew-runner). Redis-backed tests will attach once the external crates land. - Session/state shims: Temporary in-memory implementations live under
src/newrunner/shims/and provide CAS semantics plus TTL. Replace them withgreentic-session/greentic-stateonce published.
Releases & Publishing
- Crate versions come directly from each crate's
Cargo.toml. - Pushing to
mastertags every crate whose version changed as<crate-name>-v<semver>. - The publish workflow runs after tagging and pushes the changed crates to crates.io.
- Publishing is idempotent; it succeeds even when crates are already up to date.
License
MIT