Prompt modules API

Prompt modules are reusable blocks of persona / guardrail instructions you can attach to any agent. The library has platform modules (read-only) plus your org's own custom modules. Reading is gated on agents.read; writing on agents.write.

List & create

GET  /api/v1/rest/prompt-modules
POST /api/v1/rest/prompt-modules
{
  "slug": "return_policy",          // lowercase, letters/numbers/underscores
  "kind": "guardrail",              // "guardrail" | "instruction"
  "title": "Return policy",
  "body": "Returns are accepted within 30 days with a receipt…",
  "channels": ["phone", "web"],     // optional; omit to apply everywhere
  "enabled": true
}

Platform modules appear in the list with scope: "platform" and are read-only; your own are scope: "org".

Get, update, delete

GET    /api/v1/rest/prompt-modules/:id
PATCH  /api/v1/rest/prompt-modules/:id     # org modules only; send channels: null to clear targeting
DELETE /api/v1/rest/prompt-modules/:id

Attach to an agent

Attach modules through the agent's prompt_modules config on PATCH /api/v1/rest/agents/:id — a { code, library }object referencing built-in code modules and library module ids. The broker's safety floor is always rendered regardless, so a bad attachment can never strip an agent's guardrails. Full schemas are in the OpenAPI reference.