Skip to content

Architecture Overview

Greentic follows a layered architecture with clear separation of concerns:

┌─────────────────────────────────────────────────────────┐
│ Messaging Channels │
│ (Slack, Teams, Telegram, WhatsApp, WebChat) │
└─────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────┐
│ Gateway (HTTP/NATS) │
│ Public Endpoint Router │
└─────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────┐
│ greentic-runner │
│ (Production Runtime Host) │
│ ┌─────────────────────────────────────────────────┐ │
│ │ Flow Executor │ │
│ │ (Wasmtime Component Model) │ │
│ └─────────────────────────────────────────────────┘ │
│ ┌─────────────────────────────────────────────────┐ │
│ │ Session Manager │ │
│ │ (Memory / Redis) │ │
│ └─────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────┐
│ WASM Components │
│ (Flows, Providers, MCP Tools, Custom Components) │
└─────────────────────────────────────────────────────────┘

greentic-runner

The main production runtime that hosts and executes flows, manages sessions, and coordinates all platform services.

greentic-flow

Flow schema definition, intermediate representation (IR), loader, and validator for .ygtc files.

greentic-pack

Pack builder CLI for creating signed .gtpack archives containing flows, components, and assets.

greentic-component

Component authoring CLI and runtime utilities for building WASM components.

LayerTechnologyPurpose
WASM RuntimeWasmtime v41Component model execution
Async RuntimeTokio v1Async I/O, task scheduling
HTTP ServerAxum v0.8REST API, webhooks
Message BusNATSEvent distribution, pub/sub
Session StoreMemory/RedisFlow state persistence
SecretsAWS/Azure/GCP/VaultCredential management
1. External Message (e.g., Slack)
2. Webhook Handler (Provider Ingress)
3. NATS: greentic.messaging.ingress.{env}.{tenant}.{team}.{channel}
4. Flow Router (tenant/team resolution)
5. Flow Executor (WASM component execution)
6. Session State Update
7. Reply/Action Nodes
8. NATS: greentic.messaging.egress.{env}.{tenant}.{team}.{channel}
9. Provider Egress → External Service
1. Bundle Configuration (greentic.demo.yaml)
2. Pack Resolver (local/OCI registry)
3. Signature Verification (ed25519-dalek)
4. CBOR Metadata Parsing
5. WASM Component Instantiation
6. WIT Interface Binding
7. Runtime Registration

Greentic implements tenant isolation at every layer:

Tenant
└── Environment (prod, staging, dev)
└── Team
└── Channel (messaging provider instance)
└── Session (user conversation state)

The TenantCtx struct flows through all operations:

pub struct TenantCtx {
pub tenant_id: String,
pub env_id: String,
pub team_id: Option<String>,
}

Greentic uses the WebAssembly Interface Types (WIT) specification for defining component interfaces:

greentic-interfaces/wit/component.wit
package greentic:component;
interface types {
record message {
id: string,
content: string,
sender: string,
timestamp: u64,
}
record outcome {
success: bool,
data: option<string>,
error: option<string>,
}
}
world component {
import types;
export execute: func(input: types.message) -> types.outcome;
}
greentic-types ─────────────────────────── (foundation)
greentic-telemetry
greentic-interfaces ← greentic-types
greentic-config ← greentic-types
greentic-session ← greentic-types
greentic-state ← greentic-types + greentic-interfaces
greentic-flow ← greentic-interfaces + greentic-types
greentic-pack ← greentic-flow + greentic-types
greentic-component ← greentic-interfaces + greentic-types
greentic-mcp ← greentic-interfaces + greentic-types
greentic-runner ← ALL of the above

Greentic uses OpenTelemetry for distributed tracing and metrics:

  • Tracing: OTLP exporter for distributed trace correlation
  • Metrics: Flow execution times, message throughput, error rates
  • Logging: Structured logging with trace context
  • Flows - Learn about flow definitions
  • Packs - Understand pack structure
  • Components - Build custom WASM components