SDKs
C integration
Use the high-level Warden facade or the lower-level policy-agnostic Executor engine.Choose the right layer
Use libmaelys-warden for product integrations. It accepts a built-in profile, strict JSON or canonical MIR and owns Sandbox–Executor–Netd composition. Use libmaelys-executor only when your host already owns a sealed mechanical plan.
| Library | Input | Best for |
|---|---|---|
libmaelys-warden.a | profile, JSON, MIR | CLIs, orchestrators, agent runtimes |
libmaelys-executor.a | sealed ExecutorPlan | custom trusted embedders, MCP launcher adapter |
Minimal Warden run
#include <maelys/warden.h>
maelys_run_config_t *config = NULL;
maelys_run_t *run = NULL;
char *error = NULL;
maelys_run_config_create(&config, &error);
maelys_run_config_set_profile(config, "untrusted", &error);
const char *argv[] = { "/usr/bin/true" };
maelys_run_config_set_argv(config, 1, argv, &error);
maelys_run_start(config, &run, &error);
maelys_run_wait(run, &error);maelys_run_config_set_policy_json() compiles policy bytes in memory. It is useful when your application already receives trusted JSON and does not want a temporary file.
maelys_run_config_set_policy_json(config, json, json_size, &error);Relay bootstrap discovery
Normal installations discover maelys-relay-bootstrap relative to the installed Warden layout. An explicit path exists for relocatable bundles, test fixtures and hosts that install libexec separately. Most applications should not set it.
Receipt ownership
After completion, request an immutable receipt snapshot and serialize it to JSON. It can be written after the run; it cannot be a complete receipt before the terminal outcome exists.
maelys_receipt_t *receipt = NULL;
char *json_receipt = NULL;
size_t json_size = 0;
maelys_run_receipt(run, &receipt, &error);
maelys_receipt_to_json(receipt, &json_receipt, &json_size, &error);