Log inGet started

egress

Updated October 9, 2026

Credential-injecting HTTP for BYO-key world egress (Mechanism B).

require("@builtin::modules.api.engine.egress") -- egress (also available as global 'egress')

The egress namespace: 12 functions.

globals/egress/credentialNames

egress.credentialNames() -> { string }

List the names in the local credential store. Names only — secret values are never exposed to Luau.

Returns { string } — Array of configured credential names.

for _, n in ipairs(egress.credentialNames()) do print(n) end

globals/egress/fetch

egress.fetch(name: string, method: string, url: string, headers: Headers?, body: JsonBody?, response: EgressResponseType?) -> PromiseHandle?

Perform an HTTP request using a named credential. A bound world forwards the request to ZeroMind, which resolves its world secret and enforces the allowed destination. Await the returned handle; a refused forwarded request returns the HTTP error JSON with __http_error = true. With a local credential store, an unknown name or a URL outside its allowed prefix returns nil immediately. Credential values stay with the store or forwarding server and never enter world code.

Parameters

  • name string — Local credential name or bound-world secret handle.
  • method string — HTTP method, e.g. "GET" or "POST".
  • url string — Request URL allowed by the selected credential's destination rules.
  • headers Headers (optional) — Extra header key-value pairs.
  • body JsonBody (optional) — JSON body (encoded automatically).
  • response EgressResponseType (optional) — "json" (default) or "bytes".

Returns PromiseHandle? — Promise handle for task.await(), or nil on an immediate local refusal.

local h = egress.fetch("meshy", "POST", url, nil, { prompt = p })

globals/egress/hasCredential

egress.hasCredential(name: string) -> boolean

Whether the local credential store holds a name. Returns only a boolean. World secrets are resolved by ZeroMind when a forwarded request runs; this probe answers for the local store.

Parameters

  • name string — Credential name.

Returns boolean — True if configured.

if not egress.hasCredential("meshy") then error("set MESHY_API_KEY") end

modules/egress/clearCredential

clearCredential(name: string): boolean

TRUSTED ONLY. Remove a named credential.

Parameters

  • name string — Credential name.
egress.clearCredential("meshy")

modules/egress/configureForward

configureForward(baseUrl: string, worldGuid: string): boolean

TRUSTED ONLY. Route named-secret requests through the bound world's ZeroMind forwarding endpoint.

Parameters

  • baseUrl string — ZeroMind service origin.
  • worldGuid string — Bound world identity.

modules/egress/credentialNames

credentialNames(): { string }

List the names in the local credential store. Names only — secret values are never exposed to Luau.

for _, n in ipairs(egress.credentialNames()) do print(n) end

modules/egress/fetch

fetch(name: string, method: string, url: string,

Perform an HTTP request using a named credential. A bound world forwards the request to ZeroMind, which resolves its world secret and enforces the allowed destination. Await the returned handle; a refused forwarded request returns the HTTP error JSON with __http_error = true. With a local credential store, an unknown name or a URL outside its allowed prefix returns nil immediately. Credential values stay with the store or forwarding server and never enter world code.

local h = egress.fetch("meshy", "POST", url, nil, { prompt = p })

modules/egress/hasCredential

hasCredential(name: string): boolean

Whether the local credential store holds a name. Returns only a boolean. World secrets are resolved by ZeroMind when a forwarded request runs; this probe answers for the local store.

Parameters

  • name string — Credential name.
if not egress.hasCredential("meshy") then error("set MESHY_API_KEY") end

modules/egress/setCredential

setCredential(name: string, base_url: string,

TRUSTED ONLY. Register a named credential whose header is injected into matching egress.fetch calls. The value is held in Rust and never returned to Luau.

egress.setCredential("meshy", "https://api.meshy.ai/", "Authorization", "Bearer " .. key)

typed/builtin//modules/api/engine/egress/egress/credentialNames

egress.credentialNames() -> { string }

List the names in the local credential store. Names only — secret values are never exposed to Luau.

Returns { string } — Array of configured credential names.

for _, n in ipairs(egress.credentialNames()) do print(n) end

typed/builtin//modules/api/engine/egress/egress/fetch

egress.fetch(name: string, method: string, url: string, headers: Headers?, body: JsonBody?, response: EgressResponseType?) -> PromiseHandle?

Perform an HTTP request using a named credential. A bound world forwards the request to ZeroMind, which resolves its world secret and enforces the allowed destination. Await the returned handle; a refused forwarded request returns the HTTP error JSON with __http_error = true. With a local credential store, an unknown name or a URL outside its allowed prefix returns nil immediately. Credential values stay with the store or forwarding server and never enter world code.

Parameters

  • name string — Local credential name or bound-world secret handle.
  • method string — HTTP method, e.g. "GET" or "POST".
  • url string — Request URL allowed by the selected credential's destination rules.
  • headers Headers (optional) — Extra header key-value pairs.
  • body JsonBody (optional) — JSON body (encoded automatically).
  • response EgressResponseType (optional) — "json" (default) or "bytes".

Returns PromiseHandle? — Promise handle for task.await(), or nil on an immediate local refusal.

local h = egress.fetch("meshy", "POST", url, nil, { prompt = p })

typed/builtin//modules/api/engine/egress/egress/hasCredential

egress.hasCredential(name: string) -> boolean

Whether the local credential store holds a name. Returns only a boolean. World secrets are resolved by ZeroMind when a forwarded request runs; this probe answers for the local store.

Parameters

  • name string — Credential name.

Returns boolean — True if configured.

if not egress.hasCredential("meshy") then error("set MESHY_API_KEY") end
  • api
  • reference