Log inGet started

egress

Updated 5 September 2026

The egress namespace — 12 functions.

globals/egress/credentialNames

egress.credentialNames() -> { string }

List the names of configured credentials. 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?) -> string?

Perform an HTTP request with a named credential injected server-side (in Rust). Returns a promise handle for task.await(), or nil when the credential is unknown or url is outside the credential's allowed base_url. The secret is never exposed to Luau. This is the seam that production points at the ZeroMind egress endpoint.

Parameters

  • name string — Credential name registered by the trusted VM.
  • method string — HTTP method, e.g. "GET" or "POST".
  • url string — Request URL (must start with the credential's base_url).
  • headers Headers (optional) — Extra header key-value pairs.
  • body JsonBody (optional) — JSON body (encoded automatically).
  • response EgressResponseType (optional)"json" (default) or "bytes".

Returns string? — Promise handle for task.await(), or nil if refused.

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

globals/egress/hasCredential

egress.hasCredential(name: string) -> boolean

Whether a named credential is configured. Returns only a boolean — never the value. Service handlers use this to fail with a clear "not configured" message.

Parameters

  • name string — Credential name.

Returns boolean — True if configured.

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

modules/egress/README

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

Credential-injecting HTTP for BYO-key world egress (Mechanism B). Public Luau surface over the __egress Internal FFI namespace.

Usage: local egress = require("@builtin/modules/api/engine/egress") Also available as global: egress

modules/egress/clearCredential

clearCredential(name: string): boolean

TRUSTED ONLY. Remove a named credential.

Parameters

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

modules/egress/credentialNames

credentialNames(): { string }

List the names of configured credentials. 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 with a named credential injected server-side (in Rust). Returns a promise handle for task.await(), or nil when the credential is unknown or url is outside the credential's allowed base_url. The secret is never exposed to Luau. This is the seam that production points at the ZeroMind egress endpoint.

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

modules/egress/hasCredential

hasCredential(name: string): boolean

Whether a named credential is configured. Returns only a boolean — never the value. Service handlers use this to fail with a clear "not configured" message.

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 of configured credentials. 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?) -> string?

Perform an HTTP request with a named credential injected server-side (in Rust). Returns a promise handle for task.await(), or nil when the credential is unknown or url is outside the credential's allowed base_url. The secret is never exposed to Luau. This is the seam that production points at the ZeroMind egress endpoint.

Parameters

  • name string — Credential name registered by the trusted VM.
  • method string — HTTP method, e.g. "GET" or "POST".
  • url string — Request URL (must start with the credential's base_url).
  • headers Headers (optional) — Extra header key-value pairs.
  • body JsonBody (optional) — JSON body (encoded automatically).
  • response EgressResponseType (optional)"json" (default) or "bytes".

Returns string? — Promise handle for task.await(), or nil if refused.

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

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

egress.hasCredential(name: string) -> boolean

Whether a named credential is configured. Returns only a boolean — never the value. Service handlers use this to fail with a clear "not configured" message.

Parameters

  • name string — Credential name.

Returns boolean — True if configured.

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