lmcloud

lmcloud defines the shared procedural lmcode schema and Go hostkit implemented by lmaws, lmazure, lmgcp, and lmoci.

Quick reference

Load the shared lmcloud schema or declare a provider host in an LMScript program, and run conformance checks against the reference fake adapter or local cloud emulators.

bash scripts/test-hostkit.sh
bash tests/run-conformance.sh --check
p = _lmcode_ cli="lmaws" install="github:lmctl-ai/lmaws@latest";
Surface Signature or command Purpose
Context context cloud: Cloud Provider-neutral object storage, queue, tables, permissions, function, userpool, cost, and metrics entry point.
Object storage cloud.bucket_create(name), cloud.object_put(bucket, key, body), cloud.object_get(bucket, key) Create buckets and read, write, head, delete, or list objects across AWS, Azure, GCP, and OCI.
Queues cloud.queue_create(name), cloud.queue_send(queue, body), cloud.queue_receive(queue), cloud.queue_ack(queue, receipt) Create queues, send and receive messages, acknowledge processing, and adjust visibility timeouts with queue_nack.
Tables cloud.table_create(name, sorted), cloud.item_new(pk, sk), cloud.item_put(table, item), cloud.item_query(table, pk) Manage key-only or sorted key-value tables with conditional puts, typed attributes, partition queries, and scans.
Cost and metrics cloud.set_cost_cap_usd(cap), cloud.estimated_cost(), cloud.cost_report(), cloud.metrics() Enforce monotone-decreasing run budgets and inspect per-operation request counts, bytes, and latency quantiles.
Standard REST and CLI rest_config(key, val), rest_route(method, pattern, fn), rest_serve(), rest_stop(), rest_cli(args) Expose cloud workflows as HTTP routes (:param patterns) and CLI commands or flags via lmcode_std_v3 interfaces.

Runnable LMScript example using the shared lmcloud schema for object storage, queue delivery, and standard REST and CLI routing:

p = _lmcode_ cli="lmaws" install="github:lmctl-ai/lmaws@latest";
  @"/objects/:bucket/:key"
  fn get_obj(x: RestExchange) -> void implements RestGet {
    x.send(cloud.object_get(x.param("bucket"), x.param("key")));
  }

  @"--env"
  fn opt_env(x: RestExchange) -> void implements CliOption {
    x.set("env", x.query("env"));
  }

  @"publish"
  fn cmd_publish(x: RestExchange) -> void implements CliCommand {
    cloud.queue_send("jobs-q", x.get("env") + ":" + x.body());
    x.send("queued");
  }

  rest_config("prefix", "/v1");
  cloud.set_cost_cap_usd(0.05);
  cloud.bucket_create("demo-bkt");
  cloud.object_put("demo-bkt", "hello.txt", "hello from lmcloud");
  cloud.queue_create("jobs-q");

  let cli_out = rest_cli(str_split("--env dev publish -- payload-1", " "));
  let http_out = rest_cli(str_split("/v1/objects/demo-bkt/hello.txt", " "));
  let msgs = cloud.queue_receive("jobs-q");
  let first = msgs.at(0);
  cloud.queue_ack("jobs-q", first.receipt());
  print(cli_out + " | " + http_out + " | " + first.body());
end _lmcode_
r = run_lmcode(p);
assert(r.ok, "lmcloud workflow failed");

Documentation pages

Source repository and releases