private-agent.schema.json

One streamline's private half, read only by the model relay and the back end, never served to a device (config-schema §4.5): instructions, model, MCP servers with their tool allowlists and gates, limits, network rule.

All pages ↓

private-agent.schema.json JSON · 330 lines · Validates private/agents/<kind>.json Raw file
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://streamliner.work/schema/v1/private-agent.schema.json",
  "title": "private/agents/<kind>.json",
  "description": "One streamline's private half, read only by the model relay and the back end, never served to a device (config-schema §4.5): instructions, model, MCP servers with their tool allowlists and gates, limits, network rule.",
  "type": "object",
  "required": [
    "instructions",
    "model",
    "mcp"
  ],
  "additionalProperties": false,
  "properties": {
    "$schema": {
      "$ref": "defs.schema.json#/$defs/schemaRef"
    },
    "id": {
      "$ref": "defs.schema.json#/$defs/kindId",
      "description": "Equals the file name and the public `agents/<kind>.json` `id`."
    },
    "instructions": {
      "type": "string",
      "minLength": 1,
      "description": "The persona and guidance: the system prompt. Never business rules (the API enforces those, law 3) and never secrets. Interpolates `user.*`, `tenant.*`, `now`. Stable text first so the prefix caches."
    },
    "briefs": {
      "$ref": "defs.schema.json#/$defs/briefs"
    },
    "model": {
      "$ref": "defs.schema.json#/$defs/model"
    },
    "fallbackModel": {
      "$ref": "defs.schema.json#/$defs/fallbackModel"
    },
    "mcp": {
      "type": "array",
      "minItems": 1,
      "description": "The MCP servers this streamline may reach, one or more, each with its own connection, allowlist and per-tool gates.",
      "items": {
        "$ref": "#/$defs/server"
      }
    },
    "limits": {
      "type": "object",
      "description": "Per-turn, per-stream and per-user limits, enforced by the loop and the relay's ledger.",
      "additionalProperties": false,
      "properties": {
        "maxToolCallsPerTurn": {
          "type": "integer",
          "minimum": 1,
          "maximum": 100,
          "description": "The loop stops and tells the employee. Default 10."
        },
        "maxTurnsPerChat": {
          "type": "integer",
          "minimum": 1,
          "description": "A stream that runs this long is not one job. Default 120."
        },
        "maxModelCallsPerTurn": {
          "type": "integer",
          "minimum": 1,
          "maximum": 40,
          "description": "Model calls the loop makes for one message before it stops and says so. Default 8."
        },
        "tokensPerUserPerDay": {
          "type": "integer",
          "minimum": 1,
          "description": "Input + output (+ cache) per user per UTC day, all streams of this streamline; over it, sends are refused."
        },
        "costPerUserPerDayUSD": {
          "type": "number",
          "exclusiveMinimum": 0,
          "description": "Estimated USD per user per UTC day for this streamline."
        }
      }
    },
    "transcript": {
      "type": "object",
      "description": "What the model sees of the history.",
      "additionalProperties": false,
      "properties": {
        "keepToolResults": {
          "type": "integer",
          "minimum": 0,
          "description": "Older tool results are trimmed from what the model sees (the overview carries the state). Default 6."
        }
      }
    },
    "network": {
      "$ref": "defs.schema.json#/$defs/networkRule",
      "description": "This streamline's network rule; overrides the account default in `private/tenant.json` (§3.3, §3.4). The public file must say `network.restricted` exactly when this restricts."
    },
    "sharing": {
      "type": "object",
      "title": "Sharing",
      "description": "Whether owners and admins may share this streamline by link (Discover, config-schema §8c; added 2026-10-12). Off unless set: a streamline is shared only once an owner or admin marks it shareable here and publishes. A recipient's copy runs on their own model key; roles, network rules, budgets and the model key never travel.",
      "additionalProperties": false,
      "properties": {
        "link": { "type": "boolean", "title": "Can be shared by link", "description": "On: Share Link appears in this streamline's Library editor, and the shared copy carries its instructions, servers and tool rules. Default off." }
      }
    },
    "tollfree": {
      "type": "object",
      "title": "Toll-free",
      "description": "Toll-free (config-schema §4.5.2, gameplay #192; added 2026-10-26): the organization's own model key pays, so anyone can chat with this streamline's public Discover listing without an account or a key of their own, embedded on the organization's websites, on Toll-free AI and in the Streamliner app. Meaningful only on a streamline listed publicly in Discover. Relay only: never sent to a member's device or a browser. Written by the admin route GET/PUT/DELETE /v1/admin/<t>/streamlines/<kind>/tollfree or any publish; checked by configcheck's checkTollfree.",
      "additionalProperties": false,
      "required": ["enabled"],
      "properties": {
        "enabled": { "type": "boolean", "title": "Toll-free", "description": "On: the organization's key pays for every toll-free chat of this streamline. Off: no toll-free chat anywhere (a visitor sees a calm closed card)." },
        "credentialRef": { "$ref": "defs.schema.json#/$defs/credentialRef", "title": "The key that pays", "description": "The organization's sealed model key that pays for toll-free chats (a credentialRef on this account, never a key). Required when enabled." },
        "places": {
          "type": "object", "title": "Where", "description": "Where the free chat happens. Each place is a switch; omitted means its default.",
          "additionalProperties": false,
          "properties": {
            "embed": { "type": "boolean", "title": "On your websites", "description": "The one-line embed tag on the sites in embed.origins. Default off." },
            "site": { "type": "boolean", "title": "On Toll-free AI", "description": "Listed on tollfree.streamliner.work with Start Chat. Default on." },
            "app": { "type": "boolean", "title": "In the Streamliner app", "description": "Anyone who gets it from Discover chats without a key of their own. Default on." }
          }
        },
        "embed": {
          "type": "object", "title": "Embed", "description": "The embedded chat: which websites may put it on their pages, and its header.",
          "additionalProperties": false,
          "properties": {
            "origins": {
              "title": "Websites", "description": "The exact https origins that may frame the chat (1 to 20; http://localhost only in a demo account), or \"any\": any website can put this chat on its pages, and the organization's key pays for it.",
              "oneOf": [
                { "const": "any", "description": "Any website." },
                { "type": "array", "minItems": 1, "maxItems": 20, "uniqueItems": true, "description": "Exact origins, such as https://meridian.example.", "items": { "type": "string", "pattern": "^https?://[^/?#\\s]+$", "description": "An origin: scheme and host (and port), no path." } }
              ]
            },
            "title": { "type": "string", "maxLength": 60, "title": "Title", "description": "The chat header's title (default: How can we help?)." },
            "subtitle": { "type": "string", "maxLength": 90, "title": "Subtitle", "description": "One line under the title." }
          }
        },
        "limits": {
          "type": "object", "title": "Budget and limits", "description": "The streamline's day on the organization's usage Ledger, and each visitor's share.",
          "additionalProperties": false,
          "properties": {
            "dailyUSD": { "type": "number", "minimum": 0.01, "maximum": 10000, "title": "Daily budget", "description": "US dollars a day for every toll-free chat of this streamline together (default 5). Past it, visitors see the busy card until midnight UTC." },
            "perVisitor": {
              "type": "object", "title": "Each visitor", "description": "Each browser pass or app install, per day and hour.",
              "additionalProperties": false,
              "properties": {
                "burst": { "type": "integer", "minimum": 1, "maximum": 100, "description": "Model calls in 10 seconds (default 6)." },
                "hour": { "type": "integer", "minimum": 1, "maximum": 10000, "description": "Model calls an hour (default 40)." },
                "day": { "type": "integer", "minimum": 1, "maximum": 100000, "description": "Model calls a day (default 150)." },
                "dailyUSD": { "type": "number", "minimum": 0.001, "maximum": 100, "description": "US dollars a day for one visitor (default 0.10)." }
              }
            }
          }
        },
        "words": {
          "type": "object", "title": "Words", "description": "What visitors read when a limit is reached: plain text, at most 200 characters, no < or >.",
          "additionalProperties": false,
          "properties": {
            "outOfAllowance": { "type": "string", "maxLength": 200, "pattern": "^[^<>]*$", "description": "One visitor's allowance is used up." },
            "busy": { "type": "string", "maxLength": 200, "pattern": "^[^<>]*$", "description": "The streamline's daily budget is spent." }
          }
        }
      }
    }
  },
  "$defs": {
    "server": {
      "type": "object",
      "description": "One MCP server: endpoint, auth, connection, and its tool allowlist.",
      "required": [
        "id",
        "url",
        "auth",
        "tools"
      ],
      "additionalProperties": false,
      "properties": {
        "id": {
          "$ref": "defs.schema.json#/$defs/serverId"
        },
        "url": {
          "$ref": "defs.schema.json#/$defs/configUrl",
          "description": "Streamable HTTP endpoint (MCP 2026-07-28 or later preferred)."
        },
        "auth": {
          "enum": [
            "oauth",
            "password",
            "api-key",
            "none",
            "user-token"
          ],
          "description": "`oauth` | `password` | `api-key` | `none`; the prototype's `user-token` means `oauth` by token exchange for an OIDC account."
        },
        "connection": {
          "$ref": "defs.schema.json#/$defs/connectionId",
          "description": "The connection (§3.2); servers on one system share one. Default: this entry's `id`."
        },
        "resource": {
          "type": "string",
          "format": "uri",
          "description": "For `oauth`: the audience (RFC 8707 resource) the token must be for."
        },
        "reauthOn": {
          "type": "array",
          "items": { "type": "string", "pattern": "^[A-Za-z0-9_.:-]{1,64}$" },
          "maxItems": 20,
          "description": "`oauth` only (added 2026-10-12): business error codes that mean the session behind the token has ended (`{ok:false, error:{code}}` answers); the device signs in again and retries, and the model never sees that result."
        },
        "formPresentation": {
          "$ref": "defs.schema.json#/$defs/presentation",
          "title": "Its forms",
          "description": "This server's forms (elicitation) only: `inline` or `sheet`, over the streamline's `formPresentation.server` (agents/<kind>.json). `/v1/me` hands it to the device. Added 2026-10-13."
        },
        "tools": {
          "type": "array",
          "minItems": 1,
          "description": "This server's allowlist: named entries (`name`) and pattern entries (`match`, a glob). A tool the server lists that no entry admits is never shown to the model. Named entries win over patterns; among patterns the first in order wins. Names must be unique across the streamline.",
          "items": {
            "$ref": "#/$defs/tool"
          }
        },
        "deny": {
          "type": "array",
          "uniqueItems": true,
          "minItems": 1,
          "items": {
            "$ref": "defs.schema.json#/$defs/toolGlob"
          },
          "description": "Globs subtracted from everything this server's allowlist admits (named entries included: configcheck `deny.named` when a deny removes a named tool). Added 2026-10-12."
        },
        "deniedOn": {
          "type": "array",
          "uniqueItems": true,
          "items": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_.:-]{1,64}$"
          },
          "description": "Business error codes (`{ok:false, error:{code}}`) that mean *not allowed for you*; default `[\"FORBIDDEN\"]`. A refusal with one (or an HTTP 403 without `insufficient_scope`) hides the tool from this person until they sign in again, the config changes or 24 hours pass. `[]` turns the per-person hiding off for this server. Added 2026-10-12."
        }
      }
    },
    "tool": {
      "type": "object",
      "description": "One allowlist entry and its gates (§4.5.1): a named tool (`name`) or a pattern (`match`).",
      "additionalProperties": false,
      "properties": {
        "name": {
          "$ref": "defs.schema.json#/$defs/toolName"
        },
        "match": {
          "$ref": "defs.schema.json#/$defs/toolGlob",
          "description": "A glob (`customer_*`) admitting every tool the server lists that matches, instead of one `name`. May set `roles`, `readOnly` or `confirm: true`; otherwise the gate comes from the tool's annotations the cautious way (only `readOnlyHint: true` without `destructiveHint` runs untapped). `direct`, a `confirm` object and `description` need a named entry (configcheck `match.namedOnly`). Added 2026-10-12."
        },
        "readOnly": {
          "type": "boolean",
          "description": "May be called directly by the overview and `poll`, with no model. Config wins over the server's `readOnlyHint`."
        },
        "quiet": {
          "type": "boolean",
          "description": "A lookup that runs without its activity row (added 2026-10-25): `readOnly` entries only (configcheck `quiet.gated`); its cards still draw, and a failure still shows."
        },
        "roles": {
          "type": "array",
          "uniqueItems": true,
          "items": {
            "$ref": "defs.schema.json#/$defs/roleId"
          },
          "description": "Narrower than the streamline's roles; hidden from the model for anyone else."
        },
        "confirm": {
          "description": "Confirm before the irreversible (law 5): the loop never sends this call upstream until the employee taps. UX on the device; the API must enforce its own rules (law 3). `true` (pattern entries): always a tap, with the generic card.",
          "oneOf": [
            {
              "type": "object",
              "required": [
                "template",
                "button"
              ],
              "additionalProperties": false,
              "properties": {
                "template": {
                  "$ref": "defs.schema.json#/$defs/templateId",
                  "description": "The confirmation card, bound to `{args, preview}`."
                },
                "preview": {
                  "$ref": "defs.schema.json#/$defs/toolName",
                  "description": "An allowlisted read-only tool whose result is shown with the arguments (the real cart, not the model's description of it)."
                },
                "previewArgs": {
                  "enum": [
                    "ids",
                    "all"
                  ],
                  "description": "What the preview tool is called with: `ids` (default: only cartId, offerId, poId) or `all` (the call's own arguments)."
                },
                "button": {
                  "$ref": "defs.schema.json#/$defs/interpolated",
                  "description": "The verb on the button, interpolated against `{args, preview}`."
                }
              }
            },
            {
              "const": true,
              "description": "Always wait for the tap, with the generic confirmation card."
            }
          ]
        },
        "direct": {
          "type": "boolean",
          "description": "May be called by a button, quick phrase or scan with no model (§6.5, the fast path). Same allowlist, roles, gates and audit."
        },
        "description": {
          "type": "string",
          "description": "Overrides the server's description for the model (servers we don't write)."
        }
      },
      "oneOf": [
        {
          "required": [
            "name"
          ]
        },
        {
          "required": [
            "match"
          ]
        }
      ],
      "errorMessage": "an allowlist entry has either name (one tool) or match (a glob), not both"
    }
  }
}

← All Schemas