:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(agent-platform): spec schema over MCP, zod as the single source of truth (#66295)
Ben Whitee0746762c921
diff --git a/products/agent_platform/backend/kernel_skills/auditing-the-fleet/SKILL.md b/products/agent_platform/backend/kernel_skills/auditing-the-fleet/SKILL.mdindex 48e3a24e2e22..1775f882e18c 100644--- a/products/agent_platform/backend/kernel_skills/auditing-the-fleet/SKILL.md+++ b/products/agent_platform/backend/kernel_skills/auditing-the-fleet/SKILL.md@@ -38,7 +38,7 @@ single-agent flow:`promote` / `archive` need explicit consent (a `principal`approval) and are out of scope for the sweep itself. Your writesurface this run is: `new-draft-create`, the bundle edit tools- (`agent-md-update`, `skill-refs-set`, `tools-update`,+ (`agent-md-update`, `skill-refs-update`, `tools-update`,`partial-update`), and `validate-create`. Stop at validate. Do**not** `freeze` — a frozen revision reads as "ready to ship", andthese are unreviewed.@@ -116,7 +116,7 @@ For each fix:surgical.2. Apply the **smallest** change that addresses the root cause:- prompt/loop bug → `agent-md-update`, or revise the skill in the- store (`llm-skills-create` a new version) and `skill-refs-set`+ store (`llm-skills-create` a new version) and `skill-refs-update`- missing/over-broad tool, wrong limit, wrong model/reasoning →`partial-update` on the spec- keep each draft to **one** root cause. Don't bundle unrelateddiff --git a/products/agent_platform/backend/kernel_skills/safety-and-boundaries/SKILL.md b/products/agent_platform/backend/kernel_skills/safety-and-boundaries/SKILL.mdindex 03edf0576860..b2536b8577fe 100644--- a/products/agent_platform/backend/kernel_skills/safety-and-boundaries/SKILL.md+++ b/products/agent_platform/backend/kernel_skills/safety-and-boundaries/SKILL.md@@ -142,7 +142,7 @@ only when a concrete external client demands them.`tools-destroy` deletes a custom tool's source with no undo, and`archive` clears a live revision. (Skills are store references —-`skill-refs-set` only changes which skills the agent pins; it never+`skill-refs-update` only changes which skills the agent pins; it neverdeletes skill content.)Before either:diff --git a/products/agent_platform/backend/logic/janitor_client.py b/products/agent_platform/backend/logic/janitor_client.pyindex 0a6e6ba0afff..b7d3ca77b196 100644--- a/products/agent_platform/backend/logic/janitor_client.py+++ b/products/agent_platform/backend/logic/janitor_client.py@@ -208,6 +208,15 @@ class JanitorClient:(the gateway catalog is global), so no params."""return self._call("GET", "/models")+ def get_spec_schema(self, *, section: str | None = None) -> dict:+ """The agent-spec JSON Schema, emitted from the canonical zod+ `AgentSpecSchema` (no Python mirror). Optional `section` returns one+ top-level slice (e.g. `models`, `triggers`, `limits`)."""+ params: dict[str, Any] = {}+ if section:+ params["section"] = section+ return self._call("GET", "/spec-schema", params=params)+def aggregate_for_application(self, application_id: str, *, since: str | None = None) -> dict:params: dict[str, Any] = {"application_id": application_id}if since:diff --git a/products/agent_platform/backend/logic/spec_schema.py b/products/agent_platform/backend/logic/spec_schema.pyindex 00720cdc3a2f..fcd1a35f719f 100644--- a/products/agent_platform/backend/logic/spec_schema.py+++ b/products/agent_platform/backend/logic/spec_schema.py@@ -1,754 +1,22 @@"""-JSON Schema for `AgentSpec`, copy-pasted from the canonical zod schema at-`services/agent-shared/src/spec/spec.ts` (`AgentSpecSchema`).--The zod schema is the source of truth — every other consumer (janitor at read-time, runner at session start, this file at write time) must agree on its-shape. We copy rather than codegen because the zod surface is small enough-that drift is caught loudly by `test_spec_schema.py` (which re-emits the zod-schema and diffs it against the embedded copy).--## When zod changes--1. Run the regen one-liner from `test_spec_schema.test_no_drift_vs_zod` (the- test prints it on failure).-2. Replace `_AGENT_SPEC_JSON_SCHEMA_RAW` below with the new output.-3. Re-run the test; it should pass.--## Why two schemas--zod's `.default([...])` makes a field optional at parse time — you can omit-`triggers` and zod fills it in. JSON Schema's `required` doesn't respect-defaults; if `triggers` is in `required`, every Django write needs to send-the full empty list. To preserve zod semantics on the Django side, the-`_relax_required_for_defaults` pass strips fields with `default` from the-top-level `required` array.--- `AGENT_SPEC_JSON_SCHEMA` — full shape, used for OpenAPI annotation so the- MCP tool surface advertises every field plus its default.-- `AGENT_SPEC_JSON_SCHEMA_FOR_WRITE` — relaxed required list, used for- Django `validate_spec` so the same `{"model": "anthropic/claude-haiku-4-5"}`- that zod accepts also passes Django.+Django-side helpers for `AgentSpec`.++The agent-spec JSON Schema is NOT defined here. The canonical zod+`AgentSpecSchema` (`services/agent-shared/src/spec/spec.ts`) is the single+source of truth; the janitor emits it on demand (`/spec-schema`, surfaced as+the `agent-applications-spec-schema` MCP tool) and the runner parses against+it. Django no longer carries a hand-maintained mirror — keeping a Python copy+in lockstep with zod was a recurring drift hazard, and structural validation+already runs node-side (the explicit `validate` action, freeze, the runner).++What remains here is the per-trigger required-secrets registry, which is a+Django concern (the promote gate reads `encrypted_env`) and has no schema."""from __future__ import annotations-import copyfrom typing import Any-# Shared `approval_policy` block — referenced from every tool variant that-# can be approval-gated (native + custom + MCP entries). Mirror-# `ApprovalPolicySchema` in services/agent-shared/src/spec/spec.ts.-_APPROVAL_POLICY_JSON_SCHEMA: dict[str, Any] = {- "type": "object",- "properties": {- # `principal` (default) — the session's principal clears it (a generic- # identity match, decided at the lightweight ingress API). `agent` — the- # agent's owners (created_by + team admins) clear it in the console.- "type": {"type": "string", "enum": ["principal", "agent"], "default": "principal"},- "allow_edit": {"type": "boolean", "default": False},- "ttl_ms": {- "type": "integer",- "minimum": 60000,- "maximum": 7 * 24 * 60 * 60 * 1000,- "default": 24 * 60 * 60 * 1000,- },- },- "additionalProperties": False,-}--# Shared `auth` block — referenced from every declarative trigger (webhook /-# chat / mcp). Mirror `AuthConfigSchema` / `AuthModeSchema` in-# services/agent-shared/src/spec/spec.ts. No default on `modes` here on purpose:-# Orval emits a default as a plain TS literal that widens the discriminated-# union and breaks the generated zod. The runtime default still applies node-side.-_AUTH_CONFIG_JSON_SCHEMA: dict[str, Any] = {- "type": "object",- "properties": {- "modes": {- "type": "array",- "items": {- "oneOf": [- {- "type": "object",- "properties": {- "type": {"type": "string", "const": "public"},- "acknowledge_public_exposure": {"type": "boolean", "const": True},- },- "required": ["type", "acknowledge_public_exposure"],- "additionalProperties": False,- },- {- "type": "object",- "properties": {- "type": {"type": "string", "const": "posthog"},- "scopes": {"default": [], "type": "array", "items": {"type": "string"}},- # Invocation boundary: bind to the agent's owning project- # (default) or its owning organization. Mirrors the- # `audience` field on `AuthModeSchema`'s posthog variant.- "audience": {- "default": "project",- "type": "string",- "enum": ["project", "organization"],- },- },- "required": ["type"],- "additionalProperties": False,- },- {- "type": "object",- "properties": {- "type": {"type": "string", "const": "jwt"},- "issuer_secret_ref": {"type": "string", "minLength": 1},- },- "required": ["type", "issuer_secret_ref"],- "additionalProperties": False,- },- {- "type": "object",- "properties": {- "type": {"type": "string", "const": "shared_secret"},- "header": {"type": "string", "minLength": 1},- "secret_ref": {"type": "string", "minLength": 1},- },- "required": ["type", "header", "secret_ref"],- "additionalProperties": False,- },- {- "type": "object",- "properties": {"type": {"type": "string", "const": "posthog_internal"}},- "required": ["type"],- "additionalProperties": False,- },- ]- },- },- },- "additionalProperties": False,-}--_AGENT_SPEC_JSON_SCHEMA_RAW: dict[str, Any] = {- "$schema": "https://json-schema.org/draft/2020-12/schema",- "type": "object",- "properties": {- # Model selection (mirrors `AgentSpecSchema.models`, default- # auto/medium). auto: platform resolves `level` to a cross-provider list- # at runtime. manual: author's explicit priority list.- "models": {- "description": (- "How this agent selects its model. `auto`: pick a quality/cost `level` and the platform "- "resolves it to a maintained, priority-ordered, cross-provider list at runtime. `manual`: "- "give an explicit priority-ordered `models` list (primary first). `optimize_for` governs "- "how the chosen model is treated across the session's turns."- ),- "default": {"mode": "auto", "level": "medium", "optimize_for": "cost"},- "oneOf": [- {- "type": "object",- "properties": {- "mode": {"type": "string", "const": "auto"},- "level": {- "description": (- "Quality/cost tier (auto). low = cheapest, for short, formulaic, no-reasoning "- "jobs (lookups, FAQ bots); medium = balanced default, for multi-step but bounded "- "work; high = top-tier, for long, branching, reasoning-heavy work. Resolved to a "- "priority-ordered cross-provider list at session start."- ),- "default": "medium",- "type": "string",- "enum": ["low", "medium", "high"],- },- "reasoning": {- "description": (- "Reasoning/thinking effort budget. minimal = no deliberation (fastest, cheapest) … "- "xhigh = maximal (research-grade, ~5-10x the per-turn cost). Omit for the provider/"- "spec default."- ),- "type": "string",- "enum": ["minimal", "low", "medium", "high", "xhigh"],- },- "optimize_for": {- "description": (- "Session model stability vs. resilience. `cost` (default): the first turn picks a "- "working model and PINS it for the whole session — keeps the provider's prompt cache "- "warm (cache reads are ~0.1-0.5x of full input) and never fails over mid-session; if "- "the pinned model is down the turn fails rather than re-reading the whole context cold "- "on another provider. `availability`: fail over to the next model when the session's "- "model fails — survives an outage at the cost of a one-time cold re-read. Prefer `cost` "- "for long/expensive sessions, `availability` where uptime matters more than spend."- ),- "default": "cost",- "type": "string",- "enum": ["cost", "availability"],- },- },- "required": ["mode"],- "additionalProperties": False,- },- {- "type": "object",- "properties": {- "mode": {"type": "string", "const": "manual"},- "models": {- "description": "Explicit priority-ordered fallback list — the runner tries entries in order (primary first).",- "minItems": 1,- "type": "array",- "items": {- "type": "object",- "properties": {- "model": {- "description": "Canonical model id, e.g. `anthropic/claude-sonnet-4-6` (see the agent-applications-models tool for served ids).",- "type": "string",- "minLength": 1,- # Mirror of `ModelIdSchema` in agent-shared/src/spec/spec.ts.- # `<provider>/<model-id>` — bare ids freeze fine but the- # gateway 400s on first session; reject at authoring time.- "pattern": r"^[a-z0-9_-]+/[a-zA-Z0-9._:-]+$",- },- "reasoning": {- "description": "Per-model reasoning effort override (else the spec default).",- "type": "string",- "enum": ["minimal", "low", "medium", "high", "xhigh"],- },- },- "required": ["model"],- "additionalProperties": False,- },- },- "optimize_for": {- "description": (- "Session model stability vs. resilience. `cost` (default): pin the first working model "- "for the whole session (warm prompt cache, no mid-session failover). `availability`: "- "fail over down this list when the session's model fails (survives outages, re-reads "- "context cold)."- ),- "default": "cost",- "type": "string",- "enum": ["cost", "availability"],- },- },- "required": ["mode", "models"],- "additionalProperties": False,- },- ],- },- "triggers": {- "default": [],- "type": "array",- "items": {- "oneOf": [- {- "type": "object",- "properties": {- "type": {"type": "string", "const": "slack"},- "config": {- "type": "object",- "properties": {- "channel_id": {"type": "string"},- "mention_only": {"default": False, "type": "boolean"},- "auto_resume_threads": {"default": False, "type": "boolean"},- "allow_workspace_participants": {"default": False, "type": "boolean"},- "ack_reaction": {"type": "string"},- "allow_direct_messages": {"default": False, "type": "boolean"},- "trusted_workspaces": {- "anyOf": [- {"minItems": 1, "type": "array", "items": {"type": "string"}},- {"type": "string", "const": "*"},- ]- },- },- "required": [- "mention_only",- "auto_resume_threads",- "allow_workspace_participants",- "allow_direct_messages",- "trusted_workspaces",- ],- "additionalProperties": False,- },- },- "required": ["type", "config"],- "additionalProperties": False,- },- {- "type": "object",- "properties": {- "type": {"type": "string", "const": "webhook"},- "config": {- "type": "object",- "properties": {- "path": {"type": "string"},- },- "required": ["path"],- "additionalProperties": False,- },- "auth": _AUTH_CONFIG_JSON_SCHEMA,- },- "required": ["type", "config", "auth"],- "additionalProperties": False,- },- {- "type": "object",- "properties": {- "type": {"type": "string", "const": "cron"},- # Mirror of the node cron config (services/agent-shared- # spec.ts, added by the cron scheduler PR #61028). The- # upstream Django mirror lagged at {schedule, timezone};- # synced here so cron-triggered agents validate.- "config": {- "type": "object",- "properties": {- "name": {"type": "string", "minLength": 1},- "schedule": {"type": "string", "minLength": 1},- "timezone": {"default": "UTC", "type": "string"},- "prompt": {"type": "string", "minLength": 1, "maxLength": 4096},- "external_key": {"type": "string"},- "catch_up": {- "enum": ["all", "most_recent", "skip"],- "default": "most_recent",- },- "max_catch_up_age_seconds": {- "type": "integer",- "minimum": 1,- "maximum": 604800,- "default": 3600,- },- },- "required": ["name", "schedule", "prompt"],- "additionalProperties": False,- },- },- "required": ["type", "config"],- "additionalProperties": False,- },- {- "type": "object",- "properties": {- "type": {"type": "string", "const": "chat"},- "config": {- # Fully-resolved default (not {}): allow_restart has its own- # default, so the generated zod `.default(...)` must carry it or- # the Orval-emitted object fails strict typecheck.- "default": {"allow_restart": False},- "type": "object",- "properties": {"allow_restart": {"default": False, "type": "boolean"}},- "additionalProperties": False,- },- "auth": _AUTH_CONFIG_JSON_SCHEMA,- },- "required": ["type", "auth"],- "additionalProperties": False,- },- {- "type": "object",- "properties": {- "type": {"type": "string", "const": "mcp"},- "config": {- # Fully-resolved default (not {}) — see the chat trigger above.- "default": {"allow_restart": False},- "type": "object",- "properties": {"allow_restart": {"default": False, "type": "boolean"}},- "additionalProperties": False,- },- "auth": _AUTH_CONFIG_JSON_SCHEMA,- },- "required": ["type", "auth"],- "additionalProperties": False,- },- ]- },- },- "tools": {- "default": [],- "type": "array",- "items": {- "oneOf": [- {- # Native + custom tool variants accept the same- # inline approval-gating fields as MCP tool- # entries (below) — see `ToolRefSchema` in- # services/agent-shared/src/spec/spec.ts. Mirror- # any changes there.- "type": "object",- "properties": {- "kind": {"type": "string", "const": "native"},- "id": {"type": "string"},- "requires_approval": {"type": "boolean", "default": False},- "approval_policy": _APPROVAL_POLICY_JSON_SCHEMA,- },- "required": ["kind", "id"],- "additionalProperties": False,- },- {- "type": "object",- "properties": {- "kind": {"type": "string", "const": "custom"},- "id": {"type": "string"},- "path": {"type": "string"},- "requires_approval": {"type": "boolean", "default": False},- "approval_policy": _APPROVAL_POLICY_JSON_SCHEMA,- "requires_identity": {"type": "string"},- },- "required": ["kind", "id", "path"],- "additionalProperties": False,- },- {- # Registry-pinned custom tool — draft-only shape.- # Freeze resolves `from_template` at `version`, writes- # `tools/<alias>/…`, and reshapes this into the- # `custom` variant above before the runner sees it.- "type": "object",- "properties": {- "kind": {"type": "string", "const": "custom_template"},- "from_template": {"type": "string"},- "alias": {"type": "string"},- "version": {"type": "integer", "minimum": 1},- },- "required": ["kind", "from_template", "alias"],- "additionalProperties": False,- },- {- # Client-fulfilled tool — implementation lives in the- # connecting client (browser dock, IDE MCP host), not- # in the runner. See `AgentSpecSchema.tools.client`- # in services/agent-shared/src/spec/spec.ts for the- # full contract + dispatch model.- "type": "object",- "properties": {- "kind": {"type": "string", "const": "client"},- "id": {"type": "string", "minLength": 1},- "description": {"type": "string", "minLength": 1},- "args_schema": {"type": "object", "default": {}},- "required": {"type": "boolean", "default": False},- "timeout_ms": {- "type": "integer",- "minimum": 1,- "maximum": 600000,- "default": 5000,- },- "interactive": {"type": "boolean", "default": False},- },- "required": ["kind", "id", "description"],- "additionalProperties": False,- },- ]- },- },- "mcps": {- "default": [],- "type": "array",- # Single flat shape — third-party MCP server reachable over HTTP.- # The `kind: 'agent'` agent-to-agent variant was removed.- "items": {- "type": "object",- "properties": {- "id": {"type": "string", "minLength": 1},- "url": {"type": "string", "format": "uri"},- "auth": {- "type": "object",- "properties": {- "provider": {"type": "string"},- },- "additionalProperties": False,- },- "secrets": {- "default": [],- "type": "array",- "items": {"type": "string"},- },- # Author-supplied request headers stamped on every outgoing- # MCP request. Values may reference `${NAME}` from- # `secrets[]`; the runner substitutes the plaintext value- # before opening the MCP client. Same substitution shape as- # `@posthog/http-request`'s `headers` — the parallel is- # intentional. Use for the bring-your-own-token case- # (paste a PAT once, reference it as `${TOKEN}` in- # `Authorization: 'Bearer ${TOKEN}'`).- "headers": {- "type": "object",- "additionalProperties": {"type": "string"},- },- # Per-tool selection + approval gating. Bare string- # = inclusion only (was allowlist[] pre-PR-7);- # object form adds requires_approval +- # approval_policy. See `McpToolEntrySchema` in- # services/agent-shared/src/spec/spec.ts.- "tools": {- "type": "array",- "items": {- "oneOf": [- {"type": "string", "minLength": 1},- {- "type": "object",- "properties": {- "name": {"type": "string", "minLength": 1},- "requires_approval": {"type": "boolean", "default": False},- # Same block as the native/custom tool refs — keep in sync.- "approval_policy": _APPROVAL_POLICY_JSON_SCHEMA,- },- "required": ["name"],- "additionalProperties": False,- },- ],- },- },- },- "required": ["id", "url"],- "additionalProperties": False,- },- },- "skills": {- "default": [],- "type": "array",- "items": {- "type": "object",- "properties": {- "id": {"type": "string"},- "path": {"type": "string"},- "description": {"type": "string"},- # Registry lineage for a skill pinned from a template.- # Present on a draft spec; freeze resolves `from_template`,- # assembles `skills/<alias>/SKILL.md`, and stamps id/path +- # `source_version_id`. Allowed here so a forked frozen spec- # (which carries the stamped provenance) round-trips through- # the write path — authors can't set skills[] regardless, the- # serializer pins it to the server value.- "from_template": {"type": "string"},- "alias": {"type": "string"},- "version": {"type": "integer", "minimum": 1},- "source_version_id": {"type": "string"},- },- "required": ["id", "path"],- "additionalProperties": False,- },- },- # Identity providers users can link against. Mirror IdentityProviderConfigSchema- # in services/agent-shared/src/spec/spec.ts.- "identity_providers": {- "default": [],- "type": "array",- "items": {- "oneOf": [- {- "type": "object",- "properties": {- "kind": {"type": "string", "const": "posthog"},- "id": {"type": "string", "minLength": 1, "default": "posthog"},- # `agent` (one app-scoped credential shared by every asker)- # isn't implemented at runtime yet, so it's rejected here- # until it lands — the runtime seam exists, but no spec can- # select it. Keep in lockstep with the zod enum in spec.ts.- "binding": {"type": "string", "enum": ["principal"], "default": "principal"},- "scopes": {"type": "array", "items": {"type": "string"}, "default": []},- # Backend-injected on promote (the provisioned- # OAuthApplication's client_id). Authors never set it.- "client_id": {"type": "string"},- },- "required": ["kind"],- "additionalProperties": False,- },- {- "type": "object",- "properties": {- "kind": {"type": "string", "const": "oauth2"},- "id": {"type": "string", "minLength": 1},- # `agent` (one app-scoped credential shared by every asker)- # isn't implemented at runtime yet, so it's rejected here- # until it lands — the runtime seam exists, but no spec can- # select it. Keep in lockstep with the zod enum in spec.ts.- "binding": {"type": "string", "enum": ["principal"], "default": "principal"},- "authorize_url": {"type": "string", "format": "uri"},- "token_url": {"type": "string", "format": "uri"},- "client_id": {"type": "string", "minLength": 1},- "client_secret_ref": {"type": "string"},- "scopes": {"type": "array", "items": {"type": "string"}, "default": []},- "userinfo_url": {"type": "string", "format": "uri"},- },- "required": ["kind", "id", "authorize_url", "token_url", "client_id"],- "additionalProperties": False,- },- ]- },- },- # Two accepted forms — mirrors `SecretRefSchema` in- # services/agent-shared/src/spec/spec.ts. The bare-string form- # declares a resolvable name without authority to be sent over the- # wire by `@posthog/http-request`; the object form pins the secret- # to a fixed set of hosts (`allowed_hosts`), and only then does the- # runner substitute it into outbound URL/headers/body. Keep this in- # lockstep with the zod schema; the runner is the source of truth.- "secrets": {- "default": [],- "type": "array",- "items": {- "oneOf": [- {"type": "string", "minLength": 1},- {- "type": "object",- "properties": {- "name": {"type": "string", "minLength": 1},- "allowed_hosts": {- "type": "array",- "minItems": 1,- "items": {"type": "string", "minLength": 1},- },- },- "required": ["name", "allowed_hosts"],- "additionalProperties": False,- },- ],- },- },- "limits": {- "default": {- "max_turns": 50,- "max_tool_calls": 200,- "max_wall_seconds": 900,- "max_memory_mb": 512,- "max_cpu_cores": 0.25,- },- "type": "object",- "properties": {- "max_turns": {"default": 50, "type": "integer", "exclusiveMinimum": 0, "maximum": 9007199254740991},- "max_tool_calls": {- "default": 200,- "type": "integer",- "exclusiveMinimum": 0,- "maximum": 9007199254740991,- },- "max_wall_seconds": {- "default": 900,- "type": "integer",- "exclusiveMinimum": 0,- "maximum": 9007199254740991,- },- "max_output_tokens": {- "type": "integer",- "exclusiveMinimum": 0,- "maximum": 200000,- },- "max_memory_mb": {- "default": 512,- "type": "integer",- "exclusiveMinimum": 0,- "maximum": 16384,- },- "max_cpu_cores": {"default": 0.25, "type": "number", "exclusiveMinimum": 0, "maximum": 8},- },- "required": ["max_turns", "max_tool_calls", "max_wall_seconds", "max_memory_mb", "max_cpu_cores"],- "additionalProperties": False,- },- "reasoning": {"type": "string", "enum": ["minimal", "low", "medium", "high", "xhigh"]},- "framework_prompt": {- "type": "object",- "properties": {- "omit": {- "default": [],- "type": "array",- "items": {- "type": "string",- "enum": [- "meta_tool_guidance",- "state_contract",- "tool_failure_guidance",- "approval_guidance",- "reasoning_hint",- ],- },- },- "version_pin": {"type": "integer", "exclusiveMinimum": 0, "maximum": 9007199254740991},- },- "required": ["omit"],- "additionalProperties": False,- },- "resume": {- "type": "object",- "properties": {- "enabled": {"default": False, "type": "boolean"},- "max_completed_age_ms": {- "default": 604800000,- "type": "integer",- "exclusiveMinimum": 0,- "maximum": 9007199254740991,- },- },- "required": ["enabled", "max_completed_age_ms"],- "additionalProperties": False,- },- },- # Structural required list (the RAW schema). Every entry here has a- # `default`, so `_relax_required_for_defaults` drops all of them from- # `AGENT_SPEC_JSON_SCHEMA_FOR_WRITE` — the schema authoring/validation- # actually runs against (serializers.validate_spec). So a spec may omit- # any of these, incl. `models`: the runner falls back to auto/medium.- # The old top-level `model` field is gone entirely; `models` replaces it.- # Mirror `AgentSpecSchema` in services/agent-shared/src/spec/spec.ts.- "required": [- "models",- "triggers",- "tools",- "mcps",- "skills",- "secrets",- "limits",- ],- "additionalProperties": False,-}---def _relax_required_for_defaults(schema: dict[str, Any]) -> dict[str, Any]:- """Recursively strip `required` entries whose property schema has a default.-- Mirrors zod's `.default()` semantics: a field with a default is optional- at parse time. JSON Schema's `required` doesn't infer this from `default`,- so we transform it here. The walk covers every object node reachable via- `properties`, `items`, `oneOf`/`anyOf`/`allOf`, `additionalProperties`,- and `propertyNames` — i.e. every nested schema zod emits, including the- discriminated trigger union (`triggers[].config.mention_only`,- `triggers[].config.timezone`, …).- """- out = copy.deepcopy(schema)- _relax_node(out)- return out---def _relax_node(node: Any) -> None:- if not isinstance(node, dict):- return-- # Strip required entries whose property is defaulted.- props = node.get("properties")- required = node.get("required")- if isinstance(props, dict) and isinstance(required, list):- node["required"] = [r for r in required if not (isinstance(props.get(r), dict) and "default" in props[r])]-- # Recurse through every schema-bearing child.- if isinstance(props, dict):- for v in props.values():- _relax_node(v)- items = node.get("items")- if isinstance(items, dict):- _relax_node(items)- elif isinstance(items, list):- for v in items:- _relax_node(v)- for key in ("oneOf", "anyOf", "allOf"):- sub = node.get(key)- if isinstance(sub, list):- for v in sub:- _relax_node(v)- add_props = node.get("additionalProperties")- if isinstance(add_props, dict):- _relax_node(add_props)- prop_names = node.get("propertyNames")- if isinstance(prop_names, dict):- _relax_node(prop_names)---AGENT_SPEC_JSON_SCHEMA: dict[str, Any] = _AGENT_SPEC_JSON_SCHEMA_RAW-AGENT_SPEC_JSON_SCHEMA_FOR_WRITE: dict[str, Any] = _relax_required_for_defaults(_AGENT_SPEC_JSON_SCHEMA_RAW)--# ── Per-trigger-type required secrets ──────────────────────────────────────## Mirrors `services/agent-shared/src/spec/trigger-secrets.ts` for thediff --git a/products/agent_platform/backend/presentation/serializers.py b/products/agent_platform/backend/presentation/serializers.pyindex 42a8117c2f3b..72fd7e588268 100644--- a/products/agent_platform/backend/presentation/serializers.py+++ b/products/agent_platform/backend/presentation/serializers.py@@ -8,6 +8,7 @@ deferred to the eventual MCP redesign (see TODO B5 in agent-shared).from __future__ import annotations+import jsonimport stringimport secretsfrom typing import Any@@ -16,13 +17,11 @@ from django.conf import settingsfrom django.core.validators import RegexValidatorfrom django.db import IntegrityError-import jsonschemafrom drf_spectacular.utils import extend_schema_fieldfrom rest_framework import serializersfrom posthog.models import User-from ..logic.spec_schema import AGENT_SPEC_JSON_SCHEMA, AGENT_SPEC_JSON_SCHEMA_FOR_WRITEfrom ..models import AgentApplication, AgentRevision# Opaque random slug: leading letter (DNS-label-safe) + lowercase alphanumerics.@@ -243,12 +242,27 @@ def _slack_path_url(slug: str, suffix: str) -> str | None:return agent_ingress_route_url(slug, f"/slack/{suffix}")-@extend_schema_field(AGENT_SPEC_JSON_SCHEMA)class AgentSpecField(serializers.JSONField):- """Spec JSON typed against `AGENT_SPEC_JSON_SCHEMA` so drf-spectacular- publishes the real shape downstream — generated TS types, MCP tool- descriptions, and the OpenAPI doc all see real fields instead of an- opaque `{}`."""+ """The agent spec JSON. Opaque to OpenAPI on purpose: the authoritative,+ richly-described shape is served live by the `agent-applications-spec-schema`+ tool, emitted from the canonical zod `AgentSpecSchema`. We deliberately do+ not carry a second hand-maintained JSON Schema here just to annotate the+ field — that mirror was the source of the drift this endpoint removed."""++ def to_internal_value(self, data: Any) -> Any:+ # The MCP write tools expose `spec` as an opaque arg, so an authoring+ # model sometimes sends the whole spec as a stringified JSON blob rather+ # than an object. Stored verbatim it's the characters of a string, which+ # the janitor rejects (`invalid_request`). Parse it back to an object so+ # it stores structured; reject a string that isn't a JSON object.+ if isinstance(data, str):+ try:+ data = json.loads(data)+ except json.JSONDecodeError:+ raise serializers.ValidationError("spec must be a JSON object, not a string.")+ if not isinstance(data, dict):+ raise serializers.ValidationError("spec must be a JSON object.")+ return super().to_internal_value(data)# Bound the number of skill references on a revision so freeze (one store fetch +@@ -333,14 +347,11 @@ class AgentRevisionSerializer(serializers.ModelSerializer):if isinstance(value, dict):existing = getattr(self.instance, "spec", None)value["skills"] = existing.get("skills", []) if isinstance(existing, dict) else []- # Same shape the janitor's `AgentSpecSchema.parse` will reject on- # read. Catching it here turns a future 500 / process-level surprise- # into a clean 400 at write time.- try:- jsonschema.validate(value, AGENT_SPEC_JSON_SCHEMA_FOR_WRITE)- except jsonschema.ValidationError as e:- path = ".".join(str(p) for p in e.absolute_path) or "<root>"- raise serializers.ValidationError(f"spec.{path}: {e.message}") from e+ # Structural validation against the spec schema is the janitor's job (the+ # zod `AgentSpecSchema`): the explicit `validate` action, freeze, and the+ # runner all parse against it. There is no Python schema mirror to check+ # here — keeping one in lockstep with zod was the drift this removed. We+ # still enforce the cross-field invariant the serializer owns._validate_mcp_tool_names_unique(value)return valuediff --git a/products/agent_platform/backend/presentation/views.py b/products/agent_platform/backend/presentation/views.pyindex 6f15ab0e2a48..e5f126bcd214 100644--- a/products/agent_platform/backend/presentation/views.py+++ b/products/agent_platform/backend/presentation/views.py@@ -192,6 +192,22 @@ class JanitorUpstreamError(APIException):if parts:joined = "; ".join(parts)msg = f"{msg}: {joined}" if isinstance(msg, str) else joined+ # Zod-validation rejects (typed-bundle PUTs: spec/agent_md/skill_refs/+ # tools) -> issues=[{message, path:[...]}] with `error=invalid_request`.+ # Surface `message [path]` so the caller sees the offending field, not+ # just the opaque code.+ issues = e.body.get("issues")+ if isinstance(issues, list) and issues:+ issue_parts: list[str] = []+ for iss in issues:+ if not isinstance(iss, dict) or not isinstance(iss.get("message"), str):+ continue+ path = iss.get("path")+ loc = ".".join(str(p) for p in path) if isinstance(path, list) and path else ""+ issue_parts.append(f"{iss['message']} [{loc}]" if loc else iss["message"])+ if issue_parts:+ joined = "; ".join(issue_parts)+ msg = f"{msg}: {joined}" if isinstance(msg, str) else joineddetail_str: str = msg if isinstance(msg, str) else json.dumps(e.body)elif isinstance(e.body, str):detail_str = e.body@@ -592,6 +608,7 @@ class AgentApplicationViewSet(TeamAndOrgViewSetMixin, viewsets.ModelViewSet):"list","retrieve","models",+ "spec_schema","sessions_list","sessions_retrieve","session_logs",@@ -994,6 +1011,47 @@ class AgentApplicationViewSet(TeamAndOrgViewSetMixin, viewsets.ModelViewSet):raise JanitorUpstreamError(e) from ereturn Response(payload)+ @extend_schema(+ operation_id="agent_applications_spec_schema",+ parameters=[+ OpenApiParameter(+ "section",+ OpenApiTypes.STR,+ OpenApiParameter.QUERY,+ required=False,+ description=(+ "Return only this top-level slice of the spec schema to save tokens — one of "+ "`models`, `triggers`, `tools`, `mcps`, `skills`, `identity_providers`, `secrets`, "+ "`limits`, `reasoning`, `framework_prompt`, `resume`. Omit for the whole spec schema."+ ),+ ),+ ],+ description=(+ "The canonical JSON Schema for an agent `spec` — every field, type, enum, default, and the "+ "discriminated unions for `models` / `triggers[]` / `tools[]`, each with an inline description. "+ "Emitted from the same source the runner validates against (fields with a default are optional "+ "on write), so read it BEFORE composing a spec for create / revisions-spec-update instead of "+ "guessing the shape. Pass `section` to fetch just one part."+ ),+ )+ @action(detail=False, methods=["get"], url_path="spec_schema")+ def spec_schema(self, request: Request, **kwargs) -> Response:+ """The agent-spec JSON Schema, proxied from the janitor, which emits it+ from the canonical zod `AgentSpecSchema` (no Python mirror — the schema+ an author reads can't drift from the one the runner parses). Optional+ `section` slices one top-level property."""+ section = request.query_params.get("section") or None+ try:+ payload = _janitor().get_spec_schema(section=section)+ except JanitorClientError as e:+ # A bad `section` is a client error — the janitor returns 400 with the+ # valid section list. Surface that as a clean 400, not a 502.+ if e.status_code == status.HTTP_400_BAD_REQUEST:+ body = e.body if isinstance(e.body, dict) else {"detail": e.message}+ return Response(body, status=status.HTTP_400_BAD_REQUEST)+ raise JanitorUpstreamError(e) from e+ return Response(payload)+@extend_schema(operation_id="agent_applications_sessions_list",parameters=[diff --git a/products/agent_platform/backend/tests/test_spec_schema.py b/products/agent_platform/backend/tests/test_spec_schema.pyindex aea30c07663a..8a0272533707 100644--- a/products/agent_platform/backend/tests/test_spec_schema.py+++ b/products/agent_platform/backend/tests/test_spec_schema.py@@ -1,38 +1,25 @@"""-Sanity tests for `validate_spec` on AgentRevisionSerializer.--The JSON Schema in `spec_schema.py` is a hand-copied snapshot of the zod-`AgentSpecSchema`. These tests cover the cases that matter for the-authoring flow — known-bad specs that should be rejected before they hit-the DB, and the minimal valid spec that should pass.--Drift against zod is checked the next time someone touches the spec, not-on every test run — the cost of a more aggressive check isn't worth it-for a small surface that moves rarely.+Tests for `AgentRevisionSerializer.validate_spec` + the trigger-secrets helper.++Structural spec validation is the janitor's job now (the zod `AgentSpecSchema`,+parsed at the explicit `validate` action, at freeze, and by the runner) — Django+no longer carries a JSON Schema mirror, so there are no shape-rejection cases+here. What `validate_spec` still owns is the cross-field MCP-tool-name+uniqueness check (which JSON Schema can't express across the string/object+union) and pinning server-derived `skills`. We also cover `missing_required_secrets`."""from __future__ import annotations-import json-from pathlib import Path-import pytest-import jsonschemafrom rest_framework.exceptions import ValidationError-from ..logic.spec_schema import (- AGENT_SPEC_JSON_SCHEMA_FOR_WRITE,- SLACK_BOT_TOKEN_KEY,- SLACK_SIGNING_SECRET_KEY,- missing_required_secrets,-)-from ..presentation.serializers import AgentRevisionSerializer+from ..logic.spec_schema import SLACK_BOT_TOKEN_KEY, SLACK_SIGNING_SECRET_KEY, missing_required_secrets+from ..presentation.serializers import AgentRevisionSerializer, AgentSpecField-# Auth is per-trigger now (no top-level spec.auth). These fixtures focus on-# other fields, so give every declarative trigger a minimal public auth block-# rather than repeat it in each case. Public exposure carries the explicit ack-# field per AuthModeSchema in services/agent-shared/src/spec/spec.ts.+# Declarative triggers carry a per-trigger auth block; give them a minimal+# public one so these fixtures can focus on the field under test._PUBLIC_AUTH = {"modes": [{"type": "public", "acknowledge_public_exposure": True}]}@@ -52,72 +39,10 @@ def _with_auth(spec: dict) -> dict:@pytest.mark.parametrize(("name", "spec"),[- ("minimal", {}),- # `model` is optional — auto/medium is the runner's default, so a spec- # may omit it entirely.- ("no_model", {}),- # models auto: level + default; `model` can be dropped.- ("models_auto", {"models": {"mode": "auto", "level": "high"}}),- # auto omitting level (defaulted to medium) + per-policy reasoning.- ("models_auto_defaults", {"models": {"mode": "auto", "reasoning": "high"}}),- # models manual: provider-diverse priority list, per-entry reasoning.+ ("empty", {}),+ # Unique MCP tool names (bare string + object form) — accepted.(- "models_manual",- {- "models": {- "mode": "manual",- "models": [- {"model": "anthropic/claude-sonnet-4-6", "reasoning": "high"},- {"model": "openai/gpt-5"},- ],- }- },- ),- (- "with_chat_trigger",- {- "triggers": [{"type": "chat", "config": {}}],- },- ),- (- "kitchen_sink",- {- "triggers": [- {"type": "chat", "config": {}},- {"type": "webhook", "config": {"path": "/hook"}},- ],- "tools": [{"kind": "native", "id": "@posthog/query"}],- "skills": [{"id": "research", "path": "skills/research.md"}],- },- ),- # Nested defaults must mirror zod: omitting fields with defaults at- # any depth is fine. These were the rough edges I hit when I first- # tried to spec the slack / cron triggers — both have config fields- # with `.default(...)` in zod that the JSON Schema lists as required.- (- "slack_omits_mention_only",- {- "triggers": [{"type": "slack", "config": {"trusted_workspaces": "*"}}],- },- ),- (- "cron_omits_timezone",- {- "triggers": [- {"type": "cron", "config": {"name": "hourly", "schedule": "0 * * * *", "prompt": "run it"}}- ],- },- ),- (- "mcp_omits_config",- {- "triggers": [{"type": "mcp", "config": {}}],- },- ),- # External MCP ref with a mix of bare-string and object tool entries,- # all distinct names — accepted.- (- "external_mcp_unique_tools",+ "unique_mcp_tools",{"mcps": [{@@ -128,176 +53,30 @@ def _with_auth(spec: dict) -> dict:],},),- # BYO bearer token: author drops a PAT into spec.secrets, references- # it from mcps[].headers. Mirrors @posthog/http-request's shape; the- # runner walks `headers` and substitutes `${NAME}` at session start.- (- "external_mcp_byo_headers_with_secret",- {- "secrets": ["GITHUB_TOKEN"],- "mcps": [- {- "id": "github",- "url": "https://api.githubcopilot.com/mcp",- "secrets": ["GITHUB_TOKEN"],- "headers": {- "Authorization": "Bearer ${GITHUB_TOKEN}",- "X-GitHub-Api-Version": "2022-11-28",- },- }- ],- },- ),- # Registry-pin shapes the freeze pipeline resolves: a skill carrying- # `from_template` + `alias` (+ optional `version`) alongside the- # runtime id/path, and a `custom_template` tool ref. Before these- # were added to the schema, authoring either was rejected.- (- "skill_from_template",- {- "skills": [- {- "id": "research",- "path": "skills/research/SKILL.md",- "from_template": "019e7fb7-f4c0-75e2-9055-7c29a5cbb923",- "alias": "research",- "version": 3,- }- ],- },- ),- (- "custom_template_tool",- {- "tools": [- {- "kind": "custom_template",- "from_template": "019e7fb7-f4c0-75e2-9055-7c29a5cbb924",- "alias": "stripe_lookup",- "version": 4,- }- ],- },- ),- # max_output_tokens is optional; runner picks a reasoning-aware default.- (- "limits_max_output_tokens",- {"limits": {"max_output_tokens": 16384}},- ),- # Bare-string secrets keep parsing (back-compat path); the runtime- # http-request refuses to substitute them, but the spec itself is- # still valid.- (- "secrets_bare_string",- {"secrets": ["GITHUB_TOKEN"]},- ),- # Object-form secret with allowed_hosts — the egress-binding shape.- (- "secrets_with_allowed_hosts",- {"secrets": [{"name": "GH_PAT", "allowed_hosts": ["api.github.com"]}]},- ),- # Mixed bare + object forms in the same spec — common during migration.- (- "secrets_mixed_forms",- {- "secrets": ["LEGACY", {"name": "GH_PAT", "allowed_hosts": ["api.github.com", "*.github.com"]}],- },- ),- # identity_providers: the per-asker `principal` binding is accepted (the- # only one implemented at runtime). `client_id` is backend-injected on- # promote, so authors may omit it.- (- "identity_provider_principal_binding",- {- "models": {"mode": "auto", "level": "low"},- "identity_providers": [{"kind": "posthog", "binding": "principal"}],- },- ),],)-def test_validate_spec_accepts_valid_payloads(name: str, spec: dict) -> None:+def test_validate_spec_accepts(name: str, spec: dict) -> None:+ # validate_spec no longer does structural schema validation (that runs+ # node-side); it should accept any spec whose MCP tool names are unique.AgentRevisionSerializer().validate_spec(_with_auth(spec))@pytest.mark.parametrize(- ("name", "spec", "expected_substring"),+ ("name", "spec"),[- # A spec that looks like an application row (name/description) instead- # of a runtime config. `model` is optional now, so the rejection is on- # the stray top-level `name` key (additionalProperties: false), not a- # missing model.- ("app_row_shaped", {"name": "Hedgebox Helper"}, "name"),- # `model` is optional, but when present must be a non-empty string. zod- # uses min(1); JSON Schema mirrors that via minLength.- # models is a discriminated union on `mode`; an unknown mode- # matches neither auto nor manual arm.- ("models_bad_mode", {"models": {"mode": "cheapest"}}, "models"),- # manual mode requires a non-empty `models` list.- ("models_manual_empty", {"models": {"mode": "manual", "models": []}}, "models"),- # Manual model ids MUST be `<provider>/<model-id>` — bare ids freeze- # fine but the gateway 400s on first session. Pattern enforced here so- # the author gets the error at authoring time.- (- "models_manual_bare_id",- {"models": {"mode": "manual", "models": [{"model": "claude-haiku-4-5"}]}},- "models",- ),- (- "models_manual_uppercase_provider",- {"models": {"mode": "manual", "models": [{"model": "Anthropic/claude-haiku-4-5"}]}},- "models",- ),- (- "models_manual_missing_model_id",- {"models": {"mode": "manual", "models": [{"model": "anthropic/"}]}},- "models",- ),- # `triggers` must be an array if present, not a string.- ("triggers_wrong_type", {"triggers": "all"}, "triggers"),- # Discriminated union: an unknown trigger type doesn't match any of- # the chat/slack/webhook/cron/mcp variants.+ # Bare-string duplicate.(- "unknown_trigger_type",- {"triggers": [{"type": "carrier_pigeon", "config": {}}]},- "triggers",- ),- # Top-level `additionalProperties: false` should reject extra keys —- # exactly the `name` / `description` case I tripped earlier.- ("extra_top_level_key", {"description": "agent"}, "description"),- # Non-defaulted nested fields must still be rejected when missing —- # the relaxation only removes required-with-defaults, not all required.- # jsonschema's `oneOf` error doesn't surface which arm failed for what- # reason; we just assert the trigger element itself is flagged.- (- "slack_missing_trusted_workspaces",- {"triggers": [{"type": "slack", "config": {"mention_only": False}}]},- "triggers.0",- ),- (- "cron_missing_schedule",- {"triggers": [{"type": "cron", "config": {"timezone": "UTC"}}]},- "triggers.0",- ),- # Duplicate tool names in `mcps[].external.tools[]` — JSON Schema can't- # express this across the string/object union, so the Python-level- # check mirrors the zod `.refine()`. Bare-string vs bare-string.- (- "external_mcp_duplicate_tool_strings",+ "duplicate_tool_strings",{"mcps": [- {- "id": "linear",- "url": "https://mcp.linear.app/sse",- "tools": ["create-issue", "create-issue"],- }+ {"id": "linear", "url": "https://mcp.linear.app/sse", "tools": ["create-issue", "create-issue"]}],},- "unique names",),# Bare-string colliding with an object of the same name — the case- # JSON Schema's `uniqueItems` would miss entirely.+ # JSON Schema's uniqueItems would miss; the serializer enforces it.(- "external_mcp_duplicate_tool_string_and_object",+ "duplicate_tool_string_and_object",{"mcps": [{@@ -307,56 +86,13 @@ def test_validate_spec_accepts_valid_payloads(name: str, spec: dict) -> None:}],},- "unique names",- ),- # The exact drift that poisoned the cron sweep: a cron trigger without- # the now-required `prompt` (or `name`). The node schema rejects these- # at freeze; the Django mirror must reject them at write so a poisoned- # spec never reaches the DB in the first place.- (- "cron_missing_prompt",- {"triggers": [{"type": "cron", "config": {"name": "sweep", "schedule": "0 9 * * *"}}]},- "triggers.0",- ),- (- "cron_missing_name",- {"triggers": [{"type": "cron", "config": {"schedule": "0 9 * * *", "prompt": "go"}}]},- "triggers.0",- ),- # spec.secrets[] object form must declare allowed_hosts. An object- # without it is rejected so a half-migrated entry can't quietly- # behave as "name only, no binding" — the bare-string form is the- # explicit way to say that.- (- "secrets_object_missing_allowed_hosts",- {"secrets": [{"name": "GH_PAT"}]},- "secrets",- ),- # An empty allowed_hosts means "bound to nothing" — not what an- # author meant. Force them to either pin a host or drop to the- # bare-string form.- (- "secrets_empty_allowed_hosts",- {"secrets": [{"name": "GH_PAT", "allowed_hosts": []}]},- "secrets",- ),- # identity_providers: the `agent` binding (one app-scoped credential- # shared by every asker) isn't implemented at runtime yet, so the schema- # rejects it until it lands — kept in lockstep with the zod enum.- (- "identity_provider_agent_binding_rejected",- {- "models": {"mode": "auto", "level": "low"},- "identity_providers": [{"kind": "posthog", "binding": "agent"}],- },- "identity_providers",),],)-def test_validate_spec_rejects_invalid_payloads(name: str, spec: dict, expected_substring: str) -> None:+def test_validate_spec_rejects_duplicate_mcp_tool_names(name: str, spec: dict) -> None:with pytest.raises(ValidationError) as exc_info:AgentRevisionSerializer().validate_spec(_with_auth(spec))- assert expected_substring in str(exc_info.value)+ assert "unique names" in str(exc_info.value)_SLACK_SPEC = {@@ -391,16 +127,22 @@ def test_missing_required_secrets_skips_triggers_without_requirements() -> None:assert missing_required_secrets(spec, {}) == []-# Every shipped example bundle must validate against the write schema exactly-# as authored. This is the guard against the drift class that bit us: a field-# added to the zod schema (e.g. `allow_direct_messages`, `resume`) but not-# mirrored here would let an example carry it while the platform silently-# rejects/drops it. The example seeder no longer maintains its own allowlist —-# this schema is the single gate — so a missing mirror now fails here, loudly.-_EXAMPLES_DIR = Path(__file__).parents[2] / "services" / "agent-tests" / "src" / "examples"-_EXAMPLE_SPECS = sorted(p for p in _EXAMPLES_DIR.glob("*/spec.json"))+# AgentSpecField coerces a stringified-JSON-object spec back to an object. The MCP+# write tools expose `spec` as an opaque arg, so an authoring model sometimes+# passes the whole spec as a JSON string; stored verbatim it's the characters of a+# string and the janitor rejects it (`invalid_request`).+++def test_agent_spec_field_coerces_stringified_object() -> None:+ field = AgentSpecField()+ assert field.to_internal_value('{"models": {"mode": "auto"}}') == {"models": {"mode": "auto"}}+ # A real object passes through untouched.+ assert field.to_internal_value({"models": {"mode": "auto"}}) == {"models": {"mode": "auto"}}[email protected]("spec_file", _EXAMPLE_SPECS, ids=lambda p: p.parent.name)-def test_example_bundles_validate_against_write_schema(spec_file: Path) -> None:- jsonschema.validate(json.loads(spec_file.read_text()), AGENT_SPEC_JSON_SCHEMA_FOR_WRITE)[email protected]("bad", ["not json at all", "[1, 2, 3]", '"a string"', "42"])+def test_agent_spec_field_rejects_non_object_string(bad: str) -> None:+ # Non-JSON, or JSON that isn't an object, is rejected with a clear message+ # rather than stored as a string that later fails freeze.+ with pytest.raises(ValidationError):+ AgentSpecField().to_internal_value(bad)diff --git a/products/agent_platform/frontend/generated/api.schemas.ts b/products/agent_platform/frontend/generated/api.schemas.tsindex 612eabd1563c..e70417606708 100644--- a/products/agent_platform/frontend/generated/api.schemas.ts+++ b/products/agent_platform/frontend/generated/api.schemas.ts@@ -199,28 +199,6 @@ export const AgentRevisionStateEnumApi = {Archived: 'archived',} as const-export type AgentRevisionApiSpecReasoning =- (typeof AgentRevisionApiSpecReasoning)[keyof typeof AgentRevisionApiSpecReasoning]--export const AgentRevisionApiSpecReasoning = {- Minimal: 'minimal',- Low: 'low',- Medium: 'medium',- High: 'high',- Xhigh: 'xhigh',-} as const--export type AgentRevisionApiSpecFrameworkPromptOmitItem =- (typeof AgentRevisionApiSpecFrameworkPromptOmitItem)[keyof typeof AgentRevisionApiSpecFrameworkPromptOmitItem]--export const AgentRevisionApiSpecFrameworkPromptOmitItem = {- MetaToolGuidance: 'meta_tool_guidance',- StateContract: 'state_contract',- ToolFailureGuidance: 'tool_failure_guidance',- ApprovalGuidance: 'approval_guidance',- ReasoningHint: 'reasoning_hint',-} as const-/*** One reference to a versioned skill in the llma-skill store, pinned into* this agent's bundle at freeze.@@ -244,376 +222,6 @@ export interface SkillRefApi {version?: number}-/**- * How this agent selects its model. `auto`: pick a quality/cost `level` and the platform resolves it to a maintained, priority-ordered, cross-provider list at runtime. `manual`: give an explicit priority-ordered `models` list (primary first). `optimize_for` governs how the chosen model is treated across the session's turns.- */-export type AgentRevisionApiSpecModels =- | {- mode: 'auto'- /** Quality/cost tier (auto). low = cheapest, for short, formulaic, no-reasoning jobs (lookups, FAQ bots); medium = balanced default, for multi-step but bounded work; high = top-tier, for long, branching, reasoning-heavy work. Resolved to a priority-ordered cross-provider list at session start. */- level?: 'low' | 'medium' | 'high'- /** Reasoning/thinking effort budget. minimal = no deliberation (fastest, cheapest) … xhigh = maximal (research-grade, ~5-10x the per-turn cost). Omit for the provider/spec default. */- reasoning?: 'minimal' | 'low' | 'medium' | 'high' | 'xhigh'- /** Session model stability vs. resilience. `cost` (default): the first turn picks a working model and PINS it for the whole session — keeps the provider's prompt cache warm (cache reads are ~0.1-0.5x of full input) and never fails over mid-session; if the pinned model is down the turn fails rather than re-reading the whole context cold on another provider. `availability`: fail over to the next model when the session's model fails — survives an outage at the cost of a one-time cold re-read. Prefer `cost` for long/expensive sessions, `availability` where uptime matters more than spend. */- optimize_for?: 'cost' | 'availability'- }- | {- mode: 'manual'- /**- * Explicit priority-ordered fallback list — the runner tries entries in order (primary first).- * @minItems 1- */- models: {- /**- * Canonical model id, e.g. `anthropic/claude-sonnet-4-6` (see the agent-applications-models tool for served ids).- * @minLength 1- * @pattern ^[a-z0-9_-]+/[a-zA-Z0-9._:-]+$- */- model: string- /** Per-model reasoning effort override (else the spec default). */- reasoning?: 'minimal' | 'low' | 'medium' | 'high' | 'xhigh'- }[]- /** Session model stability vs. resilience. `cost` (default): pin the first working model for the whole session (warm prompt cache, no mid-session failover). `availability`: fail over down this list when the session's model fails (survives outages, re-reads context cold). */- optimize_for?: 'cost' | 'availability'- }--export type AgentRevisionApiSpecTriggersItem =- | {- type: 'slack'- config: {- channel_id?: string- mention_only: boolean- auto_resume_threads: boolean- allow_workspace_participants: boolean- ack_reaction?: string- allow_direct_messages: boolean- trusted_workspaces: string[] | '*'- }- }- | {- type: 'webhook'- config: {- path: string- }- auth: {- modes?: (- | {- type: 'public'- acknowledge_public_exposure: true- }- | {- type: 'posthog'- scopes?: string[]- audience?: 'project' | 'organization'- }- | {- type: 'jwt'- /** @minLength 1 */- issuer_secret_ref: string- }- | {- type: 'shared_secret'- /** @minLength 1 */- header: string- /** @minLength 1 */- secret_ref: string- }- | {- type: 'posthog_internal'- }- )[]- }- }- | {- type: 'cron'- config: {- /** @minLength 1 */- name: string- /** @minLength 1 */- schedule: string- timezone?: string- /**- * @minLength 1- * @maxLength 4096- */- prompt: string- external_key?: string- catch_up?: 'all' | 'most_recent' | 'skip'- /**- * @minimum 1- * @maximum 604800- */- max_catch_up_age_seconds?: number- }- }- | {- type: 'chat'- config?: {- allow_restart?: boolean- }- auth: {- modes?: (- | {- type: 'public'- acknowledge_public_exposure: true- }- | {- type: 'posthog'- scopes?: string[]- audience?: 'project' | 'organization'- }- | {- type: 'jwt'- /** @minLength 1 */- issuer_secret_ref: string- }- | {- type: 'shared_secret'- /** @minLength 1 */- header: string- /** @minLength 1 */- secret_ref: string- }- | {- type: 'posthog_internal'- }- )[]- }- }- | {- type: 'mcp'- config?: {- allow_restart?: boolean- }- auth: {- modes?: (- | {- type: 'public'- acknowledge_public_exposure: true- }- | {- type: 'posthog'- scopes?: string[]- audience?: 'project' | 'organization'- }- | {- type: 'jwt'- /** @minLength 1 */- issuer_secret_ref: string- }- | {- type: 'shared_secret'- /** @minLength 1 */- header: string- /** @minLength 1 */- secret_ref: string- }- | {- type: 'posthog_internal'- }- )[]- }- }--export type AgentRevisionApiSpecToolsItem =- | {- kind: 'native'- id: string- requires_approval?: boolean- approval_policy?: {- type?: 'principal' | 'agent'- allow_edit?: boolean- /**- * @minimum 60000- * @maximum 604800000- */- ttl_ms?: number- }- }- | {- kind: 'custom'- id: string- path: string- requires_approval?: boolean- approval_policy?: {- type?: 'principal' | 'agent'- allow_edit?: boolean- /**- * @minimum 60000- * @maximum 604800000- */- ttl_ms?: number- }- requires_identity?: string- }- | {- kind: 'custom_template'- from_template: string- alias: string- /** @minimum 1 */- version?: number- }- | {- kind: 'client'- /** @minLength 1 */- id: string- /** @minLength 1 */- description: string- args_schema?: { [key: string]: unknown }- required?: boolean- /**- * @minimum 1- * @maximum 600000- */- timeout_ms?: number- interactive?: boolean- }--export type AgentRevisionApiSpecMcpsItemAuth = {- provider?: string-}--export type AgentRevisionApiSpecMcpsItemHeaders = { [key: string]: string }--export type AgentRevisionApiSpecMcpsItemToolsItem =- | string- | {- /** @minLength 1 */- name: string- requires_approval?: boolean- approval_policy?: {- type?: 'principal' | 'agent'- allow_edit?: boolean- /**- * @minimum 60000- * @maximum 604800000- */- ttl_ms?: number- }- }--export type AgentRevisionApiSpecMcpsItem = {- /** @minLength 1 */- id: string- url: string- auth?: AgentRevisionApiSpecMcpsItemAuth- secrets?: string[]- headers?: AgentRevisionApiSpecMcpsItemHeaders- tools?: AgentRevisionApiSpecMcpsItemToolsItem[]-}--export type AgentRevisionApiSpecSkillsItem = {- id: string- path: string- description?: string- from_template?: string- alias?: string- /** @minimum 1 */- version?: number- source_version_id?: string-}--export type AgentRevisionApiSpecIdentityProvidersItem =- | {- kind: 'posthog'- /** @minLength 1 */- id?: string- binding?: 'principal'- scopes?: string[]- client_id?: string- }- | {- kind: 'oauth2'- /** @minLength 1 */- id: string- binding?: 'principal'- authorize_url: string- token_url: string- /** @minLength 1 */- client_id: string- client_secret_ref?: string- scopes?: string[]- userinfo_url?: string- }--export type AgentRevisionApiSpecSecretsItem =- | string- | {- /** @minLength 1 */- name: string- /**- * @minItems 1- * @items.minLength 1- */- allowed_hosts: string[]- }--export type AgentRevisionApiSpecLimits = {- /**- * @maximum 2147483647- * @exclusiveMinimum 0- */- max_turns: number- /**- * @maximum 2147483647- * @exclusiveMinimum 0- */- max_tool_calls: number- /**- * @maximum 2147483647- * @exclusiveMinimum 0- */- max_wall_seconds: number- /**- * @maximum 200000- * @exclusiveMinimum 0- */- max_output_tokens?: number- /**- * @maximum 16384- * @exclusiveMinimum 0- */- max_memory_mb: number- /**- * @maximum 8- * @exclusiveMinimum 0- */- max_cpu_cores: number-}--export type AgentRevisionApiSpecFrameworkPrompt = {- omit: AgentRevisionApiSpecFrameworkPromptOmitItem[]- /**- * @maximum 2147483647- * @exclusiveMinimum 0- */- version_pin?: number-}--export type AgentRevisionApiSpecResume = {- enabled: boolean- /**- * @maximum 2147483647- * @exclusiveMinimum 0- */- max_completed_age_ms: number-}--export type AgentRevisionApiSpec = {- /** How this agent selects its model. `auto`: pick a quality/cost `level` and the platform resolves it to a maintained, priority-ordered, cross-provider list at runtime. `manual`: give an explicit priority-ordered `models` list (primary first). `optimize_for` governs how the chosen model is treated across the session's turns. */- models: AgentRevisionApiSpecModels- triggers: AgentRevisionApiSpecTriggersItem[]- tools: AgentRevisionApiSpecToolsItem[]- mcps: AgentRevisionApiSpecMcpsItem[]- skills: AgentRevisionApiSpecSkillsItem[]- identity_providers?: AgentRevisionApiSpecIdentityProvidersItem[]- secrets: AgentRevisionApiSpecSecretsItem[]- limits: AgentRevisionApiSpecLimits- reasoning?: AgentRevisionApiSpecReasoning- framework_prompt?: AgentRevisionApiSpecFrameworkPrompt- resume?: AgentRevisionApiSpecResume-}-/*** Resolved creator (id, first_name, email) from `created_by_id`, or null if unset or the user was deleted.* @nullable@@ -634,7 +242,7 @@ export interface AgentRevisionApi {bundle_uri?: string/** @nullable */readonly bundle_sha256: string | null- spec?: AgentRevisionApiSpec+ spec?: unknown/** Store-skill references for this draft, set via the `skill_refs` action and resolved into the bundle at freeze. Preserved as the authoring record on the frozen revision (and carried forward when forking a new draft); resolved provenance is stamped onto `spec.skills[].source_version_id`. */readonly skill_refs: readonly SkillRefApi[]/** @nullable */@@ -657,398 +265,6 @@ export interface PaginatedAgentRevisionListApi {results: AgentRevisionApi[]}-/**- * How this agent selects its model. `auto`: pick a quality/cost `level` and the platform resolves it to a maintained, priority-ordered, cross-provider list at runtime. `manual`: give an explicit priority-ordered `models` list (primary first). `optimize_for` governs how the chosen model is treated across the session's turns.- */-export type PatchedAgentRevisionApiSpecModels =- | {- mode: 'auto'- /** Quality/cost tier (auto). low = cheapest, for short, formulaic, no-reasoning jobs (lookups, FAQ bots); medium = balanced default, for multi-step but bounded work; high = top-tier, for long, branching, reasoning-heavy work. Resolved to a priority-ordered cross-provider list at session start. */- level?: 'low' | 'medium' | 'high'- /** Reasoning/thinking effort budget. minimal = no deliberation (fastest, cheapest) … xhigh = maximal (research-grade, ~5-10x the per-turn cost). Omit for the provider/spec default. */- reasoning?: 'minimal' | 'low' | 'medium' | 'high' | 'xhigh'- /** Session model stability vs. resilience. `cost` (default): the first turn picks a working model and PINS it for the whole session — keeps the provider's prompt cache warm (cache reads are ~0.1-0.5x of full input) and never fails over mid-session; if the pinned model is down the turn fails rather than re-reading the whole context cold on another provider. `availability`: fail over to the next model when the session's model fails — survives an outage at the cost of a one-time cold re-read. Prefer `cost` for long/expensive sessions, `availability` where uptime matters more than spend. */- optimize_for?: 'cost' | 'availability'- }- | {- mode: 'manual'- /**- * Explicit priority-ordered fallback list — the runner tries entries in order (primary first).- * @minItems 1- */- models: {- /**- * Canonical model id, e.g. `anthropic/claude-sonnet-4-6` (see the agent-applications-models tool for served ids).- * @minLength 1- * @pattern ^[a-z0-9_-]+/[a-zA-Z0-9._:-]+$- */- model: string- /** Per-model reasoning effort override (else the spec default). */- reasoning?: 'minimal' | 'low' | 'medium' | 'high' | 'xhigh'- }[]- /** Session model stability vs. resilience. `cost` (default): pin the first working model for the whole session (warm prompt cache, no mid-session failover). `availability`: fail over down this list when the session's model fails (survives outages, re-reads context cold). */- optimize_for?: 'cost' | 'availability'- }--export type PatchedAgentRevisionApiSpecTriggersItem =- | {- type: 'slack'- config: {- channel_id?: string- mention_only: boolean- auto_resume_threads: boolean- allow_workspace_participants: boolean- ack_reaction?: string- allow_direct_messages: boolean- trusted_workspaces: string[] | '*'- }- }- | {- type: 'webhook'- config: {- path: string- }- auth: {- modes?: (- | {- type: 'public'- acknowledge_public_exposure: true- }- | {- type: 'posthog'- scopes?: string[]- audience?: 'project' | 'organization'- }- | {- type: 'jwt'- /** @minLength 1 */- issuer_secret_ref: string- }- | {- type: 'shared_secret'- /** @minLength 1 */- header: string- /** @minLength 1 */- secret_ref: string- }- | {- type: 'posthog_internal'- }- )[]- }- }- | {- type: 'cron'- config: {- /** @minLength 1 */- name: string- /** @minLength 1 */- schedule: string- timezone?: string- /**- * @minLength 1- * @maxLength 4096- */- prompt: string- external_key?: string- catch_up?: 'all' | 'most_recent' | 'skip'- /**- * @minimum 1- * @maximum 604800- */- max_catch_up_age_seconds?: number- }- }- | {- type: 'chat'- config?: {- allow_restart?: boolean- }- auth: {- modes?: (- | {- type: 'public'- acknowledge_public_exposure: true- }- | {- type: 'posthog'- scopes?: string[]- audience?: 'project' | 'organization'- }- | {- type: 'jwt'- /** @minLength 1 */- issuer_secret_ref: string- }- | {- type: 'shared_secret'- /** @minLength 1 */- header: string- /** @minLength 1 */- secret_ref: string- }- | {- type: 'posthog_internal'- }- )[]- }- }- | {- type: 'mcp'- config?: {- allow_restart?: boolean- }- auth: {- modes?: (- | {- type: 'public'- acknowledge_public_exposure: true- }- | {- type: 'posthog'- scopes?: string[]- audience?: 'project' | 'organization'- }- | {- type: 'jwt'- /** @minLength 1 */- issuer_secret_ref: string- }- | {- type: 'shared_secret'- /** @minLength 1 */- header: string- /** @minLength 1 */- secret_ref: string- }- | {- type: 'posthog_internal'- }- )[]- }- }--export type PatchedAgentRevisionApiSpecToolsItem =- | {- kind: 'native'- id: string- requires_approval?: boolean- approval_policy?: {- type?: 'principal' | 'agent'- allow_edit?: boolean- /**- * @minimum 60000- * @maximum 604800000- */- ttl_ms?: number- }- }- | {- kind: 'custom'- id: string- path: string- requires_approval?: boolean- approval_policy?: {- type?: 'principal' | 'agent'- allow_edit?: boolean- /**- * @minimum 60000- * @maximum 604800000- */- ttl_ms?: number- }- requires_identity?: string- }- | {- kind: 'custom_template'- from_template: string- alias: string- /** @minimum 1 */- version?: number- }- | {- kind: 'client'- /** @minLength 1 */- id: string- /** @minLength 1 */- description: string- args_schema?: { [key: string]: unknown }- required?: boolean- /**- * @minimum 1- * @maximum 600000- */- timeout_ms?: number- interactive?: boolean- }--export type PatchedAgentRevisionApiSpecMcpsItemAuth = {- provider?: string-}--export type PatchedAgentRevisionApiSpecMcpsItemHeaders = { [key: string]: string }--export type PatchedAgentRevisionApiSpecMcpsItemToolsItem =- | string- | {- /** @minLength 1 */- name: string- requires_approval?: boolean- approval_policy?: {- type?: 'principal' | 'agent'- allow_edit?: boolean- /**- * @minimum 60000- * @maximum 604800000- */- ttl_ms?: number- }- }--export type PatchedAgentRevisionApiSpecMcpsItem = {- /** @minLength 1 */- id: string- url: string- auth?: PatchedAgentRevisionApiSpecMcpsItemAuth- secrets?: string[]- headers?: PatchedAgentRevisionApiSpecMcpsItemHeaders- tools?: PatchedAgentRevisionApiSpecMcpsItemToolsItem[]-}--export type PatchedAgentRevisionApiSpecSkillsItem = {- id: string- path: string- description?: string- from_template?: string- alias?: string- /** @minimum 1 */- version?: number- source_version_id?: string-}--export type PatchedAgentRevisionApiSpecIdentityProvidersItem =- | {- kind: 'posthog'- /** @minLength 1 */- id?: string- binding?: 'principal'- scopes?: string[]- client_id?: string- }- | {- kind: 'oauth2'- /** @minLength 1 */- id: string- binding?: 'principal'- authorize_url: string- token_url: string- /** @minLength 1 */- client_id: string- client_secret_ref?: string- scopes?: string[]- userinfo_url?: string- }--export type PatchedAgentRevisionApiSpecSecretsItem =- | string- | {- /** @minLength 1 */- name: string- /**- * @minItems 1- * @items.minLength 1- */- allowed_hosts: string[]- }--export type PatchedAgentRevisionApiSpecLimits = {- /**- * @maximum 2147483647- * @exclusiveMinimum 0- */- max_turns: number- /**- * @maximum 2147483647- * @exclusiveMinimum 0- */- max_tool_calls: number- /**- * @maximum 2147483647- * @exclusiveMinimum 0- */- max_wall_seconds: number- /**- * @maximum 200000- * @exclusiveMinimum 0- */- max_output_tokens?: number- /**- * @maximum 16384- * @exclusiveMinimum 0- */- max_memory_mb: number- /**- * @maximum 8- * @exclusiveMinimum 0- */- max_cpu_cores: number-}--export type PatchedAgentRevisionApiSpecReasoning =- (typeof PatchedAgentRevisionApiSpecReasoning)[keyof typeof PatchedAgentRevisionApiSpecReasoning]--export const PatchedAgentRevisionApiSpecReasoning = {- Minimal: 'minimal',- Low: 'low',- Medium: 'medium',- High: 'high',- Xhigh: 'xhigh',-} as const--export type PatchedAgentRevisionApiSpecFrameworkPromptOmitItem =- (typeof PatchedAgentRevisionApiSpecFrameworkPromptOmitItem)[keyof typeof PatchedAgentRevisionApiSpecFrameworkPromptOmitItem]--export const PatchedAgentRevisionApiSpecFrameworkPromptOmitItem = {- MetaToolGuidance: 'meta_tool_guidance',- StateContract: 'state_contract',- ToolFailureGuidance: 'tool_failure_guidance',- ApprovalGuidance: 'approval_guidance',- ReasoningHint: 'reasoning_hint',-} as const--export type PatchedAgentRevisionApiSpecFrameworkPrompt = {- omit: PatchedAgentRevisionApiSpecFrameworkPromptOmitItem[]- /**- * @maximum 2147483647- * @exclusiveMinimum 0- */- version_pin?: number-}--export type PatchedAgentRevisionApiSpecResume = {- enabled: boolean- /**- * @maximum 2147483647- * @exclusiveMinimum 0- */- max_completed_age_ms: number-}--export type PatchedAgentRevisionApiSpec = {- /** How this agent selects its model. `auto`: pick a quality/cost `level` and the platform resolves it to a maintained, priority-ordered, cross-provider list at runtime. `manual`: give an explicit priority-ordered `models` list (primary first). `optimize_for` governs how the chosen model is treated across the session's turns. */- models: PatchedAgentRevisionApiSpecModels- triggers: PatchedAgentRevisionApiSpecTriggersItem[]- tools: PatchedAgentRevisionApiSpecToolsItem[]- mcps: PatchedAgentRevisionApiSpecMcpsItem[]- skills: PatchedAgentRevisionApiSpecSkillsItem[]- identity_providers?: PatchedAgentRevisionApiSpecIdentityProvidersItem[]- secrets: PatchedAgentRevisionApiSpecSecretsItem[]- limits: PatchedAgentRevisionApiSpecLimits- reasoning?: PatchedAgentRevisionApiSpecReasoning- framework_prompt?: PatchedAgentRevisionApiSpecFrameworkPrompt- resume?: PatchedAgentRevisionApiSpecResume-}-/*** Resolved creator (id, first_name, email) from `created_by_id`, or null if unset or the user was deleted.* @nullable@@ -1069,7 +285,7 @@ export interface PatchedAgentRevisionApi {bundle_uri?: string/** @nullable */readonly bundle_sha256?: string | null- spec?: PatchedAgentRevisionApiSpec+ spec?: unknown/** Store-skill references for this draft, set via the `skill_refs` action and resolved into the bundle at freeze. Preserved as the authoring record on the frozen revision (and carried forward when forking a new draft); resolved provenance is stamped onto `spec.skills[].source_version_id`. */readonly skill_refs?: readonly SkillRefApi[]/** @nullable */@@ -2034,6 +1250,13 @@ export type AgentApplicationsStatsParams = {since?: string}+export type AgentApplicationsSpecSchemaParams = {+ /**+ * Return only this top-level slice of the spec schema to save tokens — one of `models`, `triggers`, `tools`, `mcps`, `skills`, `identity_providers`, `secrets`, `limits`, `reasoning`, `framework_prompt`, `resume`. Omit for the whole spec schema.+ */+ section?: string+}+export type AgentFleetApprovalsListParams = {/*** Optional agent UUID — narrows the listing to one application.diff --git a/products/agent_platform/frontend/generated/api.ts b/products/agent_platform/frontend/generated/api.tsindex 56458afcc9d5..896c87dc2c43 100644--- a/products/agent_platform/frontend/generated/api.ts+++ b/products/agent_platform/frontend/generated/api.ts@@ -26,6 +26,7 @@ import type {AgentApplicationsSessionLogsParams,AgentApplicationsSessionsListParams,AgentApplicationsSessionsRetrieveParams,+ AgentApplicationsSpecSchemaParams,AgentApplicationsStatsParams,AgentApprovalsDecideResponseApi,AgentFleetApprovalsListParams,@@ -1985,6 +1986,36 @@ export const agentApplicationsModels = async (})}+export const getAgentApplicationsSpecSchemaUrl = (projectId: string, params?: AgentApplicationsSpecSchemaParams) => {+ const normalizedParams = new URLSearchParams()++ Object.entries(params || {}).forEach(([key, value]) => {+ if (value !== undefined) {+ normalizedParams.append(key, value === null ? 'null' : String(value))+ }+ })++ const stringifiedParams = normalizedParams.toString()++ return stringifiedParams.length > 0+ ? `/api/projects/${projectId}/agent_applications/spec_schema/?${stringifiedParams}`+ : `/api/projects/${projectId}/agent_applications/spec_schema/`+}++/**+ * The canonical JSON Schema for an agent `spec` — every field, type, enum, default, and the discriminated unions for `models` / `triggers[]` / `tools[]`, each with an inline description. Emitted from the same source the runner validates against (fields with a default are optional on write), so read it BEFORE composing a spec for create / revisions-spec-update instead of guessing the shape. Pass `section` to fetch just one part.+ */+export const agentApplicationsSpecSchema = async (+ projectId: string,+ params?: AgentApplicationsSpecSchemaParams,+ options?: RequestInit+): Promise<AgentApplicationApi> => {+ return apiMutator<AgentApplicationApi>(getAgentApplicationsSpecSchemaUrl(projectId, params), {+ ...options,+ method: 'GET',+ })+}+export const getAgentFleetApprovalsListUrl = (projectId: string, params?: AgentFleetApprovalsListParams) => {const normalizedParams = new URLSearchParams()diff --git a/products/agent_platform/frontend/generated/api.zod.ts b/products/agent_platform/frontend/generated/api.zod.tsindex d7b09ec7375a..f761744382df 100644--- a/products/agent_platform/frontend/generated/api.zod.ts+++ b/products/agent_platform/frontend/generated/api.zod.ts@@ -105,123 +105,6 @@ export const AgentMemoryUpdateFileBody = /* @__PURE__ */ zod* PUT .../revisions/<id>/bundle/ bulk push (replace|merge)*/export const agentApplicationsRevisionsCreateBodyBundleUriDefault = ``-export const agentApplicationsRevisionsCreateBodySpecModelsOneLevelDefault = `medium`-export const agentApplicationsRevisionsCreateBodySpecModelsOneOptimizeForDefault = `cost`--export const agentApplicationsRevisionsCreateBodySpecModelsTwoModelsItemModelRegExp = new RegExp(- '^[a-z0-9_-]+\/[a-zA-Z0-9._:-]+$'-)--export const agentApplicationsRevisionsCreateBodySpecModelsTwoOptimizeForDefault = `cost`-export const agentApplicationsRevisionsCreateBodySpecModelsDefault = {- mode: 'auto' as const,- level: 'medium' as const,- optimize_for: 'cost' as const,-}-export const agentApplicationsRevisionsCreateBodySpecTriggersItemOneConfigMentionOnlyDefault = false-export const agentApplicationsRevisionsCreateBodySpecTriggersItemOneConfigAutoResumeThreadsDefault = false-export const agentApplicationsRevisionsCreateBodySpecTriggersItemOneConfigAllowWorkspaceParticipantsDefault = false-export const agentApplicationsRevisionsCreateBodySpecTriggersItemOneConfigAllowDirectMessagesDefault = false-export const agentApplicationsRevisionsCreateBodySpecTriggersItemTwoAuthModesItemTwoScopesDefault = []-export const agentApplicationsRevisionsCreateBodySpecTriggersItemTwoAuthModesItemTwoAudienceDefault = `project`--export const agentApplicationsRevisionsCreateBodySpecTriggersItemThreeConfigTimezoneDefault = `UTC`-export const agentApplicationsRevisionsCreateBodySpecTriggersItemThreeConfigPromptMax = 4096--export const agentApplicationsRevisionsCreateBodySpecTriggersItemThreeConfigCatchUpDefault = `most_recent`-export const agentApplicationsRevisionsCreateBodySpecTriggersItemThreeConfigMaxCatchUpAgeSecondsDefault = 3600-export const agentApplicationsRevisionsCreateBodySpecTriggersItemThreeConfigMaxCatchUpAgeSecondsMax = 604800--export const agentApplicationsRevisionsCreateBodySpecTriggersItemFourConfigAllowRestartDefault = false-export const agentApplicationsRevisionsCreateBodySpecTriggersItemFourConfigDefault = { allow_restart: false }-export const agentApplicationsRevisionsCreateBodySpecTriggersItemFourAuthModesItemTwoScopesDefault = []-export const agentApplicationsRevisionsCreateBodySpecTriggersItemFourAuthModesItemTwoAudienceDefault = `project`--export const agentApplicationsRevisionsCreateBodySpecTriggersItemFiveConfigAllowRestartDefault = false-export const agentApplicationsRevisionsCreateBodySpecTriggersItemFiveConfigDefault = { allow_restart: false }-export const agentApplicationsRevisionsCreateBodySpecTriggersItemFiveAuthModesItemTwoScopesDefault = []-export const agentApplicationsRevisionsCreateBodySpecTriggersItemFiveAuthModesItemTwoAudienceDefault = `project`--export const agentApplicationsRevisionsCreateBodySpecTriggersDefault = []-export const agentApplicationsRevisionsCreateBodySpecToolsItemOneRequiresApprovalDefault = false-export const agentApplicationsRevisionsCreateBodySpecToolsItemOneApprovalPolicyTypeDefault = `principal`-export const agentApplicationsRevisionsCreateBodySpecToolsItemOneApprovalPolicyAllowEditDefault = false-export const agentApplicationsRevisionsCreateBodySpecToolsItemOneApprovalPolicyTtlMsDefault = 86400000-export const agentApplicationsRevisionsCreateBodySpecToolsItemOneApprovalPolicyTtlMsMin = 60000-export const agentApplicationsRevisionsCreateBodySpecToolsItemOneApprovalPolicyTtlMsMax = 604800000--export const agentApplicationsRevisionsCreateBodySpecToolsItemTwoRequiresApprovalDefault = false-export const agentApplicationsRevisionsCreateBodySpecToolsItemTwoApprovalPolicyTypeDefault = `principal`-export const agentApplicationsRevisionsCreateBodySpecToolsItemTwoApprovalPolicyAllowEditDefault = false-export const agentApplicationsRevisionsCreateBodySpecToolsItemTwoApprovalPolicyTtlMsDefault = 86400000-export const agentApplicationsRevisionsCreateBodySpecToolsItemTwoApprovalPolicyTtlMsMin = 60000-export const agentApplicationsRevisionsCreateBodySpecToolsItemTwoApprovalPolicyTtlMsMax = 604800000--export const agentApplicationsRevisionsCreateBodySpecToolsItemFourArgsSchemaDefault = {}-export const agentApplicationsRevisionsCreateBodySpecToolsItemFourRequiredDefault = false-export const agentApplicationsRevisionsCreateBodySpecToolsItemFourTimeoutMsDefault = 5000-export const agentApplicationsRevisionsCreateBodySpecToolsItemFourTimeoutMsMax = 600000--export const agentApplicationsRevisionsCreateBodySpecToolsItemFourInteractiveDefault = false-export const agentApplicationsRevisionsCreateBodySpecToolsDefault = []-export const agentApplicationsRevisionsCreateBodySpecMcpsItemSecretsDefault = []--export const agentApplicationsRevisionsCreateBodySpecMcpsItemToolsItemTwoRequiresApprovalDefault = false-export const agentApplicationsRevisionsCreateBodySpecMcpsItemToolsItemTwoApprovalPolicyTypeDefault = `principal`-export const agentApplicationsRevisionsCreateBodySpecMcpsItemToolsItemTwoApprovalPolicyAllowEditDefault = false-export const agentApplicationsRevisionsCreateBodySpecMcpsItemToolsItemTwoApprovalPolicyTtlMsDefault = 86400000-export const agentApplicationsRevisionsCreateBodySpecMcpsItemToolsItemTwoApprovalPolicyTtlMsMin = 60000-export const agentApplicationsRevisionsCreateBodySpecMcpsItemToolsItemTwoApprovalPolicyTtlMsMax = 604800000--export const agentApplicationsRevisionsCreateBodySpecMcpsDefault = []-export const agentApplicationsRevisionsCreateBodySpecSkillsDefault = []-export const agentApplicationsRevisionsCreateBodySpecIdentityProvidersItemOneIdDefault = `posthog`--export const agentApplicationsRevisionsCreateBodySpecIdentityProvidersItemOneBindingDefault = `principal`-export const agentApplicationsRevisionsCreateBodySpecIdentityProvidersItemOneScopesDefault = []-export const agentApplicationsRevisionsCreateBodySpecIdentityProvidersItemTwoBindingDefault = `principal`-export const agentApplicationsRevisionsCreateBodySpecIdentityProvidersItemTwoScopesDefault = []-export const agentApplicationsRevisionsCreateBodySpecIdentityProvidersDefault = []--export const agentApplicationsRevisionsCreateBodySpecSecretsDefault = []-export const agentApplicationsRevisionsCreateBodySpecLimitsMaxTurnsDefault = 50-export const agentApplicationsRevisionsCreateBodySpecLimitsMaxTurnsExclusiveMin = 0-export const agentApplicationsRevisionsCreateBodySpecLimitsMaxTurnsMax = 2147483647--export const agentApplicationsRevisionsCreateBodySpecLimitsMaxToolCallsDefault = 200-export const agentApplicationsRevisionsCreateBodySpecLimitsMaxToolCallsExclusiveMin = 0-export const agentApplicationsRevisionsCreateBodySpecLimitsMaxToolCallsMax = 2147483647--export const agentApplicationsRevisionsCreateBodySpecLimitsMaxWallSecondsDefault = 900-export const agentApplicationsRevisionsCreateBodySpecLimitsMaxWallSecondsExclusiveMin = 0-export const agentApplicationsRevisionsCreateBodySpecLimitsMaxWallSecondsMax = 2147483647--export const agentApplicationsRevisionsCreateBodySpecLimitsMaxOutputTokensExclusiveMin = 0-export const agentApplicationsRevisionsCreateBodySpecLimitsMaxOutputTokensMax = 200000--export const agentApplicationsRevisionsCreateBodySpecLimitsMaxMemoryMbDefault = 512-export const agentApplicationsRevisionsCreateBodySpecLimitsMaxMemoryMbExclusiveMin = 0-export const agentApplicationsRevisionsCreateBodySpecLimitsMaxMemoryMbMax = 16384--export const agentApplicationsRevisionsCreateBodySpecLimitsMaxCpuCoresDefault = 0.25-export const agentApplicationsRevisionsCreateBodySpecLimitsMaxCpuCoresExclusiveMin = 0-export const agentApplicationsRevisionsCreateBodySpecLimitsMaxCpuCoresMax = 8--export const agentApplicationsRevisionsCreateBodySpecLimitsDefault = {- max_turns: 50,- max_tool_calls: 200,- max_wall_seconds: 900,- max_memory_mb: 512,- max_cpu_cores: 0.25,-}-export const agentApplicationsRevisionsCreateBodySpecFrameworkPromptOmitDefault = []-export const agentApplicationsRevisionsCreateBodySpecFrameworkPromptVersionPinExclusiveMin = 0-export const agentApplicationsRevisionsCreateBodySpecFrameworkPromptVersionPinMax = 2147483647--export const agentApplicationsRevisionsCreateBodySpecResumeEnabledDefault = false-export const agentApplicationsRevisionsCreateBodySpecResumeMaxCompletedAgeMsDefault = 604800000-export const agentApplicationsRevisionsCreateBodySpecResumeMaxCompletedAgeMsExclusiveMin = 0-export const agentApplicationsRevisionsCreateBodySpecResumeMaxCompletedAgeMsMax = 2147483647export const AgentApplicationsRevisionsCreateBody = /* @__PURE__ */ zod.object({parent_revision: zod.uuid().nullish(),@@ -231,547 +114,7 @@ export const AgentApplicationsRevisionsCreateBody = /* @__PURE__ */ zod.object({.describe('Storage-prefix metadata for the bundle, e.g. `fs:\/\/my-agent\/`. Optional — leave blank and the server fills `fs:\/\/<application-slug>\/`. Bundles are addressed by revision id regardless, so this is only a prefix hint.'),- spec: zod- .object({- models: zod- .union([- zod.object({- mode: zod.literal('auto'),- level: zod- .enum(['low', 'medium', 'high'])- .default(agentApplicationsRevisionsCreateBodySpecModelsOneLevelDefault)- .describe(- 'Quality\/cost tier (auto). low = cheapest, for short, formulaic, no-reasoning jobs (lookups, FAQ bots); medium = balanced default, for multi-step but bounded work; high = top-tier, for long, branching, reasoning-heavy work. Resolved to a priority-ordered cross-provider list at session start.'- ),- reasoning: zod- .enum(['minimal', 'low', 'medium', 'high', 'xhigh'])- .optional()- .describe(- 'Reasoning\/thinking effort budget. minimal = no deliberation (fastest, cheapest) … xhigh = maximal (research-grade, ~5-10x the per-turn cost). Omit for the provider\/spec default.'- ),- optimize_for: zod- .enum(['cost', 'availability'])- .default(agentApplicationsRevisionsCreateBodySpecModelsOneOptimizeForDefault)- .describe(- "Session model stability vs. resilience. `cost` (default): the first turn picks a working model and PINS it for the whole session — keeps the provider's prompt cache warm (cache reads are ~0.1-0.5x of full input) and never fails over mid-session; if the pinned model is down the turn fails rather than re-reading the whole context cold on another provider. `availability`: fail over to the next model when the session's model fails — survives an outage at the cost of a one-time cold re-read. Prefer `cost` for long\/expensive sessions, `availability` where uptime matters more than spend."- ),- }),- zod.object({- mode: zod.literal('manual'),- models: zod- .array(- zod.object({- model: zod- .string()- .min(1)- .regex(agentApplicationsRevisionsCreateBodySpecModelsTwoModelsItemModelRegExp)- .describe(- 'Canonical model id, e.g. `anthropic\/claude-sonnet-4-6` (see the agent-applications-models tool for served ids).'- ),- reasoning: zod- .enum(['minimal', 'low', 'medium', 'high', 'xhigh'])- .optional()- .describe('Per-model reasoning effort override (else the spec default).'),- })- )- .min(1)- .describe(- 'Explicit priority-ordered fallback list — the runner tries entries in order (primary first).'- ),- optimize_for: zod- .enum(['cost', 'availability'])- .default(agentApplicationsRevisionsCreateBodySpecModelsTwoOptimizeForDefault)- .describe(- "Session model stability vs. resilience. `cost` (default): pin the first working model for the whole session (warm prompt cache, no mid-session failover). `availability`: fail over down this list when the session's model fails (survives outages, re-reads context cold)."- ),- }),- ])- .default(agentApplicationsRevisionsCreateBodySpecModelsDefault)- .describe(- "How this agent selects its model. `auto`: pick a quality\/cost `level` and the platform resolves it to a maintained, priority-ordered, cross-provider list at runtime. `manual`: give an explicit priority-ordered `models` list (primary first). `optimize_for` governs how the chosen model is treated across the session's turns."- ),- triggers: zod- .array(- zod.union([- zod.object({- type: zod.literal('slack'),- config: zod.object({- channel_id: zod.string().optional(),- mention_only: zod- .boolean()- .default(- agentApplicationsRevisionsCreateBodySpecTriggersItemOneConfigMentionOnlyDefault- ),- auto_resume_threads: zod- .boolean()- .default(- agentApplicationsRevisionsCreateBodySpecTriggersItemOneConfigAutoResumeThreadsDefault- ),- allow_workspace_participants: zod- .boolean()- .default(- agentApplicationsRevisionsCreateBodySpecTriggersItemOneConfigAllowWorkspaceParticipantsDefault- ),- ack_reaction: zod.string().optional(),- allow_direct_messages: zod- .boolean()- .default(- agentApplicationsRevisionsCreateBodySpecTriggersItemOneConfigAllowDirectMessagesDefault- ),- trusted_workspaces: zod.union([zod.array(zod.string()).min(1), zod.literal('*')]),- }),- }),- zod.object({- type: zod.literal('webhook'),- config: zod.object({- path: zod.string(),- }),- auth: zod.object({- modes: zod- .array(- zod.union([- zod.object({- type: zod.literal('public'),- acknowledge_public_exposure: zod.boolean(),- }),- zod.object({- type: zod.literal('posthog'),- scopes: zod- .array(zod.string())- .default(- agentApplicationsRevisionsCreateBodySpecTriggersItemTwoAuthModesItemTwoScopesDefault- ),- audience: zod- .enum(['project', 'organization'])- .default(- agentApplicationsRevisionsCreateBodySpecTriggersItemTwoAuthModesItemTwoAudienceDefault- ),- }),- zod.object({- type: zod.literal('jwt'),- issuer_secret_ref: zod.string().min(1),- }),- zod.object({- type: zod.literal('shared_secret'),- header: zod.string().min(1),- secret_ref: zod.string().min(1),- }),- zod.object({- type: zod.literal('posthog_internal'),- }),- ])- )- .optional(),- }),- }),- zod.object({- type: zod.literal('cron'),- config: zod.object({- name: zod.string().min(1),- schedule: zod.string().min(1),- timezone: zod- .string()- .default(- agentApplicationsRevisionsCreateBodySpecTriggersItemThreeConfigTimezoneDefault- ),- prompt: zod- .string()- .min(1)- .max(agentApplicationsRevisionsCreateBodySpecTriggersItemThreeConfigPromptMax),- external_key: zod.string().optional(),- catch_up: zod- .enum(['all', 'most_recent', 'skip'])- .default(- agentApplicationsRevisionsCreateBodySpecTriggersItemThreeConfigCatchUpDefault- ),- max_catch_up_age_seconds: zod- .number()- .min(1)- .max(- agentApplicationsRevisionsCreateBodySpecTriggersItemThreeConfigMaxCatchUpAgeSecondsMax- )- .default(- agentApplicationsRevisionsCreateBodySpecTriggersItemThreeConfigMaxCatchUpAgeSecondsDefault- ),- }),- }),- zod.object({- type: zod.literal('chat'),- config: zod- .object({- allow_restart: zod- .boolean()- .default(- agentApplicationsRevisionsCreateBodySpecTriggersItemFourConfigAllowRestartDefault- ),- })- .default(agentApplicationsRevisionsCreateBodySpecTriggersItemFourConfigDefault),- auth: zod.object({- modes: zod- .array(- zod.union([- zod.object({- type: zod.literal('public'),- acknowledge_public_exposure: zod.boolean(),- }),- zod.object({- type: zod.literal('posthog'),- scopes: zod- .array(zod.string())- .default(- agentApplicationsRevisionsCreateBodySpecTriggersItemFourAuthModesItemTwoScopesDefault- ),- audience: zod- .enum(['project', 'organization'])- .default(- agentApplicationsRevisionsCreateBodySpecTriggersItemFourAuthModesItemTwoAudienceDefault- ),- }),- zod.object({- type: zod.literal('jwt'),- issuer_secret_ref: zod.string().min(1),- }),- zod.object({- type: zod.literal('shared_secret'),- header: zod.string().min(1),- secret_ref: zod.string().min(1),- }),- zod.object({- type: zod.literal('posthog_internal'),- }),- ])- )- .optional(),- }),- }),- zod.object({- type: zod.literal('mcp'),- config: zod- .object({- allow_restart: zod- .boolean()- .default(- agentApplicationsRevisionsCreateBodySpecTriggersItemFiveConfigAllowRestartDefault- ),- })- .default(agentApplicationsRevisionsCreateBodySpecTriggersItemFiveConfigDefault),- auth: zod.object({- modes: zod- .array(- zod.union([- zod.object({- type: zod.literal('public'),- acknowledge_public_exposure: zod.boolean(),- }),- zod.object({- type: zod.literal('posthog'),- scopes: zod- .array(zod.string())- .default(- agentApplicationsRevisionsCreateBodySpecTriggersItemFiveAuthModesItemTwoScopesDefault- ),- audience: zod- .enum(['project', 'organization'])- .default(- agentApplicationsRevisionsCreateBodySpecTriggersItemFiveAuthModesItemTwoAudienceDefault- ),- }),- zod.object({- type: zod.literal('jwt'),- issuer_secret_ref: zod.string().min(1),- }),- zod.object({- type: zod.literal('shared_secret'),- header: zod.string().min(1),- secret_ref: zod.string().min(1),- }),- zod.object({- type: zod.literal('posthog_internal'),- }),- ])- )- .optional(),- }),- }),- ])- )- .default(agentApplicationsRevisionsCreateBodySpecTriggersDefault),- tools: zod- .array(- zod.union([- zod.object({- kind: zod.literal('native'),- id: zod.string(),- requires_approval: zod- .boolean()- .default(agentApplicationsRevisionsCreateBodySpecToolsItemOneRequiresApprovalDefault),- approval_policy: zod- .object({- type: zod- .enum(['principal', 'agent'])- .default(- agentApplicationsRevisionsCreateBodySpecToolsItemOneApprovalPolicyTypeDefault- ),- allow_edit: zod- .boolean()- .default(- agentApplicationsRevisionsCreateBodySpecToolsItemOneApprovalPolicyAllowEditDefault- ),- ttl_ms: zod- .number()- .min(agentApplicationsRevisionsCreateBodySpecToolsItemOneApprovalPolicyTtlMsMin)- .max(agentApplicationsRevisionsCreateBodySpecToolsItemOneApprovalPolicyTtlMsMax)- .default(- agentApplicationsRevisionsCreateBodySpecToolsItemOneApprovalPolicyTtlMsDefault- ),- })- .optional(),- }),- zod.object({- kind: zod.literal('custom'),- id: zod.string(),- path: zod.string(),- requires_approval: zod- .boolean()- .default(agentApplicationsRevisionsCreateBodySpecToolsItemTwoRequiresApprovalDefault),- approval_policy: zod- .object({- type: zod- .enum(['principal', 'agent'])- .default(- agentApplicationsRevisionsCreateBodySpecToolsItemTwoApprovalPolicyTypeDefault- ),- allow_edit: zod- .boolean()- .default(- agentApplicationsRevisionsCreateBodySpecToolsItemTwoApprovalPolicyAllowEditDefault- ),- ttl_ms: zod- .number()- .min(agentApplicationsRevisionsCreateBodySpecToolsItemTwoApprovalPolicyTtlMsMin)- .max(agentApplicationsRevisionsCreateBodySpecToolsItemTwoApprovalPolicyTtlMsMax)- .default(- agentApplicationsRevisionsCreateBodySpecToolsItemTwoApprovalPolicyTtlMsDefault- ),- })- .optional(),- requires_identity: zod.string().optional(),- }),- zod.object({- kind: zod.literal('custom_template'),- from_template: zod.string(),- alias: zod.string(),- version: zod.number().min(1).optional(),- }),- zod.object({- kind: zod.literal('client'),- id: zod.string().min(1),- description: zod.string().min(1),- args_schema: zod- .looseObject({})- .default(agentApplicationsRevisionsCreateBodySpecToolsItemFourArgsSchemaDefault),- required: zod- .boolean()- .default(agentApplicationsRevisionsCreateBodySpecToolsItemFourRequiredDefault),- timeout_ms: zod- .number()- .min(1)- .max(agentApplicationsRevisionsCreateBodySpecToolsItemFourTimeoutMsMax)- .default(agentApplicationsRevisionsCreateBodySpecToolsItemFourTimeoutMsDefault),- interactive: zod- .boolean()- .default(agentApplicationsRevisionsCreateBodySpecToolsItemFourInteractiveDefault),- }),- ])- )- .default(agentApplicationsRevisionsCreateBodySpecToolsDefault),- mcps: zod- .array(- zod.object({- id: zod.string().min(1),- url: zod.url(),- auth: zod- .object({- provider: zod.string().optional(),- })- .optional(),- secrets: zod- .array(zod.string())- .default(agentApplicationsRevisionsCreateBodySpecMcpsItemSecretsDefault),- headers: zod.record(zod.string(), zod.string()).optional(),- tools: zod- .array(- zod.union([- zod.string().min(1),- zod.object({- name: zod.string().min(1),- requires_approval: zod- .boolean()- .default(- agentApplicationsRevisionsCreateBodySpecMcpsItemToolsItemTwoRequiresApprovalDefault- ),- approval_policy: zod- .object({- type: zod- .enum(['principal', 'agent'])- .default(- agentApplicationsRevisionsCreateBodySpecMcpsItemToolsItemTwoApprovalPolicyTypeDefault- ),- allow_edit: zod- .boolean()- .default(- agentApplicationsRevisionsCreateBodySpecMcpsItemToolsItemTwoApprovalPolicyAllowEditDefault- ),- ttl_ms: zod- .number()- .min(- agentApplicationsRevisionsCreateBodySpecMcpsItemToolsItemTwoApprovalPolicyTtlMsMin- )- .max(- agentApplicationsRevisionsCreateBodySpecMcpsItemToolsItemTwoApprovalPolicyTtlMsMax- )- .default(- agentApplicationsRevisionsCreateBodySpecMcpsItemToolsItemTwoApprovalPolicyTtlMsDefault- ),- })- .optional(),- }),- ])- )- .optional(),- })- )- .default(agentApplicationsRevisionsCreateBodySpecMcpsDefault),- skills: zod- .array(- zod.object({- id: zod.string(),- path: zod.string(),- description: zod.string().optional(),- from_template: zod.string().optional(),- alias: zod.string().optional(),- version: zod.number().min(1).optional(),- source_version_id: zod.string().optional(),- })- )- .default(agentApplicationsRevisionsCreateBodySpecSkillsDefault),- identity_providers: zod- .array(- zod.union([- zod.object({- kind: zod.literal('posthog'),- id: zod- .string()- .min(1)- .default(agentApplicationsRevisionsCreateBodySpecIdentityProvidersItemOneIdDefault),- binding: zod- .enum(['principal'])- .default(- agentApplicationsRevisionsCreateBodySpecIdentityProvidersItemOneBindingDefault- ),- scopes: zod- .array(zod.string())- .default(agentApplicationsRevisionsCreateBodySpecIdentityProvidersItemOneScopesDefault),- client_id: zod.string().optional(),- }),- zod.object({- kind: zod.literal('oauth2'),- id: zod.string().min(1),- binding: zod- .enum(['principal'])- .default(- agentApplicationsRevisionsCreateBodySpecIdentityProvidersItemTwoBindingDefault- ),- authorize_url: zod.url(),- token_url: zod.url(),- client_id: zod.string().min(1),- client_secret_ref: zod.string().optional(),- scopes: zod- .array(zod.string())- .default(agentApplicationsRevisionsCreateBodySpecIdentityProvidersItemTwoScopesDefault),- userinfo_url: zod.url().optional(),- }),- ])- )- .default(agentApplicationsRevisionsCreateBodySpecIdentityProvidersDefault),- secrets: zod- .array(- zod.union([- zod.string().min(1),- zod.object({- name: zod.string().min(1),- allowed_hosts: zod.array(zod.string().min(1)).min(1),- }),- ])- )- .default(agentApplicationsRevisionsCreateBodySpecSecretsDefault),- limits: zod- .object({- max_turns: zod- .number()- .gt(agentApplicationsRevisionsCreateBodySpecLimitsMaxTurnsExclusiveMin)- .max(agentApplicationsRevisionsCreateBodySpecLimitsMaxTurnsMax)- .default(agentApplicationsRevisionsCreateBodySpecLimitsMaxTurnsDefault),- max_tool_calls: zod- .number()- .gt(agentApplicationsRevisionsCreateBodySpecLimitsMaxToolCallsExclusiveMin)- .max(agentApplicationsRevisionsCreateBodySpecLimitsMaxToolCallsMax)- .default(agentApplicationsRevisionsCreateBodySpecLimitsMaxToolCallsDefault),- max_wall_seconds: zod- .number()- .gt(agentApplicationsRevisionsCreateBodySpecLimitsMaxWallSecondsExclusiveMin)- .max(agentApplicationsRevisionsCreateBodySpecLimitsMaxWallSecondsMax)- .default(agentApplicationsRevisionsCreateBodySpecLimitsMaxWallSecondsDefault),- max_output_tokens: zod- .number()- .gt(agentApplicationsRevisionsCreateBodySpecLimitsMaxOutputTokensExclusiveMin)- .max(agentApplicationsRevisionsCreateBodySpecLimitsMaxOutputTokensMax)- .optional(),- max_memory_mb: zod- .number()- .gt(agentApplicationsRevisionsCreateBodySpecLimitsMaxMemoryMbExclusiveMin)- .max(agentApplicationsRevisionsCreateBodySpecLimitsMaxMemoryMbMax)- .default(agentApplicationsRevisionsCreateBodySpecLimitsMaxMemoryMbDefault),- max_cpu_cores: zod- .number()- .gt(agentApplicationsRevisionsCreateBodySpecLimitsMaxCpuCoresExclusiveMin)- .max(agentApplicationsRevisionsCreateBodySpecLimitsMaxCpuCoresMax)- .default(agentApplicationsRevisionsCreateBodySpecLimitsMaxCpuCoresDefault),- })- .default(agentApplicationsRevisionsCreateBodySpecLimitsDefault),- reasoning: zod.enum(['minimal', 'low', 'medium', 'high', 'xhigh']).optional(),- framework_prompt: zod- .object({- omit: zod- .array(- zod.enum([- 'meta_tool_guidance',- 'state_contract',- 'tool_failure_guidance',- 'approval_guidance',- 'reasoning_hint',- ])- )- .default(agentApplicationsRevisionsCreateBodySpecFrameworkPromptOmitDefault),- version_pin: zod- .number()- .gt(agentApplicationsRevisionsCreateBodySpecFrameworkPromptVersionPinExclusiveMin)- .max(agentApplicationsRevisionsCreateBodySpecFrameworkPromptVersionPinMax)- .optional(),- })- .optional(),- resume: zod- .object({- enabled: zod.boolean().default(agentApplicationsRevisionsCreateBodySpecResumeEnabledDefault),- max_completed_age_ms: zod- .number()- .gt(agentApplicationsRevisionsCreateBodySpecResumeMaxCompletedAgeMsExclusiveMin)- .max(agentApplicationsRevisionsCreateBodySpecResumeMaxCompletedAgeMsMax)- .default(agentApplicationsRevisionsCreateBodySpecResumeMaxCompletedAgeMsDefault),- })- .optional(),- })- .optional(),+ spec: zod.unknown().optional(),})/**@@ -779,123 +122,6 @@ export const AgentApplicationsRevisionsCreateBody = /* @__PURE__ */ zod.object({* ready/live the spec is frozen — change requires a new revision.*/export const agentApplicationsRevisionsUpdateBodyBundleUriDefault = ``-export const agentApplicationsRevisionsUpdateBodySpecModelsOneLevelDefault = `medium`-export const agentApplicationsRevisionsUpdateBodySpecModelsOneOptimizeForDefault = `cost`--export const agentApplicationsRevisionsUpdateBodySpecModelsTwoModelsItemModelRegExp = new RegExp(- '^[a-z0-9_-]+\/[a-zA-Z0-9._:-]+$'-)--export const agentApplicationsRevisionsUpdateBodySpecModelsTwoOptimizeForDefault = `cost`-export const agentApplicationsRevisionsUpdateBodySpecModelsDefault = {- mode: 'auto' as const,- level: 'medium' as const,- optimize_for: 'cost' as const,-}-export const agentApplicationsRevisionsUpdateBodySpecTriggersItemOneConfigMentionOnlyDefault = false-export const agentApplicationsRevisionsUpdateBodySpecTriggersItemOneConfigAutoResumeThreadsDefault = false-export const agentApplicationsRevisionsUpdateBodySpecTriggersItemOneConfigAllowWorkspaceParticipantsDefault = false-export const agentApplicationsRevisionsUpdateBodySpecTriggersItemOneConfigAllowDirectMessagesDefault = false-export const agentApplicationsRevisionsUpdateBodySpecTriggersItemTwoAuthModesItemTwoScopesDefault = []-export const agentApplicationsRevisionsUpdateBodySpecTriggersItemTwoAuthModesItemTwoAudienceDefault = `project`--export const agentApplicationsRevisionsUpdateBodySpecTriggersItemThreeConfigTimezoneDefault = `UTC`-export const agentApplicationsRevisionsUpdateBodySpecTriggersItemThreeConfigPromptMax = 4096--export const agentApplicationsRevisionsUpdateBodySpecTriggersItemThreeConfigCatchUpDefault = `most_recent`-export const agentApplicationsRevisionsUpdateBodySpecTriggersItemThreeConfigMaxCatchUpAgeSecondsDefault = 3600-export const agentApplicationsRevisionsUpdateBodySpecTriggersItemThreeConfigMaxCatchUpAgeSecondsMax = 604800--export const agentApplicationsRevisionsUpdateBodySpecTriggersItemFourConfigAllowRestartDefault = false-export const agentApplicationsRevisionsUpdateBodySpecTriggersItemFourConfigDefault = { allow_restart: false }-export const agentApplicationsRevisionsUpdateBodySpecTriggersItemFourAuthModesItemTwoScopesDefault = []-export const agentApplicationsRevisionsUpdateBodySpecTriggersItemFourAuthModesItemTwoAudienceDefault = `project`--export const agentApplicationsRevisionsUpdateBodySpecTriggersItemFiveConfigAllowRestartDefault = false-export const agentApplicationsRevisionsUpdateBodySpecTriggersItemFiveConfigDefault = { allow_restart: false }-export const agentApplicationsRevisionsUpdateBodySpecTriggersItemFiveAuthModesItemTwoScopesDefault = []-export const agentApplicationsRevisionsUpdateBodySpecTriggersItemFiveAuthModesItemTwoAudienceDefault = `project`--export const agentApplicationsRevisionsUpdateBodySpecTriggersDefault = []-export const agentApplicationsRevisionsUpdateBodySpecToolsItemOneRequiresApprovalDefault = false-export const agentApplicationsRevisionsUpdateBodySpecToolsItemOneApprovalPolicyTypeDefault = `principal`-export const agentApplicationsRevisionsUpdateBodySpecToolsItemOneApprovalPolicyAllowEditDefault = false-export const agentApplicationsRevisionsUpdateBodySpecToolsItemOneApprovalPolicyTtlMsDefault = 86400000-export const agentApplicationsRevisionsUpdateBodySpecToolsItemOneApprovalPolicyTtlMsMin = 60000-export const agentApplicationsRevisionsUpdateBodySpecToolsItemOneApprovalPolicyTtlMsMax = 604800000--export const agentApplicationsRevisionsUpdateBodySpecToolsItemTwoRequiresApprovalDefault = false-export const agentApplicationsRevisionsUpdateBodySpecToolsItemTwoApprovalPolicyTypeDefault = `principal`-export const agentApplicationsRevisionsUpdateBodySpecToolsItemTwoApprovalPolicyAllowEditDefault = false-export const agentApplicationsRevisionsUpdateBodySpecToolsItemTwoApprovalPolicyTtlMsDefault = 86400000-export const agentApplicationsRevisionsUpdateBodySpecToolsItemTwoApprovalPolicyTtlMsMin = 60000-export const agentApplicationsRevisionsUpdateBodySpecToolsItemTwoApprovalPolicyTtlMsMax = 604800000--export const agentApplicationsRevisionsUpdateBodySpecToolsItemFourArgsSchemaDefault = {}-export const agentApplicationsRevisionsUpdateBodySpecToolsItemFourRequiredDefault = false-export const agentApplicationsRevisionsUpdateBodySpecToolsItemFourTimeoutMsDefault = 5000-export const agentApplicationsRevisionsUpdateBodySpecToolsItemFourTimeoutMsMax = 600000--export const agentApplicationsRevisionsUpdateBodySpecToolsItemFourInteractiveDefault = false-export const agentApplicationsRevisionsUpdateBodySpecToolsDefault = []-export const agentApplicationsRevisionsUpdateBodySpecMcpsItemSecretsDefault = []--export const agentApplicationsRevisionsUpdateBodySpecMcpsItemToolsItemTwoRequiresApprovalDefault = false-export const agentApplicationsRevisionsUpdateBodySpecMcpsItemToolsItemTwoApprovalPolicyTypeDefault = `principal`-export const agentApplicationsRevisionsUpdateBodySpecMcpsItemToolsItemTwoApprovalPolicyAllowEditDefault = false-export const agentApplicationsRevisionsUpdateBodySpecMcpsItemToolsItemTwoApprovalPolicyTtlMsDefault = 86400000-export const agentApplicationsRevisionsUpdateBodySpecMcpsItemToolsItemTwoApprovalPolicyTtlMsMin = 60000-export const agentApplicationsRevisionsUpdateBodySpecMcpsItemToolsItemTwoApprovalPolicyTtlMsMax = 604800000--export const agentApplicationsRevisionsUpdateBodySpecMcpsDefault = []-export const agentApplicationsRevisionsUpdateBodySpecSkillsDefault = []-export const agentApplicationsRevisionsUpdateBodySpecIdentityProvidersItemOneIdDefault = `posthog`--export const agentApplicationsRevisionsUpdateBodySpecIdentityProvidersItemOneBindingDefault = `principal`-export const agentApplicationsRevisionsUpdateBodySpecIdentityProvidersItemOneScopesDefault = []-export const agentApplicationsRevisionsUpdateBodySpecIdentityProvidersItemTwoBindingDefault = `principal`-export const agentApplicationsRevisionsUpdateBodySpecIdentityProvidersItemTwoScopesDefault = []-export const agentApplicationsRevisionsUpdateBodySpecIdentityProvidersDefault = []--export const agentApplicationsRevisionsUpdateBodySpecSecretsDefault = []-export const agentApplicationsRevisionsUpdateBodySpecLimitsMaxTurnsDefault = 50-export const agentApplicationsRevisionsUpdateBodySpecLimitsMaxTurnsExclusiveMin = 0-export const agentApplicationsRevisionsUpdateBodySpecLimitsMaxTurnsMax = 2147483647--export const agentApplicationsRevisionsUpdateBodySpecLimitsMaxToolCallsDefault = 200-export const agentApplicationsRevisionsUpdateBodySpecLimitsMaxToolCallsExclusiveMin = 0-export const agentApplicationsRevisionsUpdateBodySpecLimitsMaxToolCallsMax = 2147483647--export const agentApplicationsRevisionsUpdateBodySpecLimitsMaxWallSecondsDefault = 900-export const agentApplicationsRevisionsUpdateBodySpecLimitsMaxWallSecondsExclusiveMin = 0-export const agentApplicationsRevisionsUpdateBodySpecLimitsMaxWallSecondsMax = 2147483647--export const agentApplicationsRevisionsUpdateBodySpecLimitsMaxOutputTokensExclusiveMin = 0-export const agentApplicationsRevisionsUpdateBodySpecLimitsMaxOutputTokensMax = 200000--export const agentApplicationsRevisionsUpdateBodySpecLimitsMaxMemoryMbDefault = 512-export const agentApplicationsRevisionsUpdateBodySpecLimitsMaxMemoryMbExclusiveMin = 0-export const agentApplicationsRevisionsUpdateBodySpecLimitsMaxMemoryMbMax = 16384--export const agentApplicationsRevisionsUpdateBodySpecLimitsMaxCpuCoresDefault = 0.25-export const agentApplicationsRevisionsUpdateBodySpecLimitsMaxCpuCoresExclusiveMin = 0-export const agentApplicationsRevisionsUpdateBodySpecLimitsMaxCpuCoresMax = 8--export const agentApplicationsRevisionsUpdateBodySpecLimitsDefault = {- max_turns: 50,- max_tool_calls: 200,- max_wall_seconds: 900,- max_memory_mb: 512,- max_cpu_cores: 0.25,-}-export const agentApplicationsRevisionsUpdateBodySpecFrameworkPromptOmitDefault = []-export const agentApplicationsRevisionsUpdateBodySpecFrameworkPromptVersionPinExclusiveMin = 0-export const agentApplicationsRevisionsUpdateBodySpecFrameworkPromptVersionPinMax = 2147483647--export const agentApplicationsRevisionsUpdateBodySpecResumeEnabledDefault = false-export const agentApplicationsRevisionsUpdateBodySpecResumeMaxCompletedAgeMsDefault = 604800000-export const agentApplicationsRevisionsUpdateBodySpecResumeMaxCompletedAgeMsExclusiveMin = 0-export const agentApplicationsRevisionsUpdateBodySpecResumeMaxCompletedAgeMsMax = 2147483647export const AgentApplicationsRevisionsUpdateBody = /* @__PURE__ */ zod.object({parent_revision: zod.uuid().nullish(),@@ -905,547 +131,7 @@ export const AgentApplicationsRevisionsUpdateBody = /* @__PURE__ */ zod.object({.describe('Storage-prefix metadata for the bundle, e.g. `fs:\/\/my-agent\/`. Optional — leave blank and the server fills `fs:\/\/<application-slug>\/`. Bundles are addressed by revision id regardless, so this is only a prefix hint.'),- spec: zod- .object({- models: zod- .union([- zod.object({- mode: zod.literal('auto'),- level: zod- .enum(['low', 'medium', 'high'])- .default(agentApplicationsRevisionsUpdateBodySpecModelsOneLevelDefault)- .describe(- 'Quality\/cost tier (auto). low = cheapest, for short, formulaic, no-reasoning jobs (lookups, FAQ bots); medium = balanced default, for multi-step but bounded work; high = top-tier, for long, branching, reasoning-heavy work. Resolved to a priority-ordered cross-provider list at session start.'- ),- reasoning: zod- .enum(['minimal', 'low', 'medium', 'high', 'xhigh'])- .optional()- .describe(- 'Reasoning\/thinking effort budget. minimal = no deliberation (fastest, cheapest) … xhigh = maximal (research-grade, ~5-10x the per-turn cost). Omit for the provider\/spec default.'- ),- optimize_for: zod- .enum(['cost', 'availability'])- .default(agentApplicationsRevisionsUpdateBodySpecModelsOneOptimizeForDefault)- .describe(- "Session model stability vs. resilience. `cost` (default): the first turn picks a working model and PINS it for the whole session — keeps the provider's prompt cache warm (cache reads are ~0.1-0.5x of full input) and never fails over mid-session; if the pinned model is down the turn fails rather than re-reading the whole context cold on another provider. `availability`: fail over to the next model when the session's model fails — survives an outage at the cost of a one-time cold re-read. Prefer `cost` for long\/expensive sessions, `availability` where uptime matters more than spend."- ),- }),- zod.object({- mode: zod.literal('manual'),- models: zod- .array(- zod.object({- model: zod- .string()- .min(1)- .regex(agentApplicationsRevisionsUpdateBodySpecModelsTwoModelsItemModelRegExp)- .describe(- 'Canonical model id, e.g. `anthropic\/claude-sonnet-4-6` (see the agent-applications-models tool for served ids).'- ),- reasoning: zod- .enum(['minimal', 'low', 'medium', 'high', 'xhigh'])- .optional()- .describe('Per-model reasoning effort override (else the spec default).'),- })- )- .min(1)- .describe(- 'Explicit priority-ordered fallback list — the runner tries entries in order (primary first).'- ),- optimize_for: zod- .enum(['cost', 'availability'])- .default(agentApplicationsRevisionsUpdateBodySpecModelsTwoOptimizeForDefault)- .describe(- "Session model stability vs. resilience. `cost` (default): pin the first working model for the whole session (warm prompt cache, no mid-session failover). `availability`: fail over down this list when the session's model fails (survives outages, re-reads context cold)."- ),- }),- ])- .default(agentApplicationsRevisionsUpdateBodySpecModelsDefault)- .describe(- "How this agent selects its model. `auto`: pick a quality\/cost `level` and the platform resolves it to a maintained, priority-ordered, cross-provider list at runtime. `manual`: give an explicit priority-ordered `models` list (primary first). `optimize_for` governs how the chosen model is treated across the session's turns."- ),- triggers: zod- .array(- zod.union([- zod.object({- type: zod.literal('slack'),- config: zod.object({- channel_id: zod.string().optional(),- mention_only: zod- .boolean()- .default(- agentApplicationsRevisionsUpdateBodySpecTriggersItemOneConfigMentionOnlyDefault- ),- auto_resume_threads: zod- .boolean()- .default(- agentApplicationsRevisionsUpdateBodySpecTriggersItemOneConfigAutoResumeThreadsDefault- ),- allow_workspace_participants: zod- .boolean()- .default(- agentApplicationsRevisionsUpdateBodySpecTriggersItemOneConfigAllowWorkspaceParticipantsDefault- ),- ack_reaction: zod.string().optional(),- allow_direct_messages: zod- .boolean()- .default(- agentApplicationsRevisionsUpdateBodySpecTriggersItemOneConfigAllowDirectMessagesDefault- ),- trusted_workspaces: zod.union([zod.array(zod.string()).min(1), zod.literal('*')]),- }),- }),- zod.object({- type: zod.literal('webhook'),- config: zod.object({- path: zod.string(),- }),- auth: zod.object({- modes: zod- .array(- zod.union([- zod.object({- type: zod.literal('public'),- acknowledge_public_exposure: zod.boolean(),- }),- zod.object({- type: zod.literal('posthog'),- scopes: zod- .array(zod.string())- .default(- agentApplicationsRevisionsUpdateBodySpecTriggersItemTwoAuthModesItemTwoScopesDefault- ),- audience: zod- .enum(['project', 'organization'])- .default(- agentApplicationsRevisionsUpdateBodySpecTriggersItemTwoAuthModesItemTwoAudienceDefault- ),- }),- zod.object({- type: zod.literal('jwt'),- issuer_secret_ref: zod.string().min(1),- }),- zod.object({- type: zod.literal('shared_secret'),- header: zod.string().min(1),- secret_ref: zod.string().min(1),- }),- zod.object({- type: zod.literal('posthog_internal'),- }),- ])- )- .optional(),- }),- }),- zod.object({- type: zod.literal('cron'),- config: zod.object({- name: zod.string().min(1),- schedule: zod.string().min(1),- timezone: zod- .string()- .default(- agentApplicationsRevisionsUpdateBodySpecTriggersItemThreeConfigTimezoneDefault- ),- prompt: zod- .string()- .min(1)- .max(agentApplicationsRevisionsUpdateBodySpecTriggersItemThreeConfigPromptMax),- external_key: zod.string().optional(),- catch_up: zod- .enum(['all', 'most_recent', 'skip'])- .default(- agentApplicationsRevisionsUpdateBodySpecTriggersItemThreeConfigCatchUpDefault- ),- max_catch_up_age_seconds: zod- .number()- .min(1)- .max(- agentApplicationsRevisionsUpdateBodySpecTriggersItemThreeConfigMaxCatchUpAgeSecondsMax- )- .default(- agentApplicationsRevisionsUpdateBodySpecTriggersItemThreeConfigMaxCatchUpAgeSecondsDefault- ),- }),- }),- zod.object({- type: zod.literal('chat'),- config: zod- .object({- allow_restart: zod- .boolean()- .default(- agentApplicationsRevisionsUpdateBodySpecTriggersItemFourConfigAllowRestartDefault- ),- })- .default(agentApplicationsRevisionsUpdateBodySpecTriggersItemFourConfigDefault),- auth: zod.object({- modes: zod- .array(- zod.union([- zod.object({- type: zod.literal('public'),- acknowledge_public_exposure: zod.boolean(),- }),- zod.object({- type: zod.literal('posthog'),- scopes: zod- .array(zod.string())- .default(- agentApplicationsRevisionsUpdateBodySpecTriggersItemFourAuthModesItemTwoScopesDefault- ),- audience: zod- .enum(['project', 'organization'])- .default(- agentApplicationsRevisionsUpdateBodySpecTriggersItemFourAuthModesItemTwoAudienceDefault- ),- }),- zod.object({- type: zod.literal('jwt'),- issuer_secret_ref: zod.string().min(1),- }),- zod.object({- type: zod.literal('shared_secret'),- header: zod.string().min(1),- secret_ref: zod.string().min(1),- }),- zod.object({- type: zod.literal('posthog_internal'),- }),- ])- )- .optional(),- }),- }),- zod.object({- type: zod.literal('mcp'),- config: zod- .object({- allow_restart: zod- .boolean()- .default(- agentApplicationsRevisionsUpdateBodySpecTriggersItemFiveConfigAllowRestartDefault- ),- })- .default(agentApplicationsRevisionsUpdateBodySpecTriggersItemFiveConfigDefault),- auth: zod.object({- modes: zod- .array(- zod.union([- zod.object({- type: zod.literal('public'),- acknowledge_public_exposure: zod.boolean(),- }),- zod.object({- type: zod.literal('posthog'),- scopes: zod- .array(zod.string())- .default(- agentApplicationsRevisionsUpdateBodySpecTriggersItemFiveAuthModesItemTwoScopesDefault- ),- audience: zod- .enum(['project', 'organization'])- .default(- agentApplicationsRevisionsUpdateBodySpecTriggersItemFiveAuthModesItemTwoAudienceDefault- ),- }),- zod.object({- type: zod.literal('jwt'),- issuer_secret_ref: zod.string().min(1),- }),- zod.object({- type: zod.literal('shared_secret'),- header: zod.string().min(1),- secret_ref: zod.string().min(1),- }),- zod.object({- type: zod.literal('posthog_internal'),- }),- ])- )- .optional(),- }),- }),- ])- )- .default(agentApplicationsRevisionsUpdateBodySpecTriggersDefault),- tools: zod- .array(- zod.union([- zod.object({- kind: zod.literal('native'),- id: zod.string(),- requires_approval: zod- .boolean()- .default(agentApplicationsRevisionsUpdateBodySpecToolsItemOneRequiresApprovalDefault),- approval_policy: zod- .object({- type: zod- .enum(['principal', 'agent'])- .default(- agentApplicationsRevisionsUpdateBodySpecToolsItemOneApprovalPolicyTypeDefault- ),- allow_edit: zod- .boolean()- .default(- agentApplicationsRevisionsUpdateBodySpecToolsItemOneApprovalPolicyAllowEditDefault- ),- ttl_ms: zod- .number()- .min(agentApplicationsRevisionsUpdateBodySpecToolsItemOneApprovalPolicyTtlMsMin)- .max(agentApplicationsRevisionsUpdateBodySpecToolsItemOneApprovalPolicyTtlMsMax)- .default(- agentApplicationsRevisionsUpdateBodySpecToolsItemOneApprovalPolicyTtlMsDefault- ),- })- .optional(),- }),- zod.object({- kind: zod.literal('custom'),- id: zod.string(),- path: zod.string(),- requires_approval: zod- .boolean()- .default(agentApplicationsRevisionsUpdateBodySpecToolsItemTwoRequiresApprovalDefault),- approval_policy: zod- .object({- type: zod- .enum(['principal', 'agent'])- .default(- agentApplicationsRevisionsUpdateBodySpecToolsItemTwoApprovalPolicyTypeDefault- ),- allow_edit: zod- .boolean()- .default(- agentApplicationsRevisionsUpdateBodySpecToolsItemTwoApprovalPolicyAllowEditDefault- ),- ttl_ms: zod- .number()- .min(agentApplicationsRevisionsUpdateBodySpecToolsItemTwoApprovalPolicyTtlMsMin)- .max(agentApplicationsRevisionsUpdateBodySpecToolsItemTwoApprovalPolicyTtlMsMax)- .default(- agentApplicationsRevisionsUpdateBodySpecToolsItemTwoApprovalPolicyTtlMsDefault- ),- })- .optional(),- requires_identity: zod.string().optional(),- }),- zod.object({- kind: zod.literal('custom_template'),- from_template: zod.string(),- alias: zod.string(),- version: zod.number().min(1).optional(),- }),- zod.object({- kind: zod.literal('client'),- id: zod.string().min(1),- description: zod.string().min(1),- args_schema: zod- .looseObject({})- .default(agentApplicationsRevisionsUpdateBodySpecToolsItemFourArgsSchemaDefault),- required: zod- .boolean()- .default(agentApplicationsRevisionsUpdateBodySpecToolsItemFourRequiredDefault),- timeout_ms: zod- .number()- .min(1)- .max(agentApplicationsRevisionsUpdateBodySpecToolsItemFourTimeoutMsMax)- .default(agentApplicationsRevisionsUpdateBodySpecToolsItemFourTimeoutMsDefault),- interactive: zod- .boolean()- .default(agentApplicationsRevisionsUpdateBodySpecToolsItemFourInteractiveDefault),- }),- ])- )- .default(agentApplicationsRevisionsUpdateBodySpecToolsDefault),- mcps: zod- .array(- zod.object({- id: zod.string().min(1),- url: zod.url(),- auth: zod- .object({- provider: zod.string().optional(),- })- .optional(),- secrets: zod- .array(zod.string())- .default(agentApplicationsRevisionsUpdateBodySpecMcpsItemSecretsDefault),- headers: zod.record(zod.string(), zod.string()).optional(),- tools: zod- .array(- zod.union([- zod.string().min(1),- zod.object({- name: zod.string().min(1),- requires_approval: zod- .boolean()- .default(- agentApplicationsRevisionsUpdateBodySpecMcpsItemToolsItemTwoRequiresApprovalDefault- ),- approval_policy: zod- .object({- type: zod- .enum(['principal', 'agent'])- .default(- agentApplicationsRevisionsUpdateBodySpecMcpsItemToolsItemTwoApprovalPolicyTypeDefault- ),- allow_edit: zod- .boolean()- .default(- agentApplicationsRevisionsUpdateBodySpecMcpsItemToolsItemTwoApprovalPolicyAllowEditDefault- ),- ttl_ms: zod- .number()- .min(- agentApplicationsRevisionsUpdateBodySpecMcpsItemToolsItemTwoApprovalPolicyTtlMsMin- )- .max(- agentApplicationsRevisionsUpdateBodySpecMcpsItemToolsItemTwoApprovalPolicyTtlMsMax- )- .default(- agentApplicationsRevisionsUpdateBodySpecMcpsItemToolsItemTwoApprovalPolicyTtlMsDefault- ),- })- .optional(),- }),- ])- )- .optional(),- })- )- .default(agentApplicationsRevisionsUpdateBodySpecMcpsDefault),- skills: zod- .array(- zod.object({- id: zod.string(),- path: zod.string(),- description: zod.string().optional(),- from_template: zod.string().optional(),- alias: zod.string().optional(),- version: zod.number().min(1).optional(),- source_version_id: zod.string().optional(),- })- )- .default(agentApplicationsRevisionsUpdateBodySpecSkillsDefault),- identity_providers: zod- .array(- zod.union([- zod.object({- kind: zod.literal('posthog'),- id: zod- .string()- .min(1)- .default(agentApplicationsRevisionsUpdateBodySpecIdentityProvidersItemOneIdDefault),- binding: zod- .enum(['principal'])- .default(- agentApplicationsRevisionsUpdateBodySpecIdentityProvidersItemOneBindingDefault- ),- scopes: zod- .array(zod.string())- .default(agentApplicationsRevisionsUpdateBodySpecIdentityProvidersItemOneScopesDefault),- client_id: zod.string().optional(),- }),- zod.object({- kind: zod.literal('oauth2'),- id: zod.string().min(1),- binding: zod- .enum(['principal'])- .default(- agentApplicationsRevisionsUpdateBodySpecIdentityProvidersItemTwoBindingDefault- ),- authorize_url: zod.url(),- token_url: zod.url(),- client_id: zod.string().min(1),- client_secret_ref: zod.string().optional(),- scopes: zod- .array(zod.string())- .default(agentApplicationsRevisionsUpdateBodySpecIdentityProvidersItemTwoScopesDefault),- userinfo_url: zod.url().optional(),- }),- ])- )- .default(agentApplicationsRevisionsUpdateBodySpecIdentityProvidersDefault),- secrets: zod- .array(- zod.union([- zod.string().min(1),- zod.object({- name: zod.string().min(1),- allowed_hosts: zod.array(zod.string().min(1)).min(1),- }),- ])- )- .default(agentApplicationsRevisionsUpdateBodySpecSecretsDefault),- limits: zod- .object({- max_turns: zod- .number()- .gt(agentApplicationsRevisionsUpdateBodySpecLimitsMaxTurnsExclusiveMin)- .max(agentApplicationsRevisionsUpdateBodySpecLimitsMaxTurnsMax)- .default(agentApplicationsRevisionsUpdateBodySpecLimitsMaxTurnsDefault),- max_tool_calls: zod- .number()- .gt(agentApplicationsRevisionsUpdateBodySpecLimitsMaxToolCallsExclusiveMin)- .max(agentApplicationsRevisionsUpdateBodySpecLimitsMaxToolCallsMax)- .default(agentApplicationsRevisionsUpdateBodySpecLimitsMaxToolCallsDefault),- max_wall_seconds: zod- .number()- .gt(agentApplicationsRevisionsUpdateBodySpecLimitsMaxWallSecondsExclusiveMin)- .max(agentApplicationsRevisionsUpdateBodySpecLimitsMaxWallSecondsMax)- .default(agentApplicationsRevisionsUpdateBodySpecLimitsMaxWallSecondsDefault),- max_output_tokens: zod- .number()- .gt(agentApplicationsRevisionsUpdateBodySpecLimitsMaxOutputTokensExclusiveMin)- .max(agentApplicationsRevisionsUpdateBodySpecLimitsMaxOutputTokensMax)- .optional(),- max_memory_mb: zod- .number()- .gt(agentApplicationsRevisionsUpdateBodySpecLimitsMaxMemoryMbExclusiveMin)- .max(agentApplicationsRevisionsUpdateBodySpecLimitsMaxMemoryMbMax)- .default(agentApplicationsRevisionsUpdateBodySpecLimitsMaxMemoryMbDefault),- max_cpu_cores: zod- .number()- .gt(agentApplicationsRevisionsUpdateBodySpecLimitsMaxCpuCoresExclusiveMin)- .max(agentApplicationsRevisionsUpdateBodySpecLimitsMaxCpuCoresMax)- .default(agentApplicationsRevisionsUpdateBodySpecLimitsMaxCpuCoresDefault),- })- .default(agentApplicationsRevisionsUpdateBodySpecLimitsDefault),- reasoning: zod.enum(['minimal', 'low', 'medium', 'high', 'xhigh']).optional(),- framework_prompt: zod- .object({- omit: zod- .array(- zod.enum([- 'meta_tool_guidance',- 'state_contract',- 'tool_failure_guidance',- 'approval_guidance',- 'reasoning_hint',- ])- )- .default(agentApplicationsRevisionsUpdateBodySpecFrameworkPromptOmitDefault),- version_pin: zod- .number()- .gt(agentApplicationsRevisionsUpdateBodySpecFrameworkPromptVersionPinExclusiveMin)- .max(agentApplicationsRevisionsUpdateBodySpecFrameworkPromptVersionPinMax)- .optional(),- })- .optional(),- resume: zod- .object({- enabled: zod.boolean().default(agentApplicationsRevisionsUpdateBodySpecResumeEnabledDefault),- max_completed_age_ms: zod- .number()- .gt(agentApplicationsRevisionsUpdateBodySpecResumeMaxCompletedAgeMsExclusiveMin)- .max(agentApplicationsRevisionsUpdateBodySpecResumeMaxCompletedAgeMsMax)- .default(agentApplicationsRevisionsUpdateBodySpecResumeMaxCompletedAgeMsDefault),- })- .optional(),- })- .optional(),+ spec: zod.unknown().optional(),})/**@@ -1476,123 +162,6 @@ export const AgentApplicationsRevisionsUpdateBody = /* @__PURE__ */ zod.object({* PUT .../revisions/<id>/bundle/ bulk push (replace|merge)*/export const agentApplicationsRevisionsPartialUpdateBodyBundleUriDefault = ``-export const agentApplicationsRevisionsPartialUpdateBodySpecModelsOneLevelDefault = `medium`-export const agentApplicationsRevisionsPartialUpdateBodySpecModelsOneOptimizeForDefault = `cost`--export const agentApplicationsRevisionsPartialUpdateBodySpecModelsTwoModelsItemModelRegExp = new RegExp(- '^[a-z0-9_-]+\/[a-zA-Z0-9._:-]+$'-)--export const agentApplicationsRevisionsPartialUpdateBodySpecModelsTwoOptimizeForDefault = `cost`-export const agentApplicationsRevisionsPartialUpdateBodySpecModelsDefault = {- mode: 'auto' as const,- level: 'medium' as const,- optimize_for: 'cost' as const,-}-export const agentApplicationsRevisionsPartialUpdateBodySpecTriggersItemOneConfigMentionOnlyDefault = false-export const agentApplicationsRevisionsPartialUpdateBodySpecTriggersItemOneConfigAutoResumeThreadsDefault = false-export const agentApplicationsRevisionsPartialUpdateBodySpecTriggersItemOneConfigAllowWorkspaceParticipantsDefault = false-export const agentApplicationsRevisionsPartialUpdateBodySpecTriggersItemOneConfigAllowDirectMessagesDefault = false-export const agentApplicationsRevisionsPartialUpdateBodySpecTriggersItemTwoAuthModesItemTwoScopesDefault = []-export const agentApplicationsRevisionsPartialUpdateBodySpecTriggersItemTwoAuthModesItemTwoAudienceDefault = `project`--export const agentApplicationsRevisionsPartialUpdateBodySpecTriggersItemThreeConfigTimezoneDefault = `UTC`-export const agentApplicationsRevisionsPartialUpdateBodySpecTriggersItemThreeConfigPromptMax = 4096--export const agentApplicationsRevisionsPartialUpdateBodySpecTriggersItemThreeConfigCatchUpDefault = `most_recent`-export const agentApplicationsRevisionsPartialUpdateBodySpecTriggersItemThreeConfigMaxCatchUpAgeSecondsDefault = 3600-export const agentApplicationsRevisionsPartialUpdateBodySpecTriggersItemThreeConfigMaxCatchUpAgeSecondsMax = 604800--export const agentApplicationsRevisionsPartialUpdateBodySpecTriggersItemFourConfigAllowRestartDefault = false-export const agentApplicationsRevisionsPartialUpdateBodySpecTriggersItemFourConfigDefault = { allow_restart: false }-export const agentApplicationsRevisionsPartialUpdateBodySpecTriggersItemFourAuthModesItemTwoScopesDefault = []-export const agentApplicationsRevisionsPartialUpdateBodySpecTriggersItemFourAuthModesItemTwoAudienceDefault = `project`--export const agentApplicationsRevisionsPartialUpdateBodySpecTriggersItemFiveConfigAllowRestartDefault = false-export const agentApplicationsRevisionsPartialUpdateBodySpecTriggersItemFiveConfigDefault = { allow_restart: false }-export const agentApplicationsRevisionsPartialUpdateBodySpecTriggersItemFiveAuthModesItemTwoScopesDefault = []-export const agentApplicationsRevisionsPartialUpdateBodySpecTriggersItemFiveAuthModesItemTwoAudienceDefault = `project`--export const agentApplicationsRevisionsPartialUpdateBodySpecTriggersDefault = []-export const agentApplicationsRevisionsPartialUpdateBodySpecToolsItemOneRequiresApprovalDefault = false-export const agentApplicationsRevisionsPartialUpdateBodySpecToolsItemOneApprovalPolicyTypeDefault = `principal`-export const agentApplicationsRevisionsPartialUpdateBodySpecToolsItemOneApprovalPolicyAllowEditDefault = false-export const agentApplicationsRevisionsPartialUpdateBodySpecToolsItemOneApprovalPolicyTtlMsDefault = 86400000-export const agentApplicationsRevisionsPartialUpdateBodySpecToolsItemOneApprovalPolicyTtlMsMin = 60000-export const agentApplicationsRevisionsPartialUpdateBodySpecToolsItemOneApprovalPolicyTtlMsMax = 604800000--export const agentApplicationsRevisionsPartialUpdateBodySpecToolsItemTwoRequiresApprovalDefault = false-export const agentApplicationsRevisionsPartialUpdateBodySpecToolsItemTwoApprovalPolicyTypeDefault = `principal`-export const agentApplicationsRevisionsPartialUpdateBodySpecToolsItemTwoApprovalPolicyAllowEditDefault = false-export const agentApplicationsRevisionsPartialUpdateBodySpecToolsItemTwoApprovalPolicyTtlMsDefault = 86400000-export const agentApplicationsRevisionsPartialUpdateBodySpecToolsItemTwoApprovalPolicyTtlMsMin = 60000-export const agentApplicationsRevisionsPartialUpdateBodySpecToolsItemTwoApprovalPolicyTtlMsMax = 604800000--export const agentApplicationsRevisionsPartialUpdateBodySpecToolsItemFourArgsSchemaDefault = {}-export const agentApplicationsRevisionsPartialUpdateBodySpecToolsItemFourRequiredDefault = false-export const agentApplicationsRevisionsPartialUpdateBodySpecToolsItemFourTimeoutMsDefault = 5000-export const agentApplicationsRevisionsPartialUpdateBodySpecToolsItemFourTimeoutMsMax = 600000--export const agentApplicationsRevisionsPartialUpdateBodySpecToolsItemFourInteractiveDefault = false-export const agentApplicationsRevisionsPartialUpdateBodySpecToolsDefault = []-export const agentApplicationsRevisionsPartialUpdateBodySpecMcpsItemSecretsDefault = []--export const agentApplicationsRevisionsPartialUpdateBodySpecMcpsItemToolsItemTwoRequiresApprovalDefault = false-export const agentApplicationsRevisionsPartialUpdateBodySpecMcpsItemToolsItemTwoApprovalPolicyTypeDefault = `principal`-export const agentApplicationsRevisionsPartialUpdateBodySpecMcpsItemToolsItemTwoApprovalPolicyAllowEditDefault = false-export const agentApplicationsRevisionsPartialUpdateBodySpecMcpsItemToolsItemTwoApprovalPolicyTtlMsDefault = 86400000-export const agentApplicationsRevisionsPartialUpdateBodySpecMcpsItemToolsItemTwoApprovalPolicyTtlMsMin = 60000-export const agentApplicationsRevisionsPartialUpdateBodySpecMcpsItemToolsItemTwoApprovalPolicyTtlMsMax = 604800000--export const agentApplicationsRevisionsPartialUpdateBodySpecMcpsDefault = []-export const agentApplicationsRevisionsPartialUpdateBodySpecSkillsDefault = []-export const agentApplicationsRevisionsPartialUpdateBodySpecIdentityProvidersItemOneIdDefault = `posthog`--export const agentApplicationsRevisionsPartialUpdateBodySpecIdentityProvidersItemOneBindingDefault = `principal`-export const agentApplicationsRevisionsPartialUpdateBodySpecIdentityProvidersItemOneScopesDefault = []-export const agentApplicationsRevisionsPartialUpdateBodySpecIdentityProvidersItemTwoBindingDefault = `principal`-export const agentApplicationsRevisionsPartialUpdateBodySpecIdentityProvidersItemTwoScopesDefault = []-export const agentApplicationsRevisionsPartialUpdateBodySpecIdentityProvidersDefault = []--export const agentApplicationsRevisionsPartialUpdateBodySpecSecretsDefault = []-export const agentApplicationsRevisionsPartialUpdateBodySpecLimitsMaxTurnsDefault = 50-export const agentApplicationsRevisionsPartialUpdateBodySpecLimitsMaxTurnsExclusiveMin = 0-export const agentApplicationsRevisionsPartialUpdateBodySpecLimitsMaxTurnsMax = 2147483647--export const agentApplicationsRevisionsPartialUpdateBodySpecLimitsMaxToolCallsDefault = 200-export const agentApplicationsRevisionsPartialUpdateBodySpecLimitsMaxToolCallsExclusiveMin = 0-export const agentApplicationsRevisionsPartialUpdateBodySpecLimitsMaxToolCallsMax = 2147483647--export const agentApplicationsRevisionsPartialUpdateBodySpecLimitsMaxWallSecondsDefault = 900-export const agentApplicationsRevisionsPartialUpdateBodySpecLimitsMaxWallSecondsExclusiveMin = 0-export const agentApplicationsRevisionsPartialUpdateBodySpecLimitsMaxWallSecondsMax = 2147483647--export const agentApplicationsRevisionsPartialUpdateBodySpecLimitsMaxOutputTokensExclusiveMin = 0-export const agentApplicationsRevisionsPartialUpdateBodySpecLimitsMaxOutputTokensMax = 200000--export const agentApplicationsRevisionsPartialUpdateBodySpecLimitsMaxMemoryMbDefault = 512-export const agentApplicationsRevisionsPartialUpdateBodySpecLimitsMaxMemoryMbExclusiveMin = 0-export const agentApplicationsRevisionsPartialUpdateBodySpecLimitsMaxMemoryMbMax = 16384--export const agentApplicationsRevisionsPartialUpdateBodySpecLimitsMaxCpuCoresDefault = 0.25-export const agentApplicationsRevisionsPartialUpdateBodySpecLimitsMaxCpuCoresExclusiveMin = 0-export const agentApplicationsRevisionsPartialUpdateBodySpecLimitsMaxCpuCoresMax = 8--export const agentApplicationsRevisionsPartialUpdateBodySpecLimitsDefault = {- max_turns: 50,- max_tool_calls: 200,- max_wall_seconds: 900,- max_memory_mb: 512,- max_cpu_cores: 0.25,-}-export const agentApplicationsRevisionsPartialUpdateBodySpecFrameworkPromptOmitDefault = []-export const agentApplicationsRevisionsPartialUpdateBodySpecFrameworkPromptVersionPinExclusiveMin = 0-export const agentApplicationsRevisionsPartialUpdateBodySpecFrameworkPromptVersionPinMax = 2147483647--export const agentApplicationsRevisionsPartialUpdateBodySpecResumeEnabledDefault = false-export const agentApplicationsRevisionsPartialUpdateBodySpecResumeMaxCompletedAgeMsDefault = 604800000-export const agentApplicationsRevisionsPartialUpdateBodySpecResumeMaxCompletedAgeMsExclusiveMin = 0-export const agentApplicationsRevisionsPartialUpdateBodySpecResumeMaxCompletedAgeMsMax = 2147483647export const AgentApplicationsRevisionsPartialUpdateBody = /* @__PURE__ */ zod.object({parent_revision: zod.uuid().nullish(),@@ -1602,571 +171,7 @@ export const AgentApplicationsRevisionsPartialUpdateBody = /* @__PURE__ */ zod.o.describe('Storage-prefix metadata for the bundle, e.g. `fs:\/\/my-agent\/`. Optional — leave blank and the server fills `fs:\/\/<application-slug>\/`. Bundles are addressed by revision id regardless, so this is only a prefix hint.'),- spec: zod- .object({- models: zod- .union([- zod.object({- mode: zod.literal('auto'),- level: zod- .enum(['low', 'medium', 'high'])- .default(agentApplicationsRevisionsPartialUpdateBodySpecModelsOneLevelDefault)- .describe(- 'Quality\/cost tier (auto). low = cheapest, for short, formulaic, no-reasoning jobs (lookups, FAQ bots); medium = balanced default, for multi-step but bounded work; high = top-tier, for long, branching, reasoning-heavy work. Resolved to a priority-ordered cross-provider list at session start.'- ),- reasoning: zod- .enum(['minimal', 'low', 'medium', 'high', 'xhigh'])- .optional()- .describe(- 'Reasoning\/thinking effort budget. minimal = no deliberation (fastest, cheapest) … xhigh = maximal (research-grade, ~5-10x the per-turn cost). Omit for the provider\/spec default.'- ),- optimize_for: zod- .enum(['cost', 'availability'])- .default(agentApplicationsRevisionsPartialUpdateBodySpecModelsOneOptimizeForDefault)- .describe(- "Session model stability vs. resilience. `cost` (default): the first turn picks a working model and PINS it for the whole session — keeps the provider's prompt cache warm (cache reads are ~0.1-0.5x of full input) and never fails over mid-session; if the pinned model is down the turn fails rather than re-reading the whole context cold on another provider. `availability`: fail over to the next model when the session's model fails — survives an outage at the cost of a one-time cold re-read. Prefer `cost` for long\/expensive sessions, `availability` where uptime matters more than spend."- ),- }),- zod.object({- mode: zod.literal('manual'),- models: zod- .array(- zod.object({- model: zod- .string()- .min(1)- .regex(- agentApplicationsRevisionsPartialUpdateBodySpecModelsTwoModelsItemModelRegExp- )- .describe(- 'Canonical model id, e.g. `anthropic\/claude-sonnet-4-6` (see the agent-applications-models tool for served ids).'- ),- reasoning: zod- .enum(['minimal', 'low', 'medium', 'high', 'xhigh'])- .optional()- .describe('Per-model reasoning effort override (else the spec default).'),- })- )- .min(1)- .describe(- 'Explicit priority-ordered fallback list — the runner tries entries in order (primary first).'- ),- optimize_for: zod- .enum(['cost', 'availability'])- .default(agentApplicationsRevisionsPartialUpdateBodySpecModelsTwoOptimizeForDefault)- .describe(- "Session model stability vs. resilience. `cost` (default): pin the first working model for the whole session (warm prompt cache, no mid-session failover). `availability`: fail over down this list when the session's model fails (survives outages, re-reads context cold)."- ),- }),- ])- .default(agentApplicationsRevisionsPartialUpdateBodySpecModelsDefault)- .describe(- "How this agent selects its model. `auto`: pick a quality\/cost `level` and the platform resolves it to a maintained, priority-ordered, cross-provider list at runtime. `manual`: give an explicit priority-ordered `models` list (primary first). `optimize_for` governs how the chosen model is treated across the session's turns."- ),- triggers: zod- .array(- zod.union([- zod.object({- type: zod.literal('slack'),- config: zod.object({- channel_id: zod.string().optional(),- mention_only: zod- .boolean()- .default(- agentApplicationsRevisionsPartialUpdateBodySpecTriggersItemOneConfigMentionOnlyDefault- ),- auto_resume_threads: zod- .boolean()- .default(- agentApplicationsRevisionsPartialUpdateBodySpecTriggersItemOneConfigAutoResumeThreadsDefault- ),- allow_workspace_participants: zod- .boolean()- .default(- agentApplicationsRevisionsPartialUpdateBodySpecTriggersItemOneConfigAllowWorkspaceParticipantsDefault- ),- ack_reaction: zod.string().optional(),- allow_direct_messages: zod- .boolean()- .default(- agentApplicationsRevisionsPartialUpdateBodySpecTriggersItemOneConfigAllowDirectMessagesDefault- ),- trusted_workspaces: zod.union([zod.array(zod.string()).min(1), zod.literal('*')]),- }),- }),- zod.object({- type: zod.literal('webhook'),- config: zod.object({- path: zod.string(),- }),- auth: zod.object({- modes: zod- .array(- zod.union([- zod.object({- type: zod.literal('public'),- acknowledge_public_exposure: zod.boolean(),- }),- zod.object({- type: zod.literal('posthog'),- scopes: zod- .array(zod.string())- .default(- agentApplicationsRevisionsPartialUpdateBodySpecTriggersItemTwoAuthModesItemTwoScopesDefault- ),- audience: zod- .enum(['project', 'organization'])- .default(- agentApplicationsRevisionsPartialUpdateBodySpecTriggersItemTwoAuthModesItemTwoAudienceDefault- ),- }),- zod.object({- type: zod.literal('jwt'),- issuer_secret_ref: zod.string().min(1),- }),- zod.object({- type: zod.literal('shared_secret'),- header: zod.string().min(1),- secret_ref: zod.string().min(1),- }),- zod.object({- type: zod.literal('posthog_internal'),- }),- ])- )- .optional(),- }),- }),- zod.object({- type: zod.literal('cron'),- config: zod.object({- name: zod.string().min(1),- schedule: zod.string().min(1),- timezone: zod- .string()- .default(- agentApplicationsRevisionsPartialUpdateBodySpecTriggersItemThreeConfigTimezoneDefault- ),- prompt: zod- .string()- .min(1)- .max(- agentApplicationsRevisionsPartialUpdateBodySpecTriggersItemThreeConfigPromptMax- ),- external_key: zod.string().optional(),- catch_up: zod- .enum(['all', 'most_recent', 'skip'])- .default(- agentApplicationsRevisionsPartialUpdateBodySpecTriggersItemThreeConfigCatchUpDefault- ),- max_catch_up_age_seconds: zod- .number()- .min(1)- .max(- agentApplicationsRevisionsPartialUpdateBodySpecTriggersItemThreeConfigMaxCatchUpAgeSecondsMax- )- .default(- agentApplicationsRevisionsPartialUpdateBodySpecTriggersItemThreeConfigMaxCatchUpAgeSecondsDefault- ),- }),- }),- zod.object({- type: zod.literal('chat'),- config: zod- .object({- allow_restart: zod- .boolean()- .default(- agentApplicationsRevisionsPartialUpdateBodySpecTriggersItemFourConfigAllowRestartDefault- ),- })- .default(agentApplicationsRevisionsPartialUpdateBodySpecTriggersItemFourConfigDefault),- auth: zod.object({- modes: zod- .array(- zod.union([- zod.object({- type: zod.literal('public'),- acknowledge_public_exposure: zod.boolean(),- }),- zod.object({- type: zod.literal('posthog'),- scopes: zod- .array(zod.string())- .default(- agentApplicationsRevisionsPartialUpdateBodySpecTriggersItemFourAuthModesItemTwoScopesDefault- ),- audience: zod- .enum(['project', 'organization'])- .default(- agentApplicationsRevisionsPartialUpdateBodySpecTriggersItemFourAuthModesItemTwoAudienceDefault- ),- }),- zod.object({- type: zod.literal('jwt'),- issuer_secret_ref: zod.string().min(1),- }),- zod.object({- type: zod.literal('shared_secret'),- header: zod.string().min(1),- secret_ref: zod.string().min(1),- }),- zod.object({- type: zod.literal('posthog_internal'),- }),- ])- )- .optional(),- }),- }),- zod.object({- type: zod.literal('mcp'),- config: zod- .object({- allow_restart: zod- .boolean()- .default(- agentApplicationsRevisionsPartialUpdateBodySpecTriggersItemFiveConfigAllowRestartDefault- ),- })- .default(agentApplicationsRevisionsPartialUpdateBodySpecTriggersItemFiveConfigDefault),- auth: zod.object({- modes: zod- .array(- zod.union([- zod.object({- type: zod.literal('public'),- acknowledge_public_exposure: zod.boolean(),- }),- zod.object({- type: zod.literal('posthog'),- scopes: zod- .array(zod.string())- .default(- agentApplicationsRevisionsPartialUpdateBodySpecTriggersItemFiveAuthModesItemTwoScopesDefault- ),- audience: zod- .enum(['project', 'organization'])- .default(- agentApplicationsRevisionsPartialUpdateBodySpecTriggersItemFiveAuthModesItemTwoAudienceDefault- ),- }),- zod.object({- type: zod.literal('jwt'),- issuer_secret_ref: zod.string().min(1),- }),- zod.object({- type: zod.literal('shared_secret'),- header: zod.string().min(1),- secret_ref: zod.string().min(1),- }),- zod.object({- type: zod.literal('posthog_internal'),- }),- ])- )- .optional(),- }),- }),- ])- )- .default(agentApplicationsRevisionsPartialUpdateBodySpecTriggersDefault),- tools: zod- .array(- zod.union([- zod.object({- kind: zod.literal('native'),- id: zod.string(),- requires_approval: zod- .boolean()- .default(- agentApplicationsRevisionsPartialUpdateBodySpecToolsItemOneRequiresApprovalDefault- ),- approval_policy: zod- .object({- type: zod- .enum(['principal', 'agent'])- .default(- agentApplicationsRevisionsPartialUpdateBodySpecToolsItemOneApprovalPolicyTypeDefault- ),- allow_edit: zod- .boolean()- .default(- agentApplicationsRevisionsPartialUpdateBodySpecToolsItemOneApprovalPolicyAllowEditDefault- ),- ttl_ms: zod- .number()- .min(- agentApplicationsRevisionsPartialUpdateBodySpecToolsItemOneApprovalPolicyTtlMsMin- )- .max(- agentApplicationsRevisionsPartialUpdateBodySpecToolsItemOneApprovalPolicyTtlMsMax- )- .default(- agentApplicationsRevisionsPartialUpdateBodySpecToolsItemOneApprovalPolicyTtlMsDefault- ),- })- .optional(),- }),- zod.object({- kind: zod.literal('custom'),- id: zod.string(),- path: zod.string(),- requires_approval: zod- .boolean()- .default(- agentApplicationsRevisionsPartialUpdateBodySpecToolsItemTwoRequiresApprovalDefault- ),- approval_policy: zod- .object({- type: zod- .enum(['principal', 'agent'])- .default(- agentApplicationsRevisionsPartialUpdateBodySpecToolsItemTwoApprovalPolicyTypeDefault- ),- allow_edit: zod- .boolean()- .default(- agentApplicationsRevisionsPartialUpdateBodySpecToolsItemTwoApprovalPolicyAllowEditDefault- ),- ttl_ms: zod- .number()- .min(- agentApplicationsRevisionsPartialUpdateBodySpecToolsItemTwoApprovalPolicyTtlMsMin- )- .max(- agentApplicationsRevisionsPartialUpdateBodySpecToolsItemTwoApprovalPolicyTtlMsMax- )- .default(- agentApplicationsRevisionsPartialUpdateBodySpecToolsItemTwoApprovalPolicyTtlMsDefault- ),- })- .optional(),- requires_identity: zod.string().optional(),- }),- zod.object({- kind: zod.literal('custom_template'),- from_template: zod.string(),- alias: zod.string(),- version: zod.number().min(1).optional(),- }),- zod.object({- kind: zod.literal('client'),- id: zod.string().min(1),- description: zod.string().min(1),- args_schema: zod- .looseObject({})- .default(agentApplicationsRevisionsPartialUpdateBodySpecToolsItemFourArgsSchemaDefault),- required: zod- .boolean()- .default(agentApplicationsRevisionsPartialUpdateBodySpecToolsItemFourRequiredDefault),- timeout_ms: zod- .number()- .min(1)- .max(agentApplicationsRevisionsPartialUpdateBodySpecToolsItemFourTimeoutMsMax)- .default(agentApplicationsRevisionsPartialUpdateBodySpecToolsItemFourTimeoutMsDefault),- interactive: zod- .boolean()- .default(- agentApplicationsRevisionsPartialUpdateBodySpecToolsItemFourInteractiveDefault- ),- }),- ])- )- .default(agentApplicationsRevisionsPartialUpdateBodySpecToolsDefault),- mcps: zod- .array(- zod.object({- id: zod.string().min(1),- url: zod.url(),- auth: zod- .object({- provider: zod.string().optional(),- })- .optional(),- secrets: zod- .array(zod.string())- .default(agentApplicationsRevisionsPartialUpdateBodySpecMcpsItemSecretsDefault),- headers: zod.record(zod.string(), zod.string()).optional(),- tools: zod- .array(- zod.union([- zod.string().min(1),- zod.object({- name: zod.string().min(1),- requires_approval: zod- .boolean()- .default(- agentApplicationsRevisionsPartialUpdateBodySpecMcpsItemToolsItemTwoRequiresApprovalDefault- ),- approval_policy: zod- .object({- type: zod- .enum(['principal', 'agent'])- .default(- agentApplicationsRevisionsPartialUpdateBodySpecMcpsItemToolsItemTwoApprovalPolicyTypeDefault- ),- allow_edit: zod- .boolean()- .default(- agentApplicationsRevisionsPartialUpdateBodySpecMcpsItemToolsItemTwoApprovalPolicyAllowEditDefault- ),- ttl_ms: zod- .number()- .min(- agentApplicationsRevisionsPartialUpdateBodySpecMcpsItemToolsItemTwoApprovalPolicyTtlMsMin- )- .max(- agentApplicationsRevisionsPartialUpdateBodySpecMcpsItemToolsItemTwoApprovalPolicyTtlMsMax- )- .default(- agentApplicationsRevisionsPartialUpdateBodySpecMcpsItemToolsItemTwoApprovalPolicyTtlMsDefault- ),- })- .optional(),- }),- ])- )- .optional(),- })- )- .default(agentApplicationsRevisionsPartialUpdateBodySpecMcpsDefault),- skills: zod- .array(- zod.object({- id: zod.string(),- path: zod.string(),- description: zod.string().optional(),- from_template: zod.string().optional(),- alias: zod.string().optional(),- version: zod.number().min(1).optional(),- source_version_id: zod.string().optional(),- })- )- .default(agentApplicationsRevisionsPartialUpdateBodySpecSkillsDefault),- identity_providers: zod- .array(- zod.union([- zod.object({- kind: zod.literal('posthog'),- id: zod- .string()- .min(1)- .default(- agentApplicationsRevisionsPartialUpdateBodySpecIdentityProvidersItemOneIdDefault- ),- binding: zod- .enum(['principal'])- .default(- agentApplicationsRevisionsPartialUpdateBodySpecIdentityProvidersItemOneBindingDefault- ),- scopes: zod- .array(zod.string())- .default(- agentApplicationsRevisionsPartialUpdateBodySpecIdentityProvidersItemOneScopesDefault- ),- client_id: zod.string().optional(),- }),- zod.object({- kind: zod.literal('oauth2'),- id: zod.string().min(1),- binding: zod- .enum(['principal'])- .default(- agentApplicationsRevisionsPartialUpdateBodySpecIdentityProvidersItemTwoBindingDefault- ),- authorize_url: zod.url(),- token_url: zod.url(),- client_id: zod.string().min(1),- client_secret_ref: zod.string().optional(),- scopes: zod- .array(zod.string())- .default(- agentApplicationsRevisionsPartialUpdateBodySpecIdentityProvidersItemTwoScopesDefault- ),- userinfo_url: zod.url().optional(),- }),- ])- )- .default(agentApplicationsRevisionsPartialUpdateBodySpecIdentityProvidersDefault),- secrets: zod- .array(- zod.union([- zod.string().min(1),- zod.object({- name: zod.string().min(1),- allowed_hosts: zod.array(zod.string().min(1)).min(1),- }),- ])- )- .default(agentApplicationsRevisionsPartialUpdateBodySpecSecretsDefault),- limits: zod- .object({- max_turns: zod- .number()- .gt(agentApplicationsRevisionsPartialUpdateBodySpecLimitsMaxTurnsExclusiveMin)- .max(agentApplicationsRevisionsPartialUpdateBodySpecLimitsMaxTurnsMax)- .default(agentApplicationsRevisionsPartialUpdateBodySpecLimitsMaxTurnsDefault),- max_tool_calls: zod- .number()- .gt(agentApplicationsRevisionsPartialUpdateBodySpecLimitsMaxToolCallsExclusiveMin)- .max(agentApplicationsRevisionsPartialUpdateBodySpecLimitsMaxToolCallsMax)- .default(agentApplicationsRevisionsPartialUpdateBodySpecLimitsMaxToolCallsDefault),- max_wall_seconds: zod- .number()- .gt(agentApplicationsRevisionsPartialUpdateBodySpecLimitsMaxWallSecondsExclusiveMin)- .max(agentApplicationsRevisionsPartialUpdateBodySpecLimitsMaxWallSecondsMax)- .default(agentApplicationsRevisionsPartialUpdateBodySpecLimitsMaxWallSecondsDefault),- max_output_tokens: zod- .number()- .gt(agentApplicationsRevisionsPartialUpdateBodySpecLimitsMaxOutputTokensExclusiveMin)- .max(agentApplicationsRevisionsPartialUpdateBodySpecLimitsMaxOutputTokensMax)- .optional(),- max_memory_mb: zod- .number()- .gt(agentApplicationsRevisionsPartialUpdateBodySpecLimitsMaxMemoryMbExclusiveMin)- .max(agentApplicationsRevisionsPartialUpdateBodySpecLimitsMaxMemoryMbMax)- .default(agentApplicationsRevisionsPartialUpdateBodySpecLimitsMaxMemoryMbDefault),- max_cpu_cores: zod- .number()- .gt(agentApplicationsRevisionsPartialUpdateBodySpecLimitsMaxCpuCoresExclusiveMin)- .max(agentApplicationsRevisionsPartialUpdateBodySpecLimitsMaxCpuCoresMax)- .default(agentApplicationsRevisionsPartialUpdateBodySpecLimitsMaxCpuCoresDefault),- })- .default(agentApplicationsRevisionsPartialUpdateBodySpecLimitsDefault),- reasoning: zod.enum(['minimal', 'low', 'medium', 'high', 'xhigh']).optional(),- framework_prompt: zod- .object({- omit: zod- .array(- zod.enum([- 'meta_tool_guidance',- 'state_contract',- 'tool_failure_guidance',- 'approval_guidance',- 'reasoning_hint',- ])- )- .default(agentApplicationsRevisionsPartialUpdateBodySpecFrameworkPromptOmitDefault),- version_pin: zod- .number()- .gt(agentApplicationsRevisionsPartialUpdateBodySpecFrameworkPromptVersionPinExclusiveMin)- .max(agentApplicationsRevisionsPartialUpdateBodySpecFrameworkPromptVersionPinMax)- .optional(),- })- .optional(),- resume: zod- .object({- enabled: zod.boolean().default(agentApplicationsRevisionsPartialUpdateBodySpecResumeEnabledDefault),- max_completed_age_ms: zod- .number()- .gt(agentApplicationsRevisionsPartialUpdateBodySpecResumeMaxCompletedAgeMsExclusiveMin)- .max(agentApplicationsRevisionsPartialUpdateBodySpecResumeMaxCompletedAgeMsMax)- .default(agentApplicationsRevisionsPartialUpdateBodySpecResumeMaxCompletedAgeMsDefault),- })- .optional(),- })- .optional(),+ spec: zod.unknown().optional(),})/**diff --git a/products/agent_platform/services/agent-janitor/src/server.test.ts b/products/agent_platform/services/agent-janitor/src/server.test.tsindex c91093f76493..7a3c931a616d 100644--- a/products/agent_platform/services/agent-janitor/src/server.test.ts+++ b/products/agent_platform/services/agent-janitor/src/server.test.ts@@ -172,6 +172,36 @@ describe('janitor HTTP', () => {expect(Object.keys(res.body.levels)).toEqual(['low', 'medium', 'high'])})+ it('GET /spec-schema returns the full inlined agent-spec JSON Schema with descriptions', async () => {+ const { app } = mk()+ const res = await request(app).get('/spec-schema')+ expect(res.status).toBe(200)+ expect(res.body.section).toBeNull()+ const schema = res.body.spec_json_schema+ // Inlined (no $defs) so every slice is self-contained.+ expect(schema.$defs).toBeUndefined()+ expect(Object.keys(schema.properties)).toContain('models')+ // Descriptions travel with the schema — the whole point of the tool.+ expect(typeof schema.properties.models.description).toBe('string')+ })++ it('GET /spec-schema?section=models returns just the models slice', async () => {+ const { app } = mk()+ const res = await request(app).get('/spec-schema').query({ section: 'models' })+ expect(res.status).toBe(200)+ expect(res.body.section).toBe('models')+ expect(res.body.spec_json_schema.$schema).toBeTruthy()+ expect(res.body.spec_json_schema.oneOf).toHaveLength(2) // auto | manual+ })++ it('GET /spec-schema?section=bogus is a 400 listing the valid sections', async () => {+ const { app } = mk()+ const res = await request(app).get('/spec-schema').query({ section: 'bogus' })+ expect(res.status).toBe(400)+ expect(res.body.error).toBe('unknown_section')+ expect(res.body.sections).toContain('models')+ })+it('GET /sessions?application_id= returns summaries, newest first', async () => {const { queue, app } = mk()const a = { ...session('s-a'), application_id: uuidFor('app-1'), created_at: '2026-05-01T00:00:00Z' }diff --git a/products/agent_platform/services/agent-janitor/src/server.ts b/products/agent_platform/services/agent-janitor/src/server.tsindex 948ba6952133..76305392d9f9 100644--- a/products/agent_platform/services/agent-janitor/src/server.ts+++ b/products/agent_platform/services/agent-janitor/src/server.ts@@ -78,6 +78,8 @@ import {RevisionStore,SessionQueue,skillBodyPath,+ SPEC_SCHEMA_SECTIONS,+ specJsonSchema,TabularStore,verifyInternalJwt,} from '@posthog/agent-shared'@@ -458,6 +460,29 @@ export function buildJanitorApp(opts: JanitorServerOpts): Express {}))+ /* ──────────────────────────── spec schema ──────────────────────────── */+ // The agent-spec JSON Schema, emitted from the canonical zod `AgentSpecSchema`+ // (no hand-maintained mirror). Powers the `agent-applications-spec-schema` MCP+ // tool so any client can derive the full spec shape — incl. `spec.models` —+ // from the schema itself instead of guessing. `?section=` returns one+ // top-level slice (e.g. `models`, `triggers`, `limits`) to save tokens.+ app.get(+ '/spec-schema',+ asyncHandler(async (req, res) => {+ const section = typeof req.query.section === 'string' && req.query.section ? req.query.section : undefined+ const result = specJsonSchema(section)+ if (!result) {+ res.status(400).json({+ error: 'unknown_section',+ message: `Unknown spec section "${section}". Valid sections: ${SPEC_SCHEMA_SECTIONS.join(', ')}.`,+ sections: SPEC_SCHEMA_SECTIONS,+ })+ return+ }+ res.json(result)+ })+ )+/* ───────────────────────────── sessions ───────────────────────────── */app.get(diff --git a/products/agent_platform/services/agent-shared/src/index.ts b/products/agent_platform/services/agent-shared/src/index.tsindex a511fd20df89..1b008653ec1d 100644--- a/products/agent_platform/services/agent-shared/src/index.ts+++ b/products/agent_platform/services/agent-shared/src/index.ts@@ -12,6 +12,7 @@*/export * from './spec/spec'+export * from './spec/spec-json-schema'export * from './spec/slack-manifest'export * from './spec/summarize-conversation'export * from './spec/tool'diff --git a/products/agent_platform/services/agent-shared/src/runtime/gateway-catalog.ts b/products/agent_platform/services/agent-shared/src/runtime/gateway-catalog.tsindex 811699a12454..6684783a31b0 100644--- a/products/agent_platform/services/agent-shared/src/runtime/gateway-catalog.ts+++ b/products/agent_platform/services/agent-shared/src/runtime/gateway-catalog.ts@@ -152,9 +152,8 @@ export interface ModelPolicyIssue {* `haiku-4-5` will 400 at the gateway regardless of catalog state, and we'd* rather catch it at freeze than ship a session that fails on the first call.*/-// Mirror of `ModelIdSchema` in agent-shared/src/spec/spec.ts and-// `_AGENT_SPEC_JSON_SCHEMA_RAW.models.manual.models[].model.pattern` in-// backend/logic/spec_schema.py — keep all three in sync.+// Mirror of `ModelIdSchema` in agent-shared/src/spec/spec.ts (the single+// source of truth for the id format) — keep the two in sync.const MODEL_ID_PATTERN = /^[a-z0-9_-]+\/[a-zA-Z0-9._:-]+$/export function validateModelPolicy(policy: ModelPolicy, models: CatalogModel[]): ModelPolicyIssue[] {diff --git a/products/agent_platform/services/agent-shared/src/spec/spec-json-schema.test.ts b/products/agent_platform/services/agent-shared/src/spec/spec-json-schema.test.tsnew file mode 100644index 000000000000..107e32b30f98--- /dev/null+++ b/products/agent_platform/services/agent-shared/src/spec/spec-json-schema.test.ts@@ -0,0 +1,43 @@+import { describe, expect, it } from 'vitest'++import { SPEC_SCHEMA_SECTIONS, specJsonSchema } from './spec-json-schema'++describe('specJsonSchema', () => {+ it('emits the full inlined spec schema (no $defs) with rich descriptions', () => {+ const result = specJsonSchema()+ expect(result).not.toBeNull()+ expect(result?.section).toBeNull()+ const schema = result?.spec_json_schema as Record<string, any>+ // Inlined (no $ref/$defs) so every slice is self-contained.+ expect(schema.$defs).toBeUndefined()+ expect(Object.keys(schema.properties)).toEqual(SPEC_SCHEMA_SECTIONS)+ // Descriptions migrated into zod `.describe()` travel through to the schema.+ expect(typeof schema.properties.models.description).toBe('string')+ })++ it('emits the write/input shape — defaulted fields are optional', () => {+ const schema = specJsonSchema()?.spec_json_schema as Record<string, any>+ // Every top-level field has a zod default, so none are required on write.+ expect(schema.required).toBeUndefined()+ // Inside the auto policy only `mode` is required (level/optimize_for default).+ expect(schema.properties.models.oneOf[0].required).toEqual(['mode'])+ })++ it('slices one section, self-contained with its own $schema', () => {+ const result = specJsonSchema('models')+ expect(result?.section).toBe('models')+ const slice = result?.spec_json_schema as Record<string, any>+ expect(slice.$schema).toBeTruthy()+ expect(slice.oneOf).toHaveLength(2) // auto | manual+ })++ it('returns null for an unknown section', () => {+ expect(specJsonSchema('nope')).toBeNull()+ })++ it('exposes every top-level spec field as a section', () => {+ expect(SPEC_SCHEMA_SECTIONS).toEqual(+ expect.arrayContaining(['models', 'triggers', 'tools', 'mcps', 'skills', 'secrets', 'limits'])+ )+ })+})diff --git a/products/agent_platform/services/agent-shared/src/spec/spec-json-schema.ts b/products/agent_platform/services/agent-shared/src/spec/spec-json-schema.tsnew file mode 100644index 000000000000..996755b0321b--- /dev/null+++ b/products/agent_platform/services/agent-shared/src/spec/spec-json-schema.ts@@ -0,0 +1,52 @@+/**+ * The agent-spec JSON Schema, emitted from the canonical zod `AgentSpecSchema`.+ *+ * This is the SINGLE source of the spec schema for every external consumer (the+ * `agent-applications-spec-schema` MCP tool, any API client). There is no+ * hand-maintained mirror — `spec.ts` is the source of truth and this derives+ * from it, so the schema an author reads can never drift from the one the+ * runner parses.+ *+ * `io: 'input'` emits the WRITE shape — fields with a zod `.default(...)` are+ * optional (you may omit them; the default applies), which is what an author+ * actually submits. Fully inlined (no `$ref`/`$defs`) so every section slice is+ * self-contained and every field's `.describe(...)` travels with it.+ */++import { z } from 'zod'++import { AgentSpecSchema } from './spec'++const FULL_SPEC_JSON_SCHEMA = z.toJSONSchema(AgentSpecSchema, { io: 'input' }) as Record<string, unknown>++const SECTION_PROPS = (FULL_SPEC_JSON_SCHEMA.properties ?? {}) as Record<string, Record<string, unknown>>++/** Top-level spec slices a caller can request one at a time via `section`. */+export const SPEC_SCHEMA_SECTIONS: string[] = Object.keys(SECTION_PROPS)++export interface SpecJsonSchemaResult {+ /** The requested section, or null for the whole spec. */+ section: string | null+ /** A self-contained JSON Schema (inlined, no external refs). */+ spec_json_schema: Record<string, unknown>+}++/**+ * The whole agent-spec JSON Schema, or one top-level section of it (e.g.+ * `models`, `triggers`, `limits`) to save tokens when editing one part.+ * Returns `null` when `section` is given but isn't a real top-level field —+ * callers should reject and surface {@link SPEC_SCHEMA_SECTIONS}.+ */+export function specJsonSchema(section?: string | null): SpecJsonSchemaResult | null {+ if (section) {+ const slice = SECTION_PROPS[section]+ if (!slice) {+ return null+ }+ return {+ section,+ spec_json_schema: { $schema: FULL_SPEC_JSON_SCHEMA.$schema, ...slice },+ }+ }+ return { section: null, spec_json_schema: FULL_SPEC_JSON_SCHEMA }+}diff --git a/products/agent_platform/services/agent-shared/src/spec/spec.test.ts b/products/agent_platform/services/agent-shared/src/spec/spec.test.tsindex c88acc01cf57..6c92a521caa9 100644--- a/products/agent_platform/services/agent-shared/src/spec/spec.test.ts+++ b/products/agent_platform/services/agent-shared/src/spec/spec.test.ts@@ -72,8 +72,7 @@ describe('AgentSpecSchema', () => {describe('models.manual model id format', () => {// ModelIdSchema enforces `<provider>/<model-id>` so a bare id doesn't- // freeze fine and then 400 on the very first session. Mirrored by- // the Python schema in backend/logic/spec_schema.py.+ // freeze fine and then 400 on the very first session.it('rejects a bare model id (no provider prefix)', () => {expect(() =>AgentSpecSchema.parse({diff --git a/products/agent_platform/services/agent-shared/src/spec/spec.ts b/products/agent_platform/services/agent-shared/src/spec/spec.tsindex 98181be65765..8688906a8d4c 100644--- a/products/agent_platform/services/agent-shared/src/spec/spec.ts+++ b/products/agent_platform/services/agent-shared/src/spec/spec.ts@@ -15,14 +15,17 @@ import type { TriggerMetadata } from '../runtime/trigger-metadata'* Reject bare ids at authoring time so we don't freeze a revision the gateway* can't serve. `resolveModel` / `acceptedModelIds` operate on the prefixed* form; a bare `haiku-4-5` would pass `.min(1)` here, freeze, then fail the- * very first session with a 400 from the gateway. Mirror of- * `_AGENT_SPEC_JSON_SCHEMA_RAW.models.manual.models[].model.pattern` in- * `backend/logic/spec_schema.py` — keep the two in sync.+ * very first session with a 400 from the gateway. This regex is the single+ * source of truth for the id format; `gateway-catalog.ts` mirrors it for the+ * runtime servability check.*/export const ModelIdSchema = z.string().min(1).regex(/^[a-z0-9_-]+\/[a-zA-Z0-9._:-]+$/, 'model id must be "<provider>/<model-id>"')+ .describe(+ 'Canonical model id in "<provider>/<model-id>" form, e.g. anthropic/claude-sonnet-4-6. Call the agent-applications-models tool for the list of gateway-served ids; an unserved id freezes but fails the first session.'+ )/*** Auth modes. Auth is a property of the TRIGGER, not the spec — declarative@@ -417,9 +420,8 @@ export const ToolRefSchema = z.discriminatedUnion('kind', [requires_identity: z.string().optional(),}),// NOTE: the registry-pin shape `{ kind: 'custom_template', from_template,- // alias, version }` is a *draft-only* authoring shape, validated by the- // Django spec schema (`spec_schema.py`). It is deliberately NOT in this- // runtime union: freeze reshapes it into the `custom` variant above+ // alias, version }` is a *draft-only* authoring shape. It is deliberately+ // NOT in this runtime union: freeze reshapes it into the `custom` variant above// before the runner ever parses the spec, and the dispatcher assumes// every non-`client` tool carries `requires_approval`./**@@ -685,16 +687,26 @@ export type AuthConfig = z.infer<typeof AuthConfigSchema>* important so existing agents don't get reasoning charges they didn't* opt into.*/-export const ReasoningEffortSchema = z.enum(['minimal', 'low', 'medium', 'high', 'xhigh'])+export const ReasoningEffortSchema = z+ .enum(['minimal', 'low', 'medium', 'high', 'xhigh'])+ .describe(+ 'Reasoning/thinking effort budget. minimal = no deliberation (fastest, cheapest); low/medium/high add deliberation tokens and per-turn cost; xhigh = maximal (research-grade, roughly 5-10x the per-turn cost). Omit for the provider default.'+ )/** One model in a manual priority list; per-entry `reasoning` overrides the spec default. */export const ModelEntrySchema = z.object({model: ModelIdSchema,- reasoning: ReasoningEffortSchema.optional(),+ reasoning: ReasoningEffortSchema.optional().describe(+ 'Per-model reasoning effort override (else the spec default).'+ ),})/** Quality/cost level for `auto` policy; mapped to a maintained model list (below). */-export const ModelLevelSchema = z.enum(['low', 'medium', 'high'])+export const ModelLevelSchema = z+ .enum(['low', 'medium', 'high'])+ .describe(+ 'Quality/cost tier for auto. low = cheapest (short, formulaic, no-reasoning jobs); medium = balanced default (multi-step but bounded); high = top-tier (long, branching, reasoning-heavy). Resolved to a priority-ordered cross-provider model list at session start.'+ )/*** How the runner treats the priority list across a session's turns.@@ -710,24 +722,37 @@ export const ModelLevelSchema = z.enum(['low', 'medium', 'high'])* it doesn't thrash) but DOES fail over to the next model on failure, trading* that cold-cache re-read for keeping the session alive.*/-export const ModelOptimizeForSchema = z.enum(['cost', 'availability'])+export const ModelOptimizeForSchema = z+ .enum(['cost', 'availability'])+ .describe(+ 'Session model stability vs. resilience. cost (default): the first turn pins a working model for the whole session, keeping the provider prompt cache warm (cache reads roughly 0.1-0.5x of full input) and never failing over mid-session; if the pinned model goes down the turn fails rather than cold-re-reading context on another provider. availability: fail over to the next model on failure, surviving an outage at the cost of a one-time cold re-read. Prefer cost for long/expensive sessions, availability where uptime matters more than spend.'+ )/** `auto`: platform resolves `level` to a priority-ordered list at runtime.* `manual`: author's explicit priority list.* `optimize_for` (both): session model stability vs. resilience — see above. */-export const ModelPolicySchema = z.discriminatedUnion('mode', [- z.object({- mode: z.literal('auto'),- level: ModelLevelSchema.default('medium'),- reasoning: ReasoningEffortSchema.optional(),- optimize_for: ModelOptimizeForSchema.default('cost'),- }),- z.object({- mode: z.literal('manual'),- models: z.array(ModelEntrySchema).min(1),- optimize_for: ModelOptimizeForSchema.default('cost'),- }),-])+export const ModelPolicySchema = z+ .discriminatedUnion('mode', [+ z.object({+ mode: z.literal('auto'),+ level: ModelLevelSchema.default('medium'),+ reasoning: ReasoningEffortSchema.optional(),+ optimize_for: ModelOptimizeForSchema.default('cost'),+ }),+ z.object({+ mode: z.literal('manual'),+ models: z+ .array(ModelEntrySchema)+ .min(1)+ .describe(+ 'Explicit priority-ordered fallback list — the runner tries entries in order, primary first. Order it provider-diverse so one provider outage degrades to the next vendor instead of failing.'+ ),+ optimize_for: ModelOptimizeForSchema.default('cost'),+ }),+ ])+ .describe(+ 'How this agent selects its model. auto (default): pick a quality/cost level and the platform resolves it to a maintained, priority-ordered, cross-provider list at runtime — rides model upgrades and cross-provider fallback for free. manual: give an explicit priority-ordered models list (primary first); opts out of platform upgrades, so use only when a specific model is required.'+ )/** `auto` level → priority-ordered, cross-provider list (also the fallback chain).* The curated grouping layer over the gateway catalog: ids here MUST be@@ -844,13 +869,42 @@ export type IdentityProviderConfig = z.infer<typeof IdentityProviderConfigSchemaexport const AgentSpecSchema = z.object({/** Model selection: auto level (default) or manual priority list. Resolve via `modelPolicyToList`. */models: ModelPolicySchema.default({ mode: 'auto', level: 'medium', optimize_for: 'cost' }),- triggers: z.array(TriggerSchema).default([]),- tools: z.array(ToolRefSchema).default([]),- mcps: z.array(McpRefSchema).default([]),- skills: z.array(SkillRefSchema).default([]),- /** Identity providers users can link against (the credential axis). */- identity_providers: z.array(IdentityProviderConfigSchema).default([]),- secrets: z.array(SecretRefSchema).default([]),+ triggers: z+ .array(TriggerSchema)+ .describe(+ 'How sessions start. Each entry is one trigger (a discriminated union on type: slack, webhook, cron, chat, mcp); an agent can be reachable several ways. Empty = no external triggers (preview/manual runs only).'+ )+ .default([]),+ tools: z+ .array(ToolRefSchema)+ .describe(+ 'Tools the agent can call. kind native = @posthog/* built-ins (call the agent-native-tools-list tool for valid ids), custom = author-written TypeScript, client = fulfilled by the connecting app. Empty = no tools.'+ )+ .default([]),+ mcps: z+ .array(McpRefSchema)+ .describe(+ 'External MCP servers the agent connects to at session start. Each remote tool is exposed to the model name-prefixed by the entry id; auth.provider links a per-user identity, secrets/headers cover bring-your-own-token.'+ )+ .default([]),+ skills: z+ .array(SkillRefSchema)+ .describe(+ 'Skill references (id + path) listed in the system-prompt index; the model loads one on demand. Server-derived at freeze — set these via the skill-refs endpoints, not authored inline.'+ )+ .default([]),+ identity_providers: z+ .array(IdentityProviderConfigSchema)+ .describe(+ 'Identity providers users can link against so the agent can act AS the user (the credential axis). kind posthog = managed (provisioned on promote), oauth2 = bring-your-own third-party app.'+ )+ .default([]),+ secrets: z+ .array(SecretRefSchema)+ .describe(+ 'Secret names this agent can resolve from its encrypted env. Bare string = resolvable but no network-egress authority; object form pins the secret to allowed_hosts so @posthog/http-request may send it there.'+ )+ .default([]),limits: SpecLimitsSchema.default({max_turns: 50,max_tool_calls: 200,@@ -858,9 +912,15 @@ export const AgentSpecSchema = z.object({max_memory_mb: 512,max_cpu_cores: 0.25,}),- reasoning: ReasoningEffortSchema.optional(),- framework_prompt: FrameworkPromptConfigSchema.optional(),- resume: ResumeConfigSchema.optional(),+ reasoning: ReasoningEffortSchema.describe(+ 'Spec-wide default reasoning effort, applied to every model unless a model policy entry overrides it. Omit for the provider default.'+ ).optional(),+ framework_prompt: FrameworkPromptConfigSchema.describe(+ 'Advanced: tune or pin the framework-injected system-prompt preamble. Rarely needed.'+ ).optional(),+ resume: ResumeConfigSchema.describe(+ 'Per-agent resumability — keep completed sessions reachable longer than the platform default (e.g. a Slack thread watched across a whole sprint).'+ ).optional(),})export type AgentSpec = z.infer<typeof AgentSpecSchema>diff --git a/products/agent_platform/services/agent-tests/src/cases/example-agent-builder.test.ts b/products/agent_platform/services/agent-tests/src/cases/example-agent-builder.test.tsindex 25423f01a754..f74a6dba16f6 100644--- a/products/agent_platform/services/agent-tests/src/cases/example-agent-builder.test.ts+++ b/products/agent_platform/services/agent-tests/src/cases/example-agent-builder.test.ts@@ -4,8 +4,8 @@* The Agent Builder authors + operates other agents through the PostHog MCP* (one `spec.mcps[]` entry authed by the `posthog` identity provider), acting* as the asking user — the same pattern as `posthog-ai`, applied to the- * authoring surface. It keeps only its own runtime natives (`@posthog/memory-*`)- * and the PostHog Code client/UI tools. Destructive authoring ops+ * authoring surface. It keeps only its own runtime natives (`@posthog/memory-*`+ * plus `@posthog/web-search`) and the PostHog Code client/UI tools. Destructive authoring ops* (`promote` / `archive` / `destroy`) are approval-gated on the MCP `tools[]`* allow-list (`requires_approval` + `approval_policy`), so the platform — not* just the prompt — holds them. This case pins that wiring net; drift here@@ -65,13 +65,13 @@ describe('example: agent-builder bundle', () => {expect(parsed.mcps[0].tools?.length ?? 0).toBeGreaterThan(20)})- it('keeps only its own runtime natives (memory) — no native agent-applications tools', async () => {+ it('keeps only its own runtime natives (memory + web-search) — no native agent-applications tools', async () => {const { spec } = await loadBundle()const parsed = AgentSpecSchema.parse(spec)const nativeIds = parsed.tools.filter((t) => t.kind === 'native').map((t) => t.id)// The authoring surface moved to the MCP; the only natives left are the- // agent's own S3 memory tools.- expect(nativeIds.every((id) => id.startsWith('@posthog/memory-'))).toBe(true)+ // agent's own runtime tools — S3 memory plus web search.+ expect(nativeIds.every((id) => id.startsWith('@posthog/memory-') || id === '@posthog/web-search')).toBe(true)expect(nativeIds.some((id) => id.startsWith('@posthog/agent-applications-'))).toBe(false)// Whatever natives remain must still resolve in the catalog.const catalog = new Set(listNativeTools().map((t) => t.id))diff --git a/products/agent_platform/services/agent-tests/src/examples/agent-builder/README.md b/products/agent_platform/services/agent-tests/src/examples/agent-builder/README.mdindex ee32f37bfe37..ec647d6a7599 100644--- a/products/agent_platform/services/agent-tests/src/examples/agent-builder/README.md+++ b/products/agent_platform/services/agent-tests/src/examples/agent-builder/README.md@@ -132,7 +132,7 @@ agent-applications-revisions-create application_id=<id># agent-applications-revisions-agent-md-update / -tools-update# kernel skills are injected from backend code at freeze (no author step);# store skills come from the store: llm-skills-create / -search, then-# agent-applications-revisions-skill-refs-set+# agent-applications-revisions-skill-refs-updateagent-applications-revisions-partial-update revision_id=<rid> spec=<contents of spec.json>agent-applications-revisions-validate-create revision_id=<rid>agent-applications-revisions-freeze-create revision_id=<rid>diff --git a/products/agent_platform/services/agent-tests/src/examples/agent-builder/agent.md b/products/agent_platform/services/agent-tests/src/examples/agent-builder/agent.mdindex a91b1e5cf5ff..e3daaf0758d5 100644--- a/products/agent_platform/services/agent-tests/src/examples/agent-builder/agent.md+++ b/products/agent_platform/services/agent-tests/src/examples/agent-builder/agent.md@@ -210,14 +210,14 @@ Examples (bad — vague, no commitment):You call a few classes of tool. Mistaking which class a tool is inis a routine cause of confusion; keep the table in mind.-| Class | Examples | When you use it |-| ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |-| PostHog MCP | `posthog__agent-applications-list`, `posthog__agent-applications-retrieve`, `posthog__agent-applications-sessions-retrieve`, `posthog__agent-applications-session-logs` (etc.) | The bulk of your work. Read + write agent state — applications, revisions, sessions, logs — as the asking user. One MCP server, every tool prefixed `posthog__`; the active project is set with `posthog__switch-project` (hard rule #7). |-| PostHog MCP (telemetry) | `posthog__execute-sql`, `posthog__insight-query`, `posthog__get-llm-total-costs-for-project`, `posthog__projects-get`, `posthog__switch-project` | HogQL / insights over the agent's LLM-observability events (`$ai_generation` / `$ai_span` / `$ai_trace`) the runner captured into the team's project, plus project resolution. Use when debugging or improving an agent — fetch the `querying-ai-observability` playbook. |-| PostHog MCP (authoring aids) | `posthog__agent-native-tools-list`, `posthog__agent-resolve-resource` | Ground truth for building/editing: `agent-native-tools-list` is the catalog of valid native tool ids; `agent-resolve-resource` is **the** source for builder playbooks — pass a playbook id and it returns the doc plus the live, scope-aware tool surface. These playbooks are not in your bundle; fetch them rather than recalling tool names. |-| Native (memory) | `@posthog/memory-search`, `@posthog/memory-read`, `@posthog/memory-write` | Your own durable memory — persist a fleet-audit report. Used by `skills/auditing-the-fleet` when a user asks for a fleet-wide sweep. |-| Identity | `@posthog/identity-connect` | Mint a connect / reconnect link for the user's PostHog account — relay it as a markdown link when a capability needs an account that isn't linked yet (Slack). See "Acting as the user". |-| Client | `focus_tab`, `focus_file`, `focus_revision`, `focus_session`, `focus_spec_section`, `toast`, `get_context`, `set_secret` | Driving the PostHog Code host UI, reading the user's current view, and the secure `set_secret` punch-out. Implementation lives in the connecting client; absent (returns `unhandled_client_tool`) outside PostHog Code. |+| Class | Examples | When you use it |+| ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |+| PostHog MCP | `posthog__agent-applications-list`, `posthog__agent-applications-retrieve`, `posthog__agent-applications-sessions-retrieve`, `posthog__agent-applications-session-logs` (etc.) | The bulk of your work. Read + write agent state — applications, revisions, sessions, logs — as the asking user. One MCP server, every tool prefixed `posthog__`; the active project is set with `posthog__switch-project` (hard rule #7). |+| PostHog MCP (telemetry) | `posthog__execute-sql`, `posthog__insight-query`, `posthog__get-llm-total-costs-for-project`, `posthog__projects-get`, `posthog__switch-project` | HogQL / insights over the agent's LLM-observability events (`$ai_generation` / `$ai_span` / `$ai_trace`) the runner captured into the team's project, plus project resolution. Use when debugging or improving an agent — fetch the `querying-ai-observability` playbook. |+| PostHog MCP (authoring aids) | `posthog__agent-applications-spec-schema`, `posthog__agent-native-tools-list`, `posthog__agent-applications-models`, `posthog__agent-resolve-resource` | Ground truth for building/editing: `agent-applications-spec-schema` returns the canonical spec JSON Schema (pass `section`, e.g. `models`, for one slice) — read it before hand-writing any `spec`; `agent-native-tools-list` is the catalog of valid native tool ids; `agent-applications-models` is the served-model catalog for `spec.models`; `agent-resolve-resource` is **the** source for builder playbooks — pass a playbook id and it returns the doc plus the live, scope-aware tool surface. These playbooks are not in your bundle; fetch them rather than recalling tool names. |+| Native (memory) | `@posthog/memory-search`, `@posthog/memory-read`, `@posthog/memory-write` | Your own durable memory — persist a fleet-audit report. Used by `skills/auditing-the-fleet` when a user asks for a fleet-wide sweep. |+| Identity | `@posthog/identity-connect` | Mint a connect / reconnect link for the user's PostHog account — relay it as a markdown link when a capability needs an account that isn't linked yet (Slack). See "Acting as the user". |+| Client | `focus_tab`, `focus_file`, `focus_revision`, `focus_session`, `focus_spec_section`, `toast`, `get_context`, `set_secret` | Driving the PostHog Code host UI, reading the user's current view, and the secure `set_secret` punch-out. Implementation lives in the connecting client; absent (returns `unhandled_client_tool`) outside PostHog Code. |### The agent-management tools@@ -258,7 +258,7 @@ you already have. Slug lookup costs an extra `list` call internally.| `agent-applications-revisions-partial-update` | replace `spec` on a draft revision (triggers, tools, model, limits, auth…). Only `state=draft` accepts spec edits. || `agent-applications-revisions-agent-md-update` | overwrite `agent.md` (the system prompt) on a draft. || `llm-skills-search` / `llm-skills-create` | find or author a skill in the llma-skill store (the canonical place skills live). |-| `agent-applications-revisions-skill-refs-set` | set the draft's `skill_refs` (which store skills it pins, by name + alias + optional version). Resolved into the bundle at freeze. |+| `agent-applications-revisions-skill-refs-update` | set the draft's `skill_refs` (which store skills it pins, by name + alias + optional version). Resolved into the bundle at freeze. || `agent-applications-revisions-tools-update` / `-tools-destroy` | upsert or delete one custom tool (source + schema) on a draft. || `agent-applications-revisions-validate-create` | pre-flight check on any revision state. Surfaces missing entrypoints, unknown tool ids, missing trigger-required secrets. Always run before freeze. || `agent-applications-revisions-freeze-create` | flip `draft → ready` and stamp `bundle_sha256`. Idempotent. |diff --git a/products/agent_platform/services/agent-tests/src/examples/agent-builder/spec.json b/products/agent_platform/services/agent-tests/src/examples/agent-builder/spec.jsonindex 1dddffad2365..961ae8c95e55 100644--- a/products/agent_platform/services/agent-tests/src/examples/agent-builder/spec.json+++ b/products/agent_platform/services/agent-tests/src/examples/agent-builder/spec.json@@ -62,6 +62,10 @@"kind": "native","id": "@posthog/memory-write"},+ {+ "kind": "native",+ "id": "@posthog/web-search"+ },{"kind": "client","id": "focus_tab",@@ -232,7 +236,7 @@"agent-applications-revisions-clone-from-create","agent-applications-revisions-partial-update","agent-applications-revisions-agent-md-update",- "agent-applications-revisions-skill-refs-set",+ "agent-applications-revisions-skill-refs-update","llm-skills-search","llm-skills-create","agent-applications-revisions-tools-update",@@ -252,6 +256,7 @@"agent-native-tools-list","agent-resolve-resource","agent-applications-models",+ "agent-applications-spec-schema","execute-sql","insight-query","get-llm-total-costs-for-project",diff --git a/products/agent_platform/services/agent-tools/src/registry.ts b/products/agent_platform/services/agent-tools/src/registry.tsindex baf24a372de8..e59e033fecf0 100644--- a/products/agent_platform/services/agent-tools/src/registry.ts+++ b/products/agent_platform/services/agent-tools/src/registry.ts@@ -57,7 +57,6 @@ import {} from './tools/posthog-agent-management.v1'import { posthogListProjectsV1 } from './tools/posthog-projects.v1'import { posthogQueryV1 } from './tools/posthog-query.v1'-import { posthogAgentApplicationsSpecSchemaV1 } from './tools/posthog-spec-schema.v1'import {slackPostMessageV1,slackReactV1,@@ -149,7 +148,6 @@ export const ALL_TOOLS: NativeTool[] = [posthogAgentApplicationsSessionsRetrieveV1,posthogAgentApplicationsSessionLogsV1,nativeToolsCatalogV1,- posthogAgentApplicationsSpecSchemaV1,slackPostMessageV1,slackUpdateMessageV1,slackReadChannelV1,diff --git a/products/agent_platform/services/agent-tools/src/tools/posthog-spec-schema.v1.test.ts b/products/agent_platform/services/agent-tools/src/tools/posthog-spec-schema.v1.test.tsdeleted file mode 100644index b491a3470a40..000000000000--- a/products/agent_platform/services/agent-tools/src/tools/posthog-spec-schema.v1.test.ts+++ /dev/null@@ -1,74 +0,0 @@-import { describe, expect, it } from 'vitest'--import type { ToolContext } from '@posthog/agent-shared'--import { getNativeTool } from '../registry'-import { posthogAgentApplicationsSpecSchemaV1 } from './posthog-spec-schema.v1'--const run = (args: { section?: string } = {}): ReturnType<typeof posthogAgentApplicationsSpecSchemaV1.run> =>- posthogAgentApplicationsSpecSchemaV1.run(args as never, {} as ToolContext)--describe('@posthog/agent-applications-spec-schema', () => {- it('is registered and resolvable by id', () => {- expect(getNativeTool('@posthog/agent-applications-spec-schema')).toBe(posthogAgentApplicationsSpecSchemaV1)- })-- it('returns the full spec JSON Schema when no section is given', async () => {- const result = await run()- expect(result.section).toBeNull()- const schema = result.spec_json_schema as Record<string, unknown>- expect(schema.type).toBe('object')- expect((schema.required as string[]) ?? []).toContain('models')- expect(schema.properties).toHaveProperty('triggers')- expect(schema.properties).toHaveProperty('tools')- expect(schema.properties).toHaveProperty('secrets')- })-- it('dedupes repeated subschemas into $defs to keep the payload small', async () => {- const { spec_json_schema } = await run()- // `reused: 'ref'` hoists the auth-mode union / approval policy into- // $defs instead of inlining a copy per trigger/tool — the whole point- // of the token-spend fix. Assert the $ref machinery is actually used.- expect(spec_json_schema.$defs).not.toBeUndefined()- expect(JSON.stringify(spec_json_schema)).toContain('$ref')- })-- it('encodes the exact constructs that trip up authoring', async () => {- const blob = JSON.stringify((await run()).spec_json_schema)- expect(blob).toContain('acknowledge_public_exposure')- expect(blob).toContain('allowed_hosts')- expect(blob).toContain('xhigh')- expect(blob).toContain('trusted_workspaces')- })-- it('returns only the requested slice for a section (much cheaper than the whole spec)', async () => {- const full = JSON.stringify((await run()).spec_json_schema)- const triggers = await run({ section: 'triggers' })- expect(triggers.section).toBe('triggers')- const triggersBlob = JSON.stringify(triggers.spec_json_schema)- // The triggers slice carries trigger constructs but not, say, the spec's- // limits field, and is meaningfully smaller than the full schema.- expect(triggersBlob).toContain('trusted_workspaces')- expect(triggersBlob.length).toBeLessThan(full.length)-- const limits = await run({ section: 'limits' })- expect(limits.section).toBe('limits')- const limitsBlob = JSON.stringify(limits.spec_json_schema)- expect(limitsBlob).toContain('max_wall_seconds')- expect(limitsBlob.length).toBeLessThan(triggersBlob.length)- })-- it('scopes notes to the requested section', async () => {- const triggers = await run({ section: 'triggers' })- expect(triggers.notes.length).toBeGreaterThan(0)- expect(triggers.notes.join(' ')).toMatch(/discriminated union on `type`/i)- // A section fetch must not be padded with notes about other sections.- expect(triggers.notes.join(' ')).not.toContain('allowed_hosts')- })-- it('falls back to the full schema for an unknown section', async () => {- const result = await run({ section: 'nonsense' })- expect(result.section).toBeNull()- expect(result.spec_json_schema.properties).toHaveProperty('triggers')- })-})diff --git a/products/agent_platform/services/agent-tools/src/tools/posthog-spec-schema.v1.ts b/products/agent_platform/services/agent-tools/src/tools/posthog-spec-schema.v1.tsdeleted file mode 100644index b64784dd8389..000000000000--- a/products/agent_platform/services/agent-tools/src/tools/posthog-spec-schema.v1.ts+++ /dev/null@@ -1,135 +0,0 @@-/**- * `@posthog/agent-applications-spec-schema` — the authoring concierge's- * ground-truth view of the agent `spec` shape, so it stops guessing the- * structure from (drift-prone) skill docs or reverse-engineering other- * agents' revisions.- *- * Sibling of `@posthog/agent-applications-native-tools-list`: that tool- * discovers valid tool *ids*; this one discovers the spec *shape* those ids- * slot into. The JSON Schema is generated at call time from the canonical Zod- * `AgentSpecSchema` (the same schema the runner parses and the Django write- * path mirrors), so it cannot drift from what the API actually validates.- *- * Two things keep the result cheap. `reused: 'ref'` hoists repeated- * subschemas (the auth-mode union, the approval policy) into `$defs` instead- * of inlining each copy — the union alone is otherwise emitted once per- * chat/mcp/webhook trigger. And an optional `section` returns just one slice- * of the spec (`triggers` is ~half the whole thing), so the common- * "edit one part" path pays for that part only. Defined as a static, no-auth- * read: computed in-process with no API round-trip.- */--import { z } from 'zod'--import {- AgentSpecSchema,- AuthConfigSchema,- defineNativeTool,- FrameworkPromptConfigSchema,- McpRefSchema,- ReasoningEffortSchema,- ResumeConfigSchema,- SecretRefSchema,- SkillRefSchema,- SpecLimitsSchema,- ToolRefSchema,- TriggerSchema,- Type,-} from '@posthog/agent-shared'--// One spec slice each. `triggers`/`tools`/`secrets` are the element schemas-// (the spec field is an array of these); the rest are the field schema itself.-const SECTION_SCHEMAS = {- triggers: TriggerSchema,- tools: ToolRefSchema,- mcps: McpRefSchema,- secrets: SecretRefSchema,- skills: SkillRefSchema,- limits: SpecLimitsSchema,- auth: AuthConfigSchema,- reasoning: ReasoningEffortSchema,- framework_prompt: FrameworkPromptConfigSchema,- resume: ResumeConfigSchema,-} as const--type Section = keyof typeof SECTION_SCHEMAS-const SECTION_IDS = Object.keys(SECTION_SCHEMAS) as Section[]--// Pure derivations from the canonical schema — compute once at module load.-// `reused: 'ref'` dedupes shared subschemas into `$defs`.-const toJson = (schema: z.ZodType): Record<string, unknown> =>- z.toJSONSchema(schema, { reused: 'ref' }) as Record<string, unknown>-const FULL_SCHEMA = toJson(AgentSpecSchema)-const SECTION_JSON: Record<string, Record<string, unknown>> = Object.fromEntries(- SECTION_IDS.map((id) => [id, toJson(SECTION_SCHEMAS[id])])-)--/**- * Orientation the bare JSON Schema doesn't make obvious. Kept short on purpose- * — the schema is authoritative; these point at the surrounding tools and the- * discriminated unions that are the usual source of validation errors. Scoped- * per section so a one-slice fetch isn't padded with notes about the rest.- */-const SHARED_NOTE =- 'Canonical agent `spec` schema, generated from the source the API validates writes against — match it exactly. Fields with a JSON Schema `default` are optional on write.'-const SECTION_NOTES: Record<string, string[]> = {- triggers: [- '`triggers[]` is a discriminated union on `type`. `chat`, `mcp`, and `webhook` carry an `auth` block; `slack` and `cron` authenticate via their own protocol and have none.',- 'Trigger-required secrets (`SLACK_SIGNING_SECRET`, `SLACK_BOT_TOKEN` for `slack`) are NOT in `spec.secrets[]` — they come from the platform `TRIGGER_REQUIRED_SECRETS` registry and live in `encrypted_env`.',- ],- tools: [- '`tools[]` is a discriminated union on `kind` (`native` | `custom` | `client`). For valid `native` ids call `@posthog/agent-applications-native-tools-list` — the validator rejects unknown ids.',- 'Skills come from the llma-skill store: author/find with `@posthog/llm-skills-create` / `@posthog/llm-skills-search`, then reference them with `@posthog/agent-applications-revisions-skill-refs-set` (they are NOT authored inline). Custom-tool *content* is uploaded via `-tools-update`, not inline in the spec.',- ],- secrets: [- '`secrets[]` entries are a bare string (resolvable, no egress authority) or `{ name, allowed_hosts }` (required to let `@posthog/http-request` send the secret to those hosts).',- ],-}-const FULL_NOTES = [- SHARED_NOTE,- '`model` is the only always-required field.',- ...(SECTION_NOTES.triggers ?? []),- ...(SECTION_NOTES.tools ?? []),- ...(SECTION_NOTES.secrets ?? []),-]--export const posthogAgentApplicationsSpecSchemaV1 = defineNativeTool({- id: '@posthog/agent-applications-spec-schema',- description: [- 'Return the JSON Schema for an agent `spec` — every field, type, enum, default, and the',- 'discriminated unions for `triggers[]` / `tools[]` / `secrets[]`. Call this BEFORE writing or',- 'editing a spec instead of guessing the shape or copying another agent. Generated from the',- 'canonical schema the API validates against, so it never drifts. Pass `section` (e.g. `triggers`,',- '`tools`, `limits`) to fetch just that slice when you are only editing one part — much cheaper',- 'than the whole spec. Omit `section` for the full schema.',- ].join(' '),- args: Type.Object({- section: Type.Optional(- Type.Union(- SECTION_IDS.map((id) => Type.Literal(id)),- {- description:- 'Return only this part of the spec to save tokens. Omit for the whole spec. `triggers` alone is ~half the full schema.',- }- )- ),- }),- returns: Type.Object({- section: Type.Union([Type.String(), Type.Null()]),- spec_json_schema: Type.Record(Type.String(), Type.Unknown()),- notes: Type.Array(Type.String()),- }),- cost_hint: 'cheap',- async run(args) {- const section = args.section ?? null- if (section && SECTION_JSON[section]) {- const extra = SECTION_NOTES[section]- return {- section,- spec_json_schema: SECTION_JSON[section],- notes: extra ? [SHARED_NOTE, ...extra] : [SHARED_NOTE],- }- }- return { section: null, spec_json_schema: FULL_SCHEMA, notes: [...FULL_NOTES] }- },-})diff --git a/pyproject.toml b/pyproject.tomlindex 241b1cbb33f0..d4c3bde01cc4 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -511,7 +511,6 @@ ignore_imports = ["products.**.backend.presentation.** -> products.**.backend.presentation.**",# data_modeling — presentation wave deferred (views routed through the facade in a follow-up)# TODO: existing violations — fix by routing through facade- "products.agent_platform.backend.presentation.serializers -> products.agent_platform.backend.logic.spec_schema","products.agent_platform.backend.presentation.serializers -> products.agent_platform.backend.models","products.agent_platform.backend.presentation.views -> products.agent_platform.backend.db","products.agent_platform.backend.presentation.views -> products.agent_platform.backend.logic.internal_jwt",diff --git a/services/mcp/definitions/agent_platform.yaml b/services/mcp/definitions/agent_platform.yamlindex f03ae07cd7d2..433295fa9acc 100644--- a/services/mcp/definitions/agent_platform.yaml+++ b/services/mcp/definitions/agent_platform.yaml@@ -597,6 +597,22 @@ tools:`conversation_total_turns` tells you how much was hidden, and `usage_total` is still computed over the fulluntrimmed conversation so cost reporting stays accurate. Playbook: read the `debugging-sessions` playbookvia `agent-resolve-resource` for the failure taxonomy and how to read the logs.+ agent-applications-spec-schema:+ operation: agent_applications_spec_schema+ enabled: true+ scopes:+ - agents:read+ annotations:+ readOnly: true+ destructive: false+ idempotent: true+ title: Get the agent spec JSON schema+ description: >+ The canonical JSON Schema for an agent `spec` — every field, type, enum, default, and the discriminated+ unions for `models` / `triggers[]` / `tools[]`, each with an inline description. Emitted from the same+ source the runner validates against, so fields with a default are optional on write. Read this BEFORE+ composing a spec for `agent-applications-revisions-spec-update` (or create) instead of guessing the shape.+ Pass `section` (e.g. `models`, `triggers`, `tools`, `limits`) to fetch just one slice and save tokens.agent-applications-stats:operation: agent_applications_statsenabled: falsediff --git a/services/mcp/playbooks/authoring-new-agents/SKILL.md b/services/mcp/playbooks/authoring-new-agents/SKILL.mdindex bd7f3145c0a1..cfbd5f3de283 100644--- a/services/mcp/playbooks/authoring-new-agents/SKILL.md+++ b/services/mcp/playbooks/authoring-new-agents/SKILL.md@@ -62,8 +62,9 @@ with `posthog__agent-native-tools-list`.Sketch the spec in your head / out loud with the user, BEFOREcalling any create endpoint. Cover:-- **`model`** — start with `anthropic/claude-sonnet-4-6` unless- the user has a preference. It's the platform default.+- **`models`** — leave it at the default (`auto` / `medium`) unless the+ user has a preference; don't hardcode a model id. Load+ `skills/choosing-the-model` to match the policy to the job.- **`triggers`** — one is fine; many is fine; pick what the userasked for. Each trigger has its own config.- **`tools[]`** — minimum needed for the job. Don't pre-emptively@@ -183,15 +184,15 @@ provider + scopes.The authoring surface is **typed resources, not file paths**. Younever write a path; you upsert a typed object via one of these calls:-| Resource | Tool | Body shape |-| -------------- | ------------------------------------------------------- | ------------------------------------------------------ |-| System prompt | `posthog__agent-applications-revisions-agent-md-update` | `{ content }` |-| Spec | `posthog__agent-applications-revisions-partial-update` | `{ spec }` (author-facing slice — no skills/tools) |-| Author a skill | `posthog__llm-skills-create` | `{ name, description, body, files? }` (in the store) |-| Find skills | `posthog__llm-skills-search` | `{ search? }` |-| Pin skills | `posthog__agent-applications-revisions-skill-refs-set` | `{ skill_refs: [{ from_template, alias, version? }] }` |-| One tool | `posthog__agent-applications-revisions-tools-update` | `{ description, args_schema, source }` |-| Delete tool | `posthog__agent-applications-revisions-tools-destroy` | (no body) |+| Resource | Tool | Body shape |+| -------------- | --------------------------------------------------------- | ------------------------------------------------------ |+| System prompt | `posthog__agent-applications-revisions-agent-md-update` | `{ content }` |+| Spec | `posthog__agent-applications-revisions-partial-update` | `{ spec }` (author-facing slice — no skills/tools) |+| Author a skill | `posthog__llm-skills-create` | `{ name, description, body, files? }` (in the store) |+| Find skills | `posthog__llm-skills-search` | `{ search? }` |+| Pin skills | `posthog__agent-applications-revisions-skill-refs-update` | `{ skill_refs: [{ from_template, alias, version? }] }` |+| One tool | `posthog__agent-applications-revisions-tools-update` | `{ description, args_schema, source }` |+| Delete tool | `posthog__agent-applications-revisions-tools-destroy` | (no body) |**`spec.skills[]` and `spec.tools[]` are server-derived at freeze.**You can't write them via `partial-update`. The janitor scans the typed@@ -283,10 +284,10 @@ by tweaking the export style; the contract is `{actions: {default:fn}}` and nothing else.Use the **single-resource** typed PUTs (`tools-update`,-`agent-md-update`) and `skill-refs-set` for individual edits. There is+`agent-md-update`) and `skill-refs-update` for individual edits. There isno bulk bundle-replace verb — edit the one resource that changed ratherthan rewriting the whole bundle. Skills are authored in the store-(`llm-skills-create`) and pinned with `skill-refs-set`, never inline.+(`llm-skills-create`) and pinned with `skill-refs-update`, never inline.## Phase 6 — validatediff --git a/services/mcp/playbooks/choosing-the-model/SKILL.md b/services/mcp/playbooks/choosing-the-model/SKILL.mdindex 7bfc17543379..17f2f97c2c9e 100644--- a/services/mcp/playbooks/choosing-the-model/SKILL.md+++ b/services/mcp/playbooks/choosing-the-model/SKILL.md@@ -11,33 +11,27 @@ the cheapest either. Match the policy to the job.## auto is the default — start there-The model lives in `spec.models`, a discriminated union on-`mode`:--- **`auto`** (the default for almost every agent) — you pick a- `level` (`low` / `medium` / `high`, default `medium`) and the- platform resolves it to a maintained, priority-ordered,- cross-provider model list at runtime. The list is kept current as- models ship and prices move, so an `auto` agent rides upgrades- without a spec edit and falls back across providers automatically.-- **`manual`** — an explicit, author-ordered priority list. Only- reach for this when the agent genuinely needs a specific model- (a fine-tune, a capability only one model has, a contractual /- compliance pin). It opts you OUT of platform model upgrades.--```jsonc-// auto — the recommendation for most agents-{ "models": { "mode": "auto", "level": "medium" } }--// auto with reasoning, when the job benefits from deliberation-{ "models": { "mode": "auto", "level": "high", "reasoning": "high" } }--// manual — explicit, PROVIDER-DIVERSE priority list-{ "models": { "mode": "manual", "models": [- { "model": "anthropic/claude-sonnet-4-6", "reasoning": "high" },- { "model": "openai/gpt-5" }-] } }-```+`spec.models` is a discriminated union on `mode`. For the exact shape —+every field, enum, and default — call+`@posthog/agent-applications-spec-schema` with `section: "models"` rather+than reciting it from memory; it stays current as the schema moves. The+`mode`, `level`, and `reasoning` names used throughout this skill are the+set that exists _today_ — if the schema returns a different set, the schema+wins. The judgment that schema can't give you is below.++- **`auto`** (the default for almost every agent) — pick a `level`+ (`low` / `medium` / `high`) and the platform resolves it to a+ maintained, priority-ordered, cross-provider list at runtime, so the+ agent rides model upgrades and cross-provider fallback for free.+- **`manual`** — an explicit, author-ordered priority list. Reach for it+ only when the agent genuinely needs a specific model (a fine-tune, a+ capability only one model has, a contractual / compliance pin); it opts+ you OUT of platform upgrades.++`optimize_for` (on either mode) trades cost for resilience: `cost`+(default) pins one model for the session to keep its prompt cache warm;+`availability` fails over on outage at the price of a one-time cold+re-read. Leave it at `cost` unless uptime matters more than spend.## The cost / quality axes@@ -99,10 +93,14 @@ same provider as the primary doesn't help when that provider is thething that's down — list a different vendor next so an outage degradesinstead of failing.-- Good: `[ anthropic/claude-sonnet-4-6, openai/gpt-5 ]` — Anthropic- down → OpenAI catches it.-- Pointless: `[ anthropic/claude-sonnet-4-6,-anthropic/claude-haiku-4-5 ]` — one provider outage takes out both.+- Good: a primary from one vendor, then a model from a _different_ vendor —+ if the first vendor has an outage, the other still answers.+- Pointless: two models from the _same_ vendor — one provider outage takes+ out both.++Don't hardcode model ids from memory — they get added and retired. Call+`@posthog/agent-applications-models` for the currently served ids (grouped by+provider) and pick the primary + a different-vendor fallback from that.Set per-model `reasoning` when the fallback should think differentlyfrom the primary (e.g. high on the primary, unset on a cheaperdiff --git a/services/mcp/playbooks/cost-and-quota-analysis/SKILL.md b/services/mcp/playbooks/cost-and-quota-analysis/SKILL.mdindex 19095b11fc22..a99926a7c9ef 100644--- a/services/mcp/playbooks/cost-and-quota-analysis/SKILL.md+++ b/services/mcp/playbooks/cost-and-quota-analysis/SKILL.md@@ -220,14 +220,14 @@ daily-digest? show the 30d trend graph?Useful to know when someone asks "how do I make it cheaper?":-| Lever | Effect |-| ---------------------------------- | ------------------------------------------------------------------- |-| Model (`spec.models`) | Biggest factor — claude-haiku is ~1/5 sonnet, gpt-4-mini is similar |-| Reasoning level (`spec.reasoning`) | Higher levels (`high` / `xhigh`) add deliberation tokens |-| Skills layout | Many skills loaded per turn means a fatter system prompt every turn |-| Custom tool egress | Tools that fetch large pages inflate input tokens on the next turn |-| Conversation length | Longer multi-turn agents pay for the conversation re-feed |-| Limits | `spec.limits.max_turns` is the upper bound on cost per session |+| Lever | Effect |+| ---------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |+| Model (`spec.models`) | Biggest factor — a `low`-level model is often ~5-10x cheaper than `high`; see `@posthog/agent-applications-models` for live per-Mtok pricing |+| Reasoning level (`spec.reasoning`) | Higher levels (`high` / `xhigh`) add deliberation tokens |+| Skills layout | Many skills loaded per turn means a fatter system prompt every turn |+| Custom tool egress | Tools that fetch large pages inflate input tokens on the next turn |+| Conversation length | Longer multi-turn agents pay for the conversation re-feed |+| Limits | `spec.limits.max_turns` is the upper bound on cost per session |The reasoning levels are `minimal` | `low` | `medium` | `high` |`xhigh`. Treat the cost impact as directional, not a fixed multiplier —diff --git a/services/mcp/playbooks/editing-agents-safely/SKILL.md b/services/mcp/playbooks/editing-agents-safely/SKILL.mdindex da8b3b4271d3..dc5739ec9abf 100644--- a/services/mcp/playbooks/editing-agents-safely/SKILL.md+++ b/services/mcp/playbooks/editing-agents-safely/SKILL.md@@ -59,26 +59,29 @@ Choose the right verb:| `posthog__agent-applications-revisions-spec-update` | Replace the whole `spec` at once (a large rewrite) | Easy — overwrites the spec || `posthog__agent-applications-revisions-agent-md-update` | Overwrite `agent.md` (the system prompt) | Easy — re-write || `posthog__llm-skills-search` / `posthog__llm-skills-create` | Find or author a skill in the llma-skill store | Easy — the store keeps every version |-| `posthog__agent-applications-revisions-skill-refs-set` | Set which store skills the draft pins (`skill_refs`) | Easy — re-set the list; nothing is deleted |+| `posthog__agent-applications-revisions-skill-refs-update` | Set which store skills the draft pins (`skill_refs`) | Easy — re-set the list; nothing is deleted || `posthog__agent-applications-revisions-tools-update` | Upsert one custom tool (source + schema) | Easy — re-write || `posthog__agent-applications-revisions-tools-destroy` | Delete one custom tool | **Hard** — content gone unless you have it |These are all `posthog__*` MCP tools — there's no bulk bundle-replaceverb, which is deliberate: edit the one thing that changed-(`agent-md-update` / `skill-refs-set` / `tools-update`) rather than+(`agent-md-update` / `skill-refs-update` / `tools-update`) rather thanrewriting the whole bundle. Skills aren't authored on the agent at all —they live in the store and the agent only references them.After any `spec` write, `posthog__agent-applications-revisions-retrieve` toconfirm what actually persisted.-When the edit changes `spec` (a trigger, tool, limit, model,-`reasoning`), don't hand-edit the structure from memory. There's no-spec-schema tool, so get the shape right empirically: run-`posthog__agent-applications-revisions-validate-create` on the draft-and let its concrete errors point at the field you got wrong, and use-`posthog__agent-native-tools-list` for the valid tool ids. Iterate on-validate until it's clean rather than guessing the structure.+When the edit changes `spec` (a trigger, tool, limit, model policy,+`reasoning`), don't hand-edit the structure from memory. Pull the exact+shape from `posthog__agent-applications-spec-schema` first — it returns+the canonical JSON Schema (every field, enum, default, with descriptions);+pass `section` (e.g. `models`, `triggers`, `limits`) to fetch just the part+you're editing. Then run+`posthog__agent-applications-revisions-validate-create` on the draft to+confirm, letting its concrete errors point at anything you got wrong, and+use `posthog__agent-native-tools-list` for the valid tool ids. Schema to+get it right, validate to prove it.If the edit changes how the agent authenticates to a service (identityprovider, scopes, MCP auth.provider), loaddiff --git a/services/mcp/playbooks/reading-an-agent/SKILL.md b/services/mcp/playbooks/reading-an-agent/SKILL.mdindex f70f8070775f..b147ff6b9830 100644--- a/services/mcp/playbooks/reading-an-agent/SKILL.md+++ b/services/mcp/playbooks/reading-an-agent/SKILL.md@@ -53,7 +53,7 @@ designated Slack channel every Monday.Trigger surface: cron (every Monday 09:00 UTC). No chat / webhook /mcp / slack entry points.-Model: anthropic/claude-sonnet-4-6, reasoning: medium.+Models: auto (level medium), reasoning: medium.Tools (5): @posthog/query, @posthog/slack-post-message,@posthog/load-skill, @posthog/meta-end-turn, @posthog/meta-end-session.diff --git a/services/mcp/schema/generated-tool-definitions.json b/services/mcp/schema/generated-tool-definitions.jsonindex f1b453636687..eeafaf7d2a03 100644--- a/services/mcp/schema/generated-tool-definitions.json+++ b/services/mcp/schema/generated-tool-definitions.json@@ -756,6 +756,21 @@},"feature_flag": "agent-platform"},+ "agent-applications-spec-schema": {+ "description": "The canonical JSON Schema for an agent `spec` — every field, type, enum, default, and the discriminated unions for `models` / `triggers[]` / `tools[]`, each with an inline description. Emitted from the same source the runner validates against, so fields with a default are optional on write. Read this BEFORE composing a spec for `agent-applications-revisions-spec-update` (or create) instead of guessing the shape. Pass `section` (e.g. `models`, `triggers`, `tools`, `limits`) to fetch just one slice and save tokens.",+ "category": "Agent stack",+ "feature": "agent_platform",+ "summary": "Get the agent spec JSON schema",+ "title": "Get the agent spec JSON schema",+ "required_scopes": ["agents:read"],+ "annotations": {+ "destructiveHint": false,+ "idempotentHint": true,+ "openWorldHint": true,+ "readOnlyHint": true+ },+ "feature_flag": "agent-platform"+ },"agent-native-tools-list": {"description": "Read-only catalog of every `@posthog/*` native tool an agent can wire into `spec.tools`. Each entry includes the id, description, args schema (TypeBox-shaped), required integrations + scopes, and a cost hint (`cheap` / `medium` / `expensive`). Authoring flows use this to validate tool ids before writing them into a revision's spec. Playbook: read the `authoring-new-agents` playbook via `agent-resolve-resource` for the end-to-end authoring flow.","category": "Agent stack",diff --git a/services/mcp/schema/tool-definitions-all.json b/services/mcp/schema/tool-definitions-all.jsonindex d2809d2e36ff..0cd0d74b339b 100644--- a/services/mcp/schema/tool-definitions-all.json+++ b/services/mcp/schema/tool-definitions-all.json@@ -756,6 +756,21 @@},"feature_flag": "agent-platform"},+ "agent-applications-spec-schema": {+ "description": "The canonical JSON Schema for an agent `spec` — every field, type, enum, default, and the discriminated unions for `models` / `triggers[]` / `tools[]`, each with an inline description. Emitted from the same source the runner validates against, so fields with a default are optional on write. Read this BEFORE composing a spec for `agent-applications-revisions-spec-update` (or create) instead of guessing the shape. Pass `section` (e.g. `models`, `triggers`, `tools`, `limits`) to fetch just one slice and save tokens.",+ "category": "Agent stack",+ "feature": "agent_platform",+ "summary": "Get the agent spec JSON schema",+ "title": "Get the agent spec JSON schema",+ "required_scopes": ["agents:read"],+ "annotations": {+ "destructiveHint": false,+ "idempotentHint": true,+ "openWorldHint": true,+ "readOnlyHint": true+ },+ "feature_flag": "agent-platform"+ },"agent-feedback": {"description": "Send feedback about anything PostHog to the PostHog team. Set `feedback_type` to route it: `product` (any PostHog product or feature — insights, session replay, feature flags, the data warehouse, web analytics, error tracking, etc.; put the area in `product_area`), `mcp` (this MCP server itself — a tool, input schema, response format, error, or these instructions; set `category`), `docs`, or `other`. ALL sentiments are welcome via `sentiment` (`positive`/`neutral`/`negative`/`mixed`) — praise and feature requests are useful signal, not just problems. Good triggers: a confusing or broken product experience, a papercut that slowed the task down, a missing capability you worked around, a feature request, an unhelpful error, or something that worked really well. Keep `summary` to one sentence and write the free-text fields as clear, concise bullet points, quoting the product surface, tool name, parameter, or error text where possible. Include a concrete `suggested_improvement` whenever you can name one. Do not include user PII or sensitive query content. The user can also ask you to send feedback directly (e.g. 'make a PostHog feedback for this'). IMPORTANT: submitting feedback does NOT mean your work is done — keep going and finish the user's task using the other available tools. This tool is a side channel to the PostHog team, not a way to end the conversation.","category": "Feedback",diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.tsindex f13b06b9d7f9..80a8a20fecda 100644--- a/services/mcp/src/api/generated.ts+++ b/services/mcp/src/api/generated.ts@@ -8238,363 +8238,6 @@ export namespace Schemas {tools: AgentNativeToolEntry[];}- /**- * How this agent selects its model. `auto`: pick a quality/cost `level` and the platform resolves it to a maintained, priority-ordered, cross-provider list at runtime. `manual`: give an explicit priority-ordered `models` list (primary first). `optimize_for` governs how the chosen model is treated across the session's turns.- */- export type AgentRevisionSpecModels = {- mode: 'auto';- /** Quality/cost tier (auto). low = cheapest, for short, formulaic, no-reasoning jobs (lookups, FAQ bots); medium = balanced default, for multi-step but bounded work; high = top-tier, for long, branching, reasoning-heavy work. Resolved to a priority-ordered cross-provider list at session start. */- level?: 'low' | 'medium' | 'high';- /** Reasoning/thinking effort budget. minimal = no deliberation (fastest, cheapest) … xhigh = maximal (research-grade, ~5-10x the per-turn cost). Omit for the provider/spec default. */- reasoning?: 'minimal' | 'low' | 'medium' | 'high' | 'xhigh';- /** Session model stability vs. resilience. `cost` (default): the first turn picks a working model and PINS it for the whole session — keeps the provider's prompt cache warm (cache reads are ~0.1-0.5x of full input) and never fails over mid-session; if the pinned model is down the turn fails rather than re-reading the whole context cold on another provider. `availability`: fail over to the next model when the session's model fails — survives an outage at the cost of a one-time cold re-read. Prefer `cost` for long/expensive sessions, `availability` where uptime matters more than spend. */- optimize_for?: 'cost' | 'availability';- } | {- mode: 'manual';- /**- * Explicit priority-ordered fallback list — the runner tries entries in order (primary first).- * @minItems 1- */- models: ({- /**- * Canonical model id, e.g. `anthropic/claude-sonnet-4-6` (see the agent-applications-models tool for served ids).- * @minLength 1- * @pattern ^[a-z0-9_-]+/[a-zA-Z0-9._:-]+$- */- model: string;- /** Per-model reasoning effort override (else the spec default). */- reasoning?: 'minimal' | 'low' | 'medium' | 'high' | 'xhigh';- })[];- /** Session model stability vs. resilience. `cost` (default): pin the first working model for the whole session (warm prompt cache, no mid-session failover). `availability`: fail over down this list when the session's model fails (survives outages, re-reads context cold). */- optimize_for?: 'cost' | 'availability';- };-- export type AgentRevisionSpecTriggersItem = {- type: 'slack';- config: {- channel_id?: string;- mention_only: boolean;- auto_resume_threads: boolean;- allow_workspace_participants: boolean;- ack_reaction?: string;- allow_direct_messages: boolean;- trusted_workspaces: string[] | '*';- };- } | {- type: 'webhook';- config: {- path: string;- };- auth: {- modes?: ({- type: 'public';- acknowledge_public_exposure: true;- } | {- type: 'posthog';- scopes?: string[];- audience?: 'project' | 'organization';- } | {- type: 'jwt';- /** @minLength 1 */- issuer_secret_ref: string;- } | {- type: 'shared_secret';- /** @minLength 1 */- header: string;- /** @minLength 1 */- secret_ref: string;- } | {- type: 'posthog_internal';- })[];- };- } | {- type: 'cron';- config: {- /** @minLength 1 */- name: string;- /** @minLength 1 */- schedule: string;- timezone?: string;- /**- * @minLength 1- * @maxLength 4096- */- prompt: string;- external_key?: string;- catch_up?: 'all' | 'most_recent' | 'skip';- /**- * @minimum 1- * @maximum 604800- */- max_catch_up_age_seconds?: number;- };- } | {- type: 'chat';- config?: {- allow_restart?: boolean;- };- auth: {- modes?: ({- type: 'public';- acknowledge_public_exposure: true;- } | {- type: 'posthog';- scopes?: string[];- audience?: 'project' | 'organization';- } | {- type: 'jwt';- /** @minLength 1 */- issuer_secret_ref: string;- } | {- type: 'shared_secret';- /** @minLength 1 */- header: string;- /** @minLength 1 */- secret_ref: string;- } | {- type: 'posthog_internal';- })[];- };- } | {- type: 'mcp';- config?: {- allow_restart?: boolean;- };- auth: {- modes?: ({- type: 'public';- acknowledge_public_exposure: true;- } | {- type: 'posthog';- scopes?: string[];- audience?: 'project' | 'organization';- } | {- type: 'jwt';- /** @minLength 1 */- issuer_secret_ref: string;- } | {- type: 'shared_secret';- /** @minLength 1 */- header: string;- /** @minLength 1 */- secret_ref: string;- } | {- type: 'posthog_internal';- })[];- };- };-- export type AgentRevisionSpecToolsItem = {- kind: 'native';- id: string;- requires_approval?: boolean;- approval_policy?: {- type?: 'principal' | 'agent';- allow_edit?: boolean;- /**- * @minimum 60000- * @maximum 604800000- */- ttl_ms?: number;- };- } | {- kind: 'custom';- id: string;- path: string;- requires_approval?: boolean;- approval_policy?: {- type?: 'principal' | 'agent';- allow_edit?: boolean;- /**- * @minimum 60000- * @maximum 604800000- */- ttl_ms?: number;- };- requires_identity?: string;- } | {- kind: 'custom_template';- from_template: string;- alias: string;- /** @minimum 1 */- version?: number;- } | {- kind: 'client';- /** @minLength 1 */- id: string;- /** @minLength 1 */- description: string;- args_schema?: { [key: string]: unknown };- required?: boolean;- /**- * @minimum 1- * @maximum 600000- */- timeout_ms?: number;- interactive?: boolean;- };-- export type AgentRevisionSpecMcpsItemAuth = {- provider?: string;- };-- export type AgentRevisionSpecMcpsItemHeaders = {[key: string]: string};-- export type AgentRevisionSpecMcpsItemToolsItem = string | {- /** @minLength 1 */- name: string;- requires_approval?: boolean;- approval_policy?: {- type?: 'principal' | 'agent';- allow_edit?: boolean;- /**- * @minimum 60000- * @maximum 604800000- */- ttl_ms?: number;- };- };-- export type AgentRevisionSpecMcpsItem = {- /** @minLength 1 */- id: string;- url: string;- auth?: AgentRevisionSpecMcpsItemAuth;- secrets?: string[];- headers?: AgentRevisionSpecMcpsItemHeaders;- tools?: AgentRevisionSpecMcpsItemToolsItem[];- };-- export type AgentRevisionSpecSkillsItem = {- id: string;- path: string;- description?: string;- from_template?: string;- alias?: string;- /** @minimum 1 */- version?: number;- source_version_id?: string;- };-- export type AgentRevisionSpecIdentityProvidersItem = {- kind: 'posthog';- /** @minLength 1 */- id?: string;- binding?: 'principal';- scopes?: string[];- client_id?: string;- } | {- kind: 'oauth2';- /** @minLength 1 */- id: string;- binding?: 'principal';- authorize_url: string;- token_url: string;- /** @minLength 1 */- client_id: string;- client_secret_ref?: string;- scopes?: string[];- userinfo_url?: string;- };-- export type AgentRevisionSpecSecretsItem = string | {- /** @minLength 1 */- name: string;- /**- * @minItems 1- * @items.minLength 1- */- allowed_hosts: string[];- };-- export type AgentRevisionSpecLimits = {- /**- * @maximum 2147483647- * @exclusiveMinimum 0- */- max_turns: number;- /**- * @maximum 2147483647- * @exclusiveMinimum 0- */- max_tool_calls: number;- /**- * @maximum 2147483647- * @exclusiveMinimum 0- */- max_wall_seconds: number;- /**- * @maximum 200000- * @exclusiveMinimum 0- */- max_output_tokens?: number;- /**- * @maximum 16384- * @exclusiveMinimum 0- */- max_memory_mb: number;- /**- * @maximum 8- * @exclusiveMinimum 0- */- max_cpu_cores: number;- };-- export type AgentRevisionSpecReasoning = typeof AgentRevisionSpecReasoning[keyof typeof AgentRevisionSpecReasoning];--- export const AgentRevisionSpecReasoning = {- Minimal: 'minimal',- Low: 'low',- Medium: 'medium',- High: 'high',- Xhigh: 'xhigh',- } as const;-- export type AgentRevisionSpecFrameworkPromptOmitItem = typeof AgentRevisionSpecFrameworkPromptOmitItem[keyof typeof AgentRevisionSpecFrameworkPromptOmitItem];--- export const AgentRevisionSpecFrameworkPromptOmitItem = {- MetaToolGuidance: 'meta_tool_guidance',- StateContract: 'state_contract',- ToolFailureGuidance: 'tool_failure_guidance',- ApprovalGuidance: 'approval_guidance',- ReasoningHint: 'reasoning_hint',- } as const;-- export type AgentRevisionSpecFrameworkPrompt = {- omit: AgentRevisionSpecFrameworkPromptOmitItem[];- /**- * @maximum 2147483647- * @exclusiveMinimum 0- */- version_pin?: number;- };-- export type AgentRevisionSpecResume = {- enabled: boolean;- /**- * @maximum 2147483647- * @exclusiveMinimum 0- */- max_completed_age_ms: number;- };-- export type AgentRevisionSpec = {- /** How this agent selects its model. `auto`: pick a quality/cost `level` and the platform resolves it to a maintained, priority-ordered, cross-provider list at runtime. `manual`: give an explicit priority-ordered `models` list (primary first). `optimize_for` governs how the chosen model is treated across the session's turns. */- models: AgentRevisionSpecModels;- triggers: AgentRevisionSpecTriggersItem[];- tools: AgentRevisionSpecToolsItem[];- mcps: AgentRevisionSpecMcpsItem[];- skills: AgentRevisionSpecSkillsItem[];- identity_providers?: AgentRevisionSpecIdentityProvidersItem[];- secrets: AgentRevisionSpecSecretsItem[];- limits: AgentRevisionSpecLimits;- reasoning?: AgentRevisionSpecReasoning;- framework_prompt?: AgentRevisionSpecFrameworkPrompt;- resume?: AgentRevisionSpecResume;- };-/*** Resolved creator (id, first_name, email) from `created_by_id`, or null if unset or the user was deleted.* @nullable@@ -8654,7 +8297,7 @@ export namespace Schemas {bundle_uri?: string;/** @nullable */readonly bundle_sha256: string | null;- spec?: AgentRevisionSpec;+ spec?: unknown;/** Store-skill references for this draft, set via the `skill_refs` action and resolved into the bundle at freeze. Preserved as the authoring record on the frozen revision (and carried forward when forking a new draft); resolved provenance is stamped onto `spec.skills[].source_version_id`. */readonly skill_refs: readonly SkillRef[];/** @nullable */@@ -35681,363 +35324,6 @@ export namespace Schemas {tags?: string[];}- /**- * How this agent selects its model. `auto`: pick a quality/cost `level` and the platform resolves it to a maintained, priority-ordered, cross-provider list at runtime. `manual`: give an explicit priority-ordered `models` list (primary first). `optimize_for` governs how the chosen model is treated across the session's turns.- */- export type PatchedAgentRevisionSpecModels = {- mode: 'auto';- /** Quality/cost tier (auto). low = cheapest, for short, formulaic, no-reasoning jobs (lookups, FAQ bots); medium = balanced default, for multi-step but bounded work; high = top-tier, for long, branching, reasoning-heavy work. Resolved to a priority-ordered cross-provider list at session start. */- level?: 'low' | 'medium' | 'high';- /** Reasoning/thinking effort budget. minimal = no deliberation (fastest, cheapest) … xhigh = maximal (research-grade, ~5-10x the per-turn cost). Omit for the provider/spec default. */- reasoning?: 'minimal' | 'low' | 'medium' | 'high' | 'xhigh';- /** Session model stability vs. resilience. `cost` (default): the first turn picks a working model and PINS it for the whole session — keeps the provider's prompt cache warm (cache reads are ~0.1-0.5x of full input) and never fails over mid-session; if the pinned model is down the turn fails rather than re-reading the whole context cold on another provider. `availability`: fail over to the next model when the session's model fails — survives an outage at the cost of a one-time cold re-read. Prefer `cost` for long/expensive sessions, `availability` where uptime matters more than spend. */- optimize_for?: 'cost' | 'availability';- } | {- mode: 'manual';- /**- * Explicit priority-ordered fallback list — the runner tries entries in order (primary first).- * @minItems 1- */- models: ({- /**- * Canonical model id, e.g. `anthropic/claude-sonnet-4-6` (see the agent-applications-models tool for served ids).- * @minLength 1- * @pattern ^[a-z0-9_-]+/[a-zA-Z0-9._:-]+$- */- model: string;- /** Per-model reasoning effort override (else the spec default). */- reasoning?: 'minimal' | 'low' | 'medium' | 'high' | 'xhigh';- })[];- /** Session model stability vs. resilience. `cost` (default): pin the first working model for the whole session (warm prompt cache, no mid-session failover). `availability`: fail over down this list when the session's model fails (survives outages, re-reads context cold). */- optimize_for?: 'cost' | 'availability';- };-- export type PatchedAgentRevisionSpecTriggersItem = {- type: 'slack';- config: {- channel_id?: string;- mention_only: boolean;- auto_resume_threads: boolean;- allow_workspace_participants: boolean;- ack_reaction?: string;- allow_direct_messages: boolean;- trusted_workspaces: string[] | '*';- };- } | {- type: 'webhook';- config: {- path: string;- };- auth: {- modes?: ({- type: 'public';- acknowledge_public_exposure: true;- } | {- type: 'posthog';- scopes?: string[];- audience?: 'project' | 'organization';- } | {- type: 'jwt';- /** @minLength 1 */- issuer_secret_ref: string;- } | {- type: 'shared_secret';- /** @minLength 1 */- header: string;- /** @minLength 1 */- secret_ref: string;- } | {- type: 'posthog_internal';- })[];- };- } | {- type: 'cron';- config: {- /** @minLength 1 */- name: string;- /** @minLength 1 */- schedule: string;- timezone?: string;- /**- * @minLength 1- * @maxLength 4096- */- prompt: string;- external_key?: string;- catch_up?: 'all' | 'most_recent' | 'skip';- /**- * @minimum 1- * @maximum 604800- */- max_catch_up_age_seconds?: number;- };- } | {- type: 'chat';- config?: {- allow_restart?: boolean;- };- auth: {- modes?: ({- type: 'public';- acknowledge_public_exposure: true;- } | {- type: 'posthog';- scopes?: string[];- audience?: 'project' | 'organization';- } | {- type: 'jwt';- /** @minLength 1 */- issuer_secret_ref: string;- } | {- type: 'shared_secret';- /** @minLength 1 */- header: string;- /** @minLength 1 */- secret_ref: string;- } | {- type: 'posthog_internal';- })[];- };- } | {- type: 'mcp';- config?: {- allow_restart?: boolean;- };- auth: {- modes?: ({- type: 'public';- acknowledge_public_exposure: true;- } | {- type: 'posthog';- scopes?: string[];- audience?: 'project' | 'organization';- } | {- type: 'jwt';- /** @minLength 1 */- issuer_secret_ref: string;- } | {- type: 'shared_secret';- /** @minLength 1 */- header: string;- /** @minLength 1 */- secret_ref: string;- } | {- type: 'posthog_internal';- })[];- };- };-- export type PatchedAgentRevisionSpecToolsItem = {- kind: 'native';- id: string;- requires_approval?: boolean;- approval_policy?: {- type?: 'principal' | 'agent';- allow_edit?: boolean;- /**- * @minimum 60000- * @maximum 604800000- */- ttl_ms?: number;- };- } | {- kind: 'custom';- id: string;- path: string;- requires_approval?: boolean;- approval_policy?: {- type?: 'principal' | 'agent';- allow_edit?: boolean;- /**- * @minimum 60000- * @maximum 604800000- */- ttl_ms?: number;- };- requires_identity?: string;- } | {- kind: 'custom_template';- from_template: string;- alias: string;- /** @minimum 1 */- version?: number;- } | {- kind: 'client';- /** @minLength 1 */- id: string;- /** @minLength 1 */- description: string;- args_schema?: { [key: string]: unknown };- required?: boolean;- /**- * @minimum 1- * @maximum 600000- */- timeout_ms?: number;- interactive?: boolean;- };-- export type PatchedAgentRevisionSpecMcpsItemAuth = {- provider?: string;- };-- export type PatchedAgentRevisionSpecMcpsItemHeaders = {[key: string]: string};-- export type PatchedAgentRevisionSpecMcpsItemToolsItem = string | {- /** @minLength 1 */- name: string;- requires_approval?: boolean;- approval_policy?: {- type?: 'principal' | 'agent';- allow_edit?: boolean;- /**- * @minimum 60000- * @maximum 604800000- */- ttl_ms?: number;- };- };-- export type PatchedAgentRevisionSpecMcpsItem = {- /** @minLength 1 */- id: string;- url: string;- auth?: PatchedAgentRevisionSpecMcpsItemAuth;- secrets?: string[];- headers?: PatchedAgentRevisionSpecMcpsItemHeaders;- tools?: PatchedAgentRevisionSpecMcpsItemToolsItem[];- };-- export type PatchedAgentRevisionSpecSkillsItem = {- id: string;- path: string;- description?: string;- from_template?: string;- alias?: string;- /** @minimum 1 */- version?: number;- source_version_id?: string;- };-- export type PatchedAgentRevisionSpecIdentityProvidersItem = {- kind: 'posthog';- /** @minLength 1 */- id?: string;- binding?: 'principal';- scopes?: string[];- client_id?: string;- } | {- kind: 'oauth2';- /** @minLength 1 */- id: string;- binding?: 'principal';- authorize_url: string;- token_url: string;- /** @minLength 1 */- client_id: string;- client_secret_ref?: string;- scopes?: string[];- userinfo_url?: string;- };-- export type PatchedAgentRevisionSpecSecretsItem = string | {- /** @minLength 1 */- name: string;- /**- * @minItems 1- * @items.minLength 1- */- allowed_hosts: string[];- };-- export type PatchedAgentRevisionSpecLimits = {- /**- * @maximum 2147483647- * @exclusiveMinimum 0- */- max_turns: number;- /**- * @maximum 2147483647- * @exclusiveMinimum 0- */- max_tool_calls: number;- /**- * @maximum 2147483647- * @exclusiveMinimum 0- */- max_wall_seconds: number;- /**- * @maximum 200000- * @exclusiveMinimum 0- */- max_output_tokens?: number;- /**- * @maximum 16384- * @exclusiveMinimum 0- */- max_memory_mb: number;- /**- * @maximum 8- * @exclusiveMinimum 0- */- max_cpu_cores: number;- };-- export type PatchedAgentRevisionSpecReasoning = typeof PatchedAgentRevisionSpecReasoning[keyof typeof PatchedAgentRevisionSpecReasoning];--- export const PatchedAgentRevisionSpecReasoning = {- Minimal: 'minimal',- Low: 'low',- Medium: 'medium',- High: 'high',- Xhigh: 'xhigh',- } as const;-- export type PatchedAgentRevisionSpecFrameworkPromptOmitItem = typeof PatchedAgentRevisionSpecFrameworkPromptOmitItem[keyof typeof PatchedAgentRevisionSpecFrameworkPromptOmitItem];--- export const PatchedAgentRevisionSpecFrameworkPromptOmitItem = {- MetaToolGuidance: 'meta_tool_guidance',- StateContract: 'state_contract',- ToolFailureGuidance: 'tool_failure_guidance',- ApprovalGuidance: 'approval_guidance',- ReasoningHint: 'reasoning_hint',- } as const;-- export type PatchedAgentRevisionSpecFrameworkPrompt = {- omit: PatchedAgentRevisionSpecFrameworkPromptOmitItem[];- /**- * @maximum 2147483647- * @exclusiveMinimum 0- */- version_pin?: number;- };-- export type PatchedAgentRevisionSpecResume = {- enabled: boolean;- /**- * @maximum 2147483647- * @exclusiveMinimum 0- */- max_completed_age_ms: number;- };-- export type PatchedAgentRevisionSpec = {- /** How this agent selects its model. `auto`: pick a quality/cost `level` and the platform resolves it to a maintained, priority-ordered, cross-provider list at runtime. `manual`: give an explicit priority-ordered `models` list (primary first). `optimize_for` governs how the chosen model is treated across the session's turns. */- models: PatchedAgentRevisionSpecModels;- triggers: PatchedAgentRevisionSpecTriggersItem[];- tools: PatchedAgentRevisionSpecToolsItem[];- mcps: PatchedAgentRevisionSpecMcpsItem[];- skills: PatchedAgentRevisionSpecSkillsItem[];- identity_providers?: PatchedAgentRevisionSpecIdentityProvidersItem[];- secrets: PatchedAgentRevisionSpecSecretsItem[];- limits: PatchedAgentRevisionSpecLimits;- reasoning?: PatchedAgentRevisionSpecReasoning;- framework_prompt?: PatchedAgentRevisionSpecFrameworkPrompt;- resume?: PatchedAgentRevisionSpecResume;- };-/*** Resolved creator (id, first_name, email) from `created_by_id`, or null if unset or the user was deleted.* @nullable@@ -36058,7 +35344,7 @@ export namespace Schemas {bundle_uri?: string;/** @nullable */readonly bundle_sha256?: string | null;- spec?: PatchedAgentRevisionSpec;+ spec?: unknown;/** Store-skill references for this draft, set via the `skill_refs` action and resolved into the bundle at freeze. Preserved as the authoring record on the frozen revision (and carried forward when forking a new draft); resolved provenance is stamped onto `spec.skills[].source_version_id`. */readonly skill_refs?: readonly SkillRef[];/** @nullable */@@ -60225,6 +59511,13 @@ export namespace Schemas {since?: string;};+ export type AgentApplicationsSpecSchemaParams = {+ /**+ * Return only this top-level slice of the spec schema to save tokens — one of `models`, `triggers`, `tools`, `mcps`, `skills`, `identity_providers`, `secrets`, `limits`, `reasoning`, `framework_prompt`, `resume`. Omit for the whole spec schema.+ */+ section?: string;+ };+export type AgentFleetApprovalsListParams = {/*** Optional agent UUID — narrows the listing to one application.diff --git a/services/mcp/src/generated/agent_platform/api.ts b/services/mcp/src/generated/agent_platform/api.tsindex e0072cf00972..1a2894294d22 100644--- a/services/mcp/src/generated/agent_platform/api.ts+++ b/services/mcp/src/generated/agent_platform/api.ts@@ -3,7 +3,7 @@* MCP service uses these Zod schemas for generated tool handlers.* To regenerate: hogli build:openapi*- * PostHog API - MCP 35 enabled ops+ * PostHog API - MCP 36 enabled ops* OpenAPI spec version: 1.0.0*/import * as zod from 'zod'@@ -157,123 +157,6 @@ export const AgentApplicationsRevisionsCreateParams = /* @__PURE__ */ zod.object})export const agentApplicationsRevisionsCreateBodyBundleUriDefault = ``-export const agentApplicationsRevisionsCreateBodySpecModelsOneLevelDefault = `medium`-export const agentApplicationsRevisionsCreateBodySpecModelsOneOptimizeForDefault = `cost`--export const agentApplicationsRevisionsCreateBodySpecModelsTwoModelsItemModelRegExp = new RegExp(- '^[a-z0-9_-]+/[a-zA-Z0-9._:-]+$'-)--export const agentApplicationsRevisionsCreateBodySpecModelsTwoOptimizeForDefault = `cost`-export const agentApplicationsRevisionsCreateBodySpecModelsDefault = {- mode: 'auto' as const,- level: 'medium' as const,- optimize_for: 'cost' as const,-}-export const agentApplicationsRevisionsCreateBodySpecTriggersItemOneConfigMentionOnlyDefault = false-export const agentApplicationsRevisionsCreateBodySpecTriggersItemOneConfigAutoResumeThreadsDefault = false-export const agentApplicationsRevisionsCreateBodySpecTriggersItemOneConfigAllowWorkspaceParticipantsDefault = false-export const agentApplicationsRevisionsCreateBodySpecTriggersItemOneConfigAllowDirectMessagesDefault = false-export const agentApplicationsRevisionsCreateBodySpecTriggersItemTwoAuthModesItemTwoScopesDefault = []-export const agentApplicationsRevisionsCreateBodySpecTriggersItemTwoAuthModesItemTwoAudienceDefault = `project`--export const agentApplicationsRevisionsCreateBodySpecTriggersItemThreeConfigTimezoneDefault = `UTC`-export const agentApplicationsRevisionsCreateBodySpecTriggersItemThreeConfigPromptMax = 4096--export const agentApplicationsRevisionsCreateBodySpecTriggersItemThreeConfigCatchUpDefault = `most_recent`-export const agentApplicationsRevisionsCreateBodySpecTriggersItemThreeConfigMaxCatchUpAgeSecondsDefault = 3600-export const agentApplicationsRevisionsCreateBodySpecTriggersItemThreeConfigMaxCatchUpAgeSecondsMax = 604800--export const agentApplicationsRevisionsCreateBodySpecTriggersItemFourConfigAllowRestartDefault = false-export const agentApplicationsRevisionsCreateBodySpecTriggersItemFourConfigDefault = { allow_restart: false }-export const agentApplicationsRevisionsCreateBodySpecTriggersItemFourAuthModesItemTwoScopesDefault = []-export const agentApplicationsRevisionsCreateBodySpecTriggersItemFourAuthModesItemTwoAudienceDefault = `project`--export const agentApplicationsRevisionsCreateBodySpecTriggersItemFiveConfigAllowRestartDefault = false-export const agentApplicationsRevisionsCreateBodySpecTriggersItemFiveConfigDefault = { allow_restart: false }-export const agentApplicationsRevisionsCreateBodySpecTriggersItemFiveAuthModesItemTwoScopesDefault = []-export const agentApplicationsRevisionsCreateBodySpecTriggersItemFiveAuthModesItemTwoAudienceDefault = `project`--export const agentApplicationsRevisionsCreateBodySpecTriggersDefault = []-export const agentApplicationsRevisionsCreateBodySpecToolsItemOneRequiresApprovalDefault = false-export const agentApplicationsRevisionsCreateBodySpecToolsItemOneApprovalPolicyTypeDefault = `principal`-export const agentApplicationsRevisionsCreateBodySpecToolsItemOneApprovalPolicyAllowEditDefault = false-export const agentApplicationsRevisionsCreateBodySpecToolsItemOneApprovalPolicyTtlMsDefault = 86400000-export const agentApplicationsRevisionsCreateBodySpecToolsItemOneApprovalPolicyTtlMsMin = 60000-export const agentApplicationsRevisionsCreateBodySpecToolsItemOneApprovalPolicyTtlMsMax = 604800000--export const agentApplicationsRevisionsCreateBodySpecToolsItemTwoRequiresApprovalDefault = false-export const agentApplicationsRevisionsCreateBodySpecToolsItemTwoApprovalPolicyTypeDefault = `principal`-export const agentApplicationsRevisionsCreateBodySpecToolsItemTwoApprovalPolicyAllowEditDefault = false-export const agentApplicationsRevisionsCreateBodySpecToolsItemTwoApprovalPolicyTtlMsDefault = 86400000-export const agentApplicationsRevisionsCreateBodySpecToolsItemTwoApprovalPolicyTtlMsMin = 60000-export const agentApplicationsRevisionsCreateBodySpecToolsItemTwoApprovalPolicyTtlMsMax = 604800000--export const agentApplicationsRevisionsCreateBodySpecToolsItemFourArgsSchemaDefault = {}-export const agentApplicationsRevisionsCreateBodySpecToolsItemFourRequiredDefault = false-export const agentApplicationsRevisionsCreateBodySpecToolsItemFourTimeoutMsDefault = 5000-export const agentApplicationsRevisionsCreateBodySpecToolsItemFourTimeoutMsMax = 600000--export const agentApplicationsRevisionsCreateBodySpecToolsItemFourInteractiveDefault = false-export const agentApplicationsRevisionsCreateBodySpecToolsDefault = []-export const agentApplicationsRevisionsCreateBodySpecMcpsItemSecretsDefault = []--export const agentApplicationsRevisionsCreateBodySpecMcpsItemToolsItemTwoRequiresApprovalDefault = false-export const agentApplicationsRevisionsCreateBodySpecMcpsItemToolsItemTwoApprovalPolicyTypeDefault = `principal`-export const agentApplicationsRevisionsCreateBodySpecMcpsItemToolsItemTwoApprovalPolicyAllowEditDefault = false-export const agentApplicationsRevisionsCreateBodySpecMcpsItemToolsItemTwoApprovalPolicyTtlMsDefault = 86400000-export const agentApplicationsRevisionsCreateBodySpecMcpsItemToolsItemTwoApprovalPolicyTtlMsMin = 60000-export const agentApplicationsRevisionsCreateBodySpecMcpsItemToolsItemTwoApprovalPolicyTtlMsMax = 604800000--export const agentApplicationsRevisionsCreateBodySpecMcpsDefault = []-export const agentApplicationsRevisionsCreateBodySpecSkillsDefault = []-export const agentApplicationsRevisionsCreateBodySpecIdentityProvidersItemOneIdDefault = `posthog`--export const agentApplicationsRevisionsCreateBodySpecIdentityProvidersItemOneBindingDefault = `principal`-export const agentApplicationsRevisionsCreateBodySpecIdentityProvidersItemOneScopesDefault = []-export const agentApplicationsRevisionsCreateBodySpecIdentityProvidersItemTwoBindingDefault = `principal`-export const agentApplicationsRevisionsCreateBodySpecIdentityProvidersItemTwoScopesDefault = []-export const agentApplicationsRevisionsCreateBodySpecIdentityProvidersDefault = []--export const agentApplicationsRevisionsCreateBodySpecSecretsDefault = []-export const agentApplicationsRevisionsCreateBodySpecLimitsMaxTurnsDefault = 50-export const agentApplicationsRevisionsCreateBodySpecLimitsMaxTurnsExclusiveMin = 0-export const agentApplicationsRevisionsCreateBodySpecLimitsMaxTurnsMax = 2147483647--export const agentApplicationsRevisionsCreateBodySpecLimitsMaxToolCallsDefault = 200-export const agentApplicationsRevisionsCreateBodySpecLimitsMaxToolCallsExclusiveMin = 0-export const agentApplicationsRevisionsCreateBodySpecLimitsMaxToolCallsMax = 2147483647--export const agentApplicationsRevisionsCreateBodySpecLimitsMaxWallSecondsDefault = 900-export const agentApplicationsRevisionsCreateBodySpecLimitsMaxWallSecondsExclusiveMin = 0-export const agentApplicationsRevisionsCreateBodySpecLimitsMaxWallSecondsMax = 2147483647--export const agentApplicationsRevisionsCreateBodySpecLimitsMaxOutputTokensExclusiveMin = 0-export const agentApplicationsRevisionsCreateBodySpecLimitsMaxOutputTokensMax = 200000--export const agentApplicationsRevisionsCreateBodySpecLimitsMaxMemoryMbDefault = 512-export const agentApplicationsRevisionsCreateBodySpecLimitsMaxMemoryMbExclusiveMin = 0-export const agentApplicationsRevisionsCreateBodySpecLimitsMaxMemoryMbMax = 16384--export const agentApplicationsRevisionsCreateBodySpecLimitsMaxCpuCoresDefault = 0.25-export const agentApplicationsRevisionsCreateBodySpecLimitsMaxCpuCoresExclusiveMin = 0-export const agentApplicationsRevisionsCreateBodySpecLimitsMaxCpuCoresMax = 8--export const agentApplicationsRevisionsCreateBodySpecLimitsDefault = {- max_turns: 50,- max_tool_calls: 200,- max_wall_seconds: 900,- max_memory_mb: 512,- max_cpu_cores: 0.25,-}-export const agentApplicationsRevisionsCreateBodySpecFrameworkPromptOmitDefault = []-export const agentApplicationsRevisionsCreateBodySpecFrameworkPromptVersionPinExclusiveMin = 0-export const agentApplicationsRevisionsCreateBodySpecFrameworkPromptVersionPinMax = 2147483647--export const agentApplicationsRevisionsCreateBodySpecResumeEnabledDefault = false-export const agentApplicationsRevisionsCreateBodySpecResumeMaxCompletedAgeMsDefault = 604800000-export const agentApplicationsRevisionsCreateBodySpecResumeMaxCompletedAgeMsExclusiveMin = 0-export const agentApplicationsRevisionsCreateBodySpecResumeMaxCompletedAgeMsMax = 2147483647export const AgentApplicationsRevisionsCreateBody = /* @__PURE__ */ zod.object({parent_revision: zod.uuid().nullish(),@@ -283,547 +166,7 @@ export const AgentApplicationsRevisionsCreateBody = /* @__PURE__ */ zod.object({.describe('Storage-prefix metadata for the bundle, e.g. `fs://my-agent/`. Optional — leave blank and the server fills `fs://<application-slug>/`. Bundles are addressed by revision id regardless, so this is only a prefix hint.'),- spec: zod- .object({- models: zod- .union([- zod.object({- mode: zod.literal('auto'),- level: zod- .enum(['low', 'medium', 'high'])- .default(agentApplicationsRevisionsCreateBodySpecModelsOneLevelDefault)- .describe(- 'Quality/cost tier (auto). low = cheapest, for short, formulaic, no-reasoning jobs (lookups, FAQ bots); medium = balanced default, for multi-step but bounded work; high = top-tier, for long, branching, reasoning-heavy work. Resolved to a priority-ordered cross-provider list at session start.'- ),- reasoning: zod- .enum(['minimal', 'low', 'medium', 'high', 'xhigh'])- .optional()- .describe(- 'Reasoning/thinking effort budget. minimal = no deliberation (fastest, cheapest) … xhigh = maximal (research-grade, ~5-10x the per-turn cost). Omit for the provider/spec default.'- ),- optimize_for: zod- .enum(['cost', 'availability'])- .default(agentApplicationsRevisionsCreateBodySpecModelsOneOptimizeForDefault)- .describe(- "Session model stability vs. resilience. `cost` (default): the first turn picks a working model and PINS it for the whole session — keeps the provider's prompt cache warm (cache reads are ~0.1-0.5x of full input) and never fails over mid-session; if the pinned model is down the turn fails rather than re-reading the whole context cold on another provider. `availability`: fail over to the next model when the session's model fails — survives an outage at the cost of a one-time cold re-read. Prefer `cost` for long/expensive sessions, `availability` where uptime matters more than spend."- ),- }),- zod.object({- mode: zod.literal('manual'),- models: zod- .array(- zod.object({- model: zod- .string()- .min(1)- .regex(agentApplicationsRevisionsCreateBodySpecModelsTwoModelsItemModelRegExp)- .describe(- 'Canonical model id, e.g. `anthropic/claude-sonnet-4-6` (see the agent-applications-models tool for served ids).'- ),- reasoning: zod- .enum(['minimal', 'low', 'medium', 'high', 'xhigh'])- .optional()- .describe('Per-model reasoning effort override (else the spec default).'),- })- )- .min(1)- .describe(- 'Explicit priority-ordered fallback list — the runner tries entries in order (primary first).'- ),- optimize_for: zod- .enum(['cost', 'availability'])- .default(agentApplicationsRevisionsCreateBodySpecModelsTwoOptimizeForDefault)- .describe(- "Session model stability vs. resilience. `cost` (default): pin the first working model for the whole session (warm prompt cache, no mid-session failover). `availability`: fail over down this list when the session's model fails (survives outages, re-reads context cold)."- ),- }),- ])- .default(agentApplicationsRevisionsCreateBodySpecModelsDefault)- .describe(- "How this agent selects its model. `auto`: pick a quality/cost `level` and the platform resolves it to a maintained, priority-ordered, cross-provider list at runtime. `manual`: give an explicit priority-ordered `models` list (primary first). `optimize_for` governs how the chosen model is treated across the session's turns."- ),- triggers: zod- .array(- zod.union([- zod.object({- type: zod.literal('slack'),- config: zod.object({- channel_id: zod.string().optional(),- mention_only: zod- .boolean()- .default(- agentApplicationsRevisionsCreateBodySpecTriggersItemOneConfigMentionOnlyDefault- ),- auto_resume_threads: zod- .boolean()- .default(- agentApplicationsRevisionsCreateBodySpecTriggersItemOneConfigAutoResumeThreadsDefault- ),- allow_workspace_participants: zod- .boolean()- .default(- agentApplicationsRevisionsCreateBodySpecTriggersItemOneConfigAllowWorkspaceParticipantsDefault- ),- ack_reaction: zod.string().optional(),- allow_direct_messages: zod- .boolean()- .default(- agentApplicationsRevisionsCreateBodySpecTriggersItemOneConfigAllowDirectMessagesDefault- ),- trusted_workspaces: zod.union([zod.array(zod.string()).min(1), zod.literal('*')]),- }),- }),- zod.object({- type: zod.literal('webhook'),- config: zod.object({- path: zod.string(),- }),- auth: zod.object({- modes: zod- .array(- zod.union([- zod.object({- type: zod.literal('public'),- acknowledge_public_exposure: zod.boolean(),- }),- zod.object({- type: zod.literal('posthog'),- scopes: zod- .array(zod.string())- .default(- agentApplicationsRevisionsCreateBodySpecTriggersItemTwoAuthModesItemTwoScopesDefault- ),- audience: zod- .enum(['project', 'organization'])- .default(- agentApplicationsRevisionsCreateBodySpecTriggersItemTwoAuthModesItemTwoAudienceDefault- ),- }),- zod.object({- type: zod.literal('jwt'),- issuer_secret_ref: zod.string().min(1),- }),- zod.object({- type: zod.literal('shared_secret'),- header: zod.string().min(1),- secret_ref: zod.string().min(1),- }),- zod.object({- type: zod.literal('posthog_internal'),- }),- ])- )- .optional(),- }),- }),- zod.object({- type: zod.literal('cron'),- config: zod.object({- name: zod.string().min(1),- schedule: zod.string().min(1),- timezone: zod- .string()- .default(- agentApplicationsRevisionsCreateBodySpecTriggersItemThreeConfigTimezoneDefault- ),- prompt: zod- .string()- .min(1)- .max(agentApplicationsRevisionsCreateBodySpecTriggersItemThreeConfigPromptMax),- external_key: zod.string().optional(),- catch_up: zod- .enum(['all', 'most_recent', 'skip'])- .default(- agentApplicationsRevisionsCreateBodySpecTriggersItemThreeConfigCatchUpDefault- ),- max_catch_up_age_seconds: zod- .number()- .min(1)- .max(- agentApplicationsRevisionsCreateBodySpecTriggersItemThreeConfigMaxCatchUpAgeSecondsMax- )- .default(- agentApplicationsRevisionsCreateBodySpecTriggersItemThreeConfigMaxCatchUpAgeSecondsDefault- ),- }),- }),- zod.object({- type: zod.literal('chat'),- config: zod- .object({- allow_restart: zod- .boolean()- .default(- agentApplicationsRevisionsCreateBodySpecTriggersItemFourConfigAllowRestartDefault- ),- })- .default(agentApplicationsRevisionsCreateBodySpecTriggersItemFourConfigDefault),- auth: zod.object({- modes: zod- .array(- zod.union([- zod.object({- type: zod.literal('public'),- acknowledge_public_exposure: zod.boolean(),- }),- zod.object({- type: zod.literal('posthog'),- scopes: zod- .array(zod.string())- .default(- agentApplicationsRevisionsCreateBodySpecTriggersItemFourAuthModesItemTwoScopesDefault- ),- audience: zod- .enum(['project', 'organization'])- .default(- agentApplicationsRevisionsCreateBodySpecTriggersItemFourAuthModesItemTwoAudienceDefault- ),- }),- zod.object({- type: zod.literal('jwt'),- issuer_secret_ref: zod.string().min(1),- }),- zod.object({- type: zod.literal('shared_secret'),- header: zod.string().min(1),- secret_ref: zod.string().min(1),- }),- zod.object({- type: zod.literal('posthog_internal'),- }),- ])- )- .optional(),- }),- }),- zod.object({- type: zod.literal('mcp'),- config: zod- .object({- allow_restart: zod- .boolean()- .default(- agentApplicationsRevisionsCreateBodySpecTriggersItemFiveConfigAllowRestartDefault- ),- })- .default(agentApplicationsRevisionsCreateBodySpecTriggersItemFiveConfigDefault),- auth: zod.object({- modes: zod- .array(- zod.union([- zod.object({- type: zod.literal('public'),- acknowledge_public_exposure: zod.boolean(),- }),- zod.object({- type: zod.literal('posthog'),- scopes: zod- .array(zod.string())- .default(- agentApplicationsRevisionsCreateBodySpecTriggersItemFiveAuthModesItemTwoScopesDefault- ),- audience: zod- .enum(['project', 'organization'])- .default(- agentApplicationsRevisionsCreateBodySpecTriggersItemFiveAuthModesItemTwoAudienceDefault- ),- }),- zod.object({- type: zod.literal('jwt'),- issuer_secret_ref: zod.string().min(1),- }),- zod.object({- type: zod.literal('shared_secret'),- header: zod.string().min(1),- secret_ref: zod.string().min(1),- }),- zod.object({- type: zod.literal('posthog_internal'),- }),- ])- )- .optional(),- }),- }),- ])- )- .default(agentApplicationsRevisionsCreateBodySpecTriggersDefault),- tools: zod- .array(- zod.union([- zod.object({- kind: zod.literal('native'),- id: zod.string(),- requires_approval: zod- .boolean()- .default(agentApplicationsRevisionsCreateBodySpecToolsItemOneRequiresApprovalDefault),- approval_policy: zod- .object({- type: zod- .enum(['principal', 'agent'])- .default(- agentApplicationsRevisionsCreateBodySpecToolsItemOneApprovalPolicyTypeDefault- ),- allow_edit: zod- .boolean()- .default(- agentApplicationsRevisionsCreateBodySpecToolsItemOneApprovalPolicyAllowEditDefault- ),- ttl_ms: zod- .number()- .min(agentApplicationsRevisionsCreateBodySpecToolsItemOneApprovalPolicyTtlMsMin)- .max(agentApplicationsRevisionsCreateBodySpecToolsItemOneApprovalPolicyTtlMsMax)- .default(- agentApplicationsRevisionsCreateBodySpecToolsItemOneApprovalPolicyTtlMsDefault- ),- })- .optional(),- }),- zod.object({- kind: zod.literal('custom'),- id: zod.string(),- path: zod.string(),- requires_approval: zod- .boolean()- .default(agentApplicationsRevisionsCreateBodySpecToolsItemTwoRequiresApprovalDefault),- approval_policy: zod- .object({- type: zod- .enum(['principal', 'agent'])- .default(- agentApplicationsRevisionsCreateBodySpecToolsItemTwoApprovalPolicyTypeDefault- ),- allow_edit: zod- .boolean()- .default(- agentApplicationsRevisionsCreateBodySpecToolsItemTwoApprovalPolicyAllowEditDefault- ),- ttl_ms: zod- .number()- .min(agentApplicationsRevisionsCreateBodySpecToolsItemTwoApprovalPolicyTtlMsMin)- .max(agentApplicationsRevisionsCreateBodySpecToolsItemTwoApprovalPolicyTtlMsMax)- .default(- agentApplicationsRevisionsCreateBodySpecToolsItemTwoApprovalPolicyTtlMsDefault- ),- })- .optional(),- requires_identity: zod.string().optional(),- }),- zod.object({- kind: zod.literal('custom_template'),- from_template: zod.string(),- alias: zod.string(),- version: zod.number().min(1).optional(),- }),- zod.object({- kind: zod.literal('client'),- id: zod.string().min(1),- description: zod.string().min(1),- args_schema: zod- .looseObject({})- .default(agentApplicationsRevisionsCreateBodySpecToolsItemFourArgsSchemaDefault),- required: zod- .boolean()- .default(agentApplicationsRevisionsCreateBodySpecToolsItemFourRequiredDefault),- timeout_ms: zod- .number()- .min(1)- .max(agentApplicationsRevisionsCreateBodySpecToolsItemFourTimeoutMsMax)- .default(agentApplicationsRevisionsCreateBodySpecToolsItemFourTimeoutMsDefault),- interactive: zod- .boolean()- .default(agentApplicationsRevisionsCreateBodySpecToolsItemFourInteractiveDefault),- }),- ])- )- .default(agentApplicationsRevisionsCreateBodySpecToolsDefault),- mcps: zod- .array(- zod.object({- id: zod.string().min(1),- url: zod.url(),- auth: zod- .object({- provider: zod.string().optional(),- })- .optional(),- secrets: zod- .array(zod.string())- .default(agentApplicationsRevisionsCreateBodySpecMcpsItemSecretsDefault),- headers: zod.record(zod.string(), zod.string()).optional(),- tools: zod- .array(- zod.union([- zod.string().min(1),- zod.object({- name: zod.string().min(1),- requires_approval: zod- .boolean()- .default(- agentApplicationsRevisionsCreateBodySpecMcpsItemToolsItemTwoRequiresApprovalDefault- ),- approval_policy: zod- .object({- type: zod- .enum(['principal', 'agent'])- .default(- agentApplicationsRevisionsCreateBodySpecMcpsItemToolsItemTwoApprovalPolicyTypeDefault- ),- allow_edit: zod- .boolean()- .default(- agentApplicationsRevisionsCreateBodySpecMcpsItemToolsItemTwoApprovalPolicyAllowEditDefault- ),- ttl_ms: zod- .number()- .min(- agentApplicationsRevisionsCreateBodySpecMcpsItemToolsItemTwoApprovalPolicyTtlMsMin- )- .max(- agentApplicationsRevisionsCreateBodySpecMcpsItemToolsItemTwoApprovalPolicyTtlMsMax- )- .default(- agentApplicationsRevisionsCreateBodySpecMcpsItemToolsItemTwoApprovalPolicyTtlMsDefault- ),- })- .optional(),- }),- ])- )- .optional(),- })- )- .default(agentApplicationsRevisionsCreateBodySpecMcpsDefault),- skills: zod- .array(- zod.object({- id: zod.string(),- path: zod.string(),- description: zod.string().optional(),- from_template: zod.string().optional(),- alias: zod.string().optional(),- version: zod.number().min(1).optional(),- source_version_id: zod.string().optional(),- })- )- .default(agentApplicationsRevisionsCreateBodySpecSkillsDefault),- identity_providers: zod- .array(- zod.union([- zod.object({- kind: zod.literal('posthog'),- id: zod- .string()- .min(1)- .default(agentApplicationsRevisionsCreateBodySpecIdentityProvidersItemOneIdDefault),- binding: zod- .enum(['principal'])- .default(- agentApplicationsRevisionsCreateBodySpecIdentityProvidersItemOneBindingDefault- ),- scopes: zod- .array(zod.string())- .default(agentApplicationsRevisionsCreateBodySpecIdentityProvidersItemOneScopesDefault),- client_id: zod.string().optional(),- }),- zod.object({- kind: zod.literal('oauth2'),- id: zod.string().min(1),- binding: zod- .enum(['principal'])- .default(- agentApplicationsRevisionsCreateBodySpecIdentityProvidersItemTwoBindingDefault- ),- authorize_url: zod.url(),- token_url: zod.url(),- client_id: zod.string().min(1),- client_secret_ref: zod.string().optional(),- scopes: zod- .array(zod.string())- .default(agentApplicationsRevisionsCreateBodySpecIdentityProvidersItemTwoScopesDefault),- userinfo_url: zod.url().optional(),- }),- ])- )- .default(agentApplicationsRevisionsCreateBodySpecIdentityProvidersDefault),- secrets: zod- .array(- zod.union([- zod.string().min(1),- zod.object({- name: zod.string().min(1),- allowed_hosts: zod.array(zod.string().min(1)).min(1),- }),- ])- )- .default(agentApplicationsRevisionsCreateBodySpecSecretsDefault),- limits: zod- .object({- max_turns: zod- .number()- .gt(agentApplicationsRevisionsCreateBodySpecLimitsMaxTurnsExclusiveMin)- .max(agentApplicationsRevisionsCreateBodySpecLimitsMaxTurnsMax)- .default(agentApplicationsRevisionsCreateBodySpecLimitsMaxTurnsDefault),- max_tool_calls: zod- .number()- .gt(agentApplicationsRevisionsCreateBodySpecLimitsMaxToolCallsExclusiveMin)- .max(agentApplicationsRevisionsCreateBodySpecLimitsMaxToolCallsMax)- .default(agentApplicationsRevisionsCreateBodySpecLimitsMaxToolCallsDefault),- max_wall_seconds: zod- .number()- .gt(agentApplicationsRevisionsCreateBodySpecLimitsMaxWallSecondsExclusiveMin)- .max(agentApplicationsRevisionsCreateBodySpecLimitsMaxWallSecondsMax)- .default(agentApplicationsRevisionsCreateBodySpecLimitsMaxWallSecondsDefault),- max_output_tokens: zod- .number()- .gt(agentApplicationsRevisionsCreateBodySpecLimitsMaxOutputTokensExclusiveMin)- .max(agentApplicationsRevisionsCreateBodySpecLimitsMaxOutputTokensMax)- .optional(),- max_memory_mb: zod- .number()- .gt(agentApplicationsRevisionsCreateBodySpecLimitsMaxMemoryMbExclusiveMin)- .max(agentApplicationsRevisionsCreateBodySpecLimitsMaxMemoryMbMax)- .default(agentApplicationsRevisionsCreateBodySpecLimitsMaxMemoryMbDefault),- max_cpu_cores: zod- .number()- .gt(agentApplicationsRevisionsCreateBodySpecLimitsMaxCpuCoresExclusiveMin)- .max(agentApplicationsRevisionsCreateBodySpecLimitsMaxCpuCoresMax)- .default(agentApplicationsRevisionsCreateBodySpecLimitsMaxCpuCoresDefault),- })- .default(agentApplicationsRevisionsCreateBodySpecLimitsDefault),- reasoning: zod.enum(['minimal', 'low', 'medium', 'high', 'xhigh']).optional(),- framework_prompt: zod- .object({- omit: zod- .array(- zod.enum([- 'meta_tool_guidance',- 'state_contract',- 'tool_failure_guidance',- 'approval_guidance',- 'reasoning_hint',- ])- )- .default(agentApplicationsRevisionsCreateBodySpecFrameworkPromptOmitDefault),- version_pin: zod- .number()- .gt(agentApplicationsRevisionsCreateBodySpecFrameworkPromptVersionPinExclusiveMin)- .max(agentApplicationsRevisionsCreateBodySpecFrameworkPromptVersionPinMax)- .optional(),- })- .optional(),- resume: zod- .object({- enabled: zod.boolean().default(agentApplicationsRevisionsCreateBodySpecResumeEnabledDefault),- max_completed_age_ms: zod- .number()- .gt(agentApplicationsRevisionsCreateBodySpecResumeMaxCompletedAgeMsExclusiveMin)- .max(agentApplicationsRevisionsCreateBodySpecResumeMaxCompletedAgeMsMax)- .default(agentApplicationsRevisionsCreateBodySpecResumeMaxCompletedAgeMsDefault),- })- .optional(),- })- .optional(),+ spec: zod.unknown().optional(),})/**@@ -900,124 +243,6 @@ export const AgentApplicationsRevisionsPartialUpdateParams = /* @__PURE__ */ zod),})-export const agentApplicationsRevisionsPartialUpdateBodySpecModelsOneLevelDefault = `medium`-export const agentApplicationsRevisionsPartialUpdateBodySpecModelsOneOptimizeForDefault = `cost`--export const agentApplicationsRevisionsPartialUpdateBodySpecModelsTwoModelsItemModelRegExp = new RegExp(- '^[a-z0-9_-]+/[a-zA-Z0-9._:-]+$'-)--export const agentApplicationsRevisionsPartialUpdateBodySpecModelsTwoOptimizeForDefault = `cost`-export const agentApplicationsRevisionsPartialUpdateBodySpecModelsDefault = {- mode: 'auto' as const,- level: 'medium' as const,- optimize_for: 'cost' as const,-}-export const agentApplicationsRevisionsPartialUpdateBodySpecTriggersItemOneConfigMentionOnlyDefault = false-export const agentApplicationsRevisionsPartialUpdateBodySpecTriggersItemOneConfigAutoResumeThreadsDefault = false-export const agentApplicationsRevisionsPartialUpdateBodySpecTriggersItemOneConfigAllowWorkspaceParticipantsDefault = false-export const agentApplicationsRevisionsPartialUpdateBodySpecTriggersItemOneConfigAllowDirectMessagesDefault = false-export const agentApplicationsRevisionsPartialUpdateBodySpecTriggersItemTwoAuthModesItemTwoScopesDefault = []-export const agentApplicationsRevisionsPartialUpdateBodySpecTriggersItemTwoAuthModesItemTwoAudienceDefault = `project`--export const agentApplicationsRevisionsPartialUpdateBodySpecTriggersItemThreeConfigTimezoneDefault = `UTC`-export const agentApplicationsRevisionsPartialUpdateBodySpecTriggersItemThreeConfigPromptMax = 4096--export const agentApplicationsRevisionsPartialUpdateBodySpecTriggersItemThreeConfigCatchUpDefault = `most_recent`-export const agentApplicationsRevisionsPartialUpdateBodySpecTriggersItemThreeConfigMaxCatchUpAgeSecondsDefault = 3600-export const agentApplicationsRevisionsPartialUpdateBodySpecTriggersItemThreeConfigMaxCatchUpAgeSecondsMax = 604800--export const agentApplicationsRevisionsPartialUpdateBodySpecTriggersItemFourConfigAllowRestartDefault = false-export const agentApplicationsRevisionsPartialUpdateBodySpecTriggersItemFourConfigDefault = { allow_restart: false }-export const agentApplicationsRevisionsPartialUpdateBodySpecTriggersItemFourAuthModesItemTwoScopesDefault = []-export const agentApplicationsRevisionsPartialUpdateBodySpecTriggersItemFourAuthModesItemTwoAudienceDefault = `project`--export const agentApplicationsRevisionsPartialUpdateBodySpecTriggersItemFiveConfigAllowRestartDefault = false-export const agentApplicationsRevisionsPartialUpdateBodySpecTriggersItemFiveConfigDefault = { allow_restart: false }-export const agentApplicationsRevisionsPartialUpdateBodySpecTriggersItemFiveAuthModesItemTwoScopesDefault = []-export const agentApplicationsRevisionsPartialUpdateBodySpecTriggersItemFiveAuthModesItemTwoAudienceDefault = `project`--export const agentApplicationsRevisionsPartialUpdateBodySpecTriggersDefault = []-export const agentApplicationsRevisionsPartialUpdateBodySpecToolsItemOneRequiresApprovalDefault = false-export const agentApplicationsRevisionsPartialUpdateBodySpecToolsItemOneApprovalPolicyTypeDefault = `principal`-export const agentApplicationsRevisionsPartialUpdateBodySpecToolsItemOneApprovalPolicyAllowEditDefault = false-export const agentApplicationsRevisionsPartialUpdateBodySpecToolsItemOneApprovalPolicyTtlMsDefault = 86400000-export const agentApplicationsRevisionsPartialUpdateBodySpecToolsItemOneApprovalPolicyTtlMsMin = 60000-export const agentApplicationsRevisionsPartialUpdateBodySpecToolsItemOneApprovalPolicyTtlMsMax = 604800000--export const agentApplicationsRevisionsPartialUpdateBodySpecToolsItemTwoRequiresApprovalDefault = false-export const agentApplicationsRevisionsPartialUpdateBodySpecToolsItemTwoApprovalPolicyTypeDefault = `principal`-export const agentApplicationsRevisionsPartialUpdateBodySpecToolsItemTwoApprovalPolicyAllowEditDefault = false-export const agentApplicationsRevisionsPartialUpdateBodySpecToolsItemTwoApprovalPolicyTtlMsDefault = 86400000-export const agentApplicationsRevisionsPartialUpdateBodySpecToolsItemTwoApprovalPolicyTtlMsMin = 60000-export const agentApplicationsRevisionsPartialUpdateBodySpecToolsItemTwoApprovalPolicyTtlMsMax = 604800000--export const agentApplicationsRevisionsPartialUpdateBodySpecToolsItemFourArgsSchemaDefault = {}-export const agentApplicationsRevisionsPartialUpdateBodySpecToolsItemFourRequiredDefault = false-export const agentApplicationsRevisionsPartialUpdateBodySpecToolsItemFourTimeoutMsDefault = 5000-export const agentApplicationsRevisionsPartialUpdateBodySpecToolsItemFourTimeoutMsMax = 600000--export const agentApplicationsRevisionsPartialUpdateBodySpecToolsItemFourInteractiveDefault = false-export const agentApplicationsRevisionsPartialUpdateBodySpecToolsDefault = []-export const agentApplicationsRevisionsPartialUpdateBodySpecMcpsItemSecretsDefault = []--export const agentApplicationsRevisionsPartialUpdateBodySpecMcpsItemToolsItemTwoRequiresApprovalDefault = false-export const agentApplicationsRevisionsPartialUpdateBodySpecMcpsItemToolsItemTwoApprovalPolicyTypeDefault = `principal`-export const agentApplicationsRevisionsPartialUpdateBodySpecMcpsItemToolsItemTwoApprovalPolicyAllowEditDefault = false-export const agentApplicationsRevisionsPartialUpdateBodySpecMcpsItemToolsItemTwoApprovalPolicyTtlMsDefault = 86400000-export const agentApplicationsRevisionsPartialUpdateBodySpecMcpsItemToolsItemTwoApprovalPolicyTtlMsMin = 60000-export const agentApplicationsRevisionsPartialUpdateBodySpecMcpsItemToolsItemTwoApprovalPolicyTtlMsMax = 604800000--export const agentApplicationsRevisionsPartialUpdateBodySpecMcpsDefault = []-export const agentApplicationsRevisionsPartialUpdateBodySpecSkillsDefault = []-export const agentApplicationsRevisionsPartialUpdateBodySpecIdentityProvidersItemOneIdDefault = `posthog`--export const agentApplicationsRevisionsPartialUpdateBodySpecIdentityProvidersItemOneBindingDefault = `principal`-export const agentApplicationsRevisionsPartialUpdateBodySpecIdentityProvidersItemOneScopesDefault = []-export const agentApplicationsRevisionsPartialUpdateBodySpecIdentityProvidersItemTwoBindingDefault = `principal`-export const agentApplicationsRevisionsPartialUpdateBodySpecIdentityProvidersItemTwoScopesDefault = []-export const agentApplicationsRevisionsPartialUpdateBodySpecIdentityProvidersDefault = []--export const agentApplicationsRevisionsPartialUpdateBodySpecSecretsDefault = []-export const agentApplicationsRevisionsPartialUpdateBodySpecLimitsMaxTurnsDefault = 50-export const agentApplicationsRevisionsPartialUpdateBodySpecLimitsMaxTurnsExclusiveMin = 0-export const agentApplicationsRevisionsPartialUpdateBodySpecLimitsMaxTurnsMax = 2147483647--export const agentApplicationsRevisionsPartialUpdateBodySpecLimitsMaxToolCallsDefault = 200-export const agentApplicationsRevisionsPartialUpdateBodySpecLimitsMaxToolCallsExclusiveMin = 0-export const agentApplicationsRevisionsPartialUpdateBodySpecLimitsMaxToolCallsMax = 2147483647--export const agentApplicationsRevisionsPartialUpdateBodySpecLimitsMaxWallSecondsDefault = 900-export const agentApplicationsRevisionsPartialUpdateBodySpecLimitsMaxWallSecondsExclusiveMin = 0-export const agentApplicationsRevisionsPartialUpdateBodySpecLimitsMaxWallSecondsMax = 2147483647--export const agentApplicationsRevisionsPartialUpdateBodySpecLimitsMaxOutputTokensExclusiveMin = 0-export const agentApplicationsRevisionsPartialUpdateBodySpecLimitsMaxOutputTokensMax = 200000--export const agentApplicationsRevisionsPartialUpdateBodySpecLimitsMaxMemoryMbDefault = 512-export const agentApplicationsRevisionsPartialUpdateBodySpecLimitsMaxMemoryMbExclusiveMin = 0-export const agentApplicationsRevisionsPartialUpdateBodySpecLimitsMaxMemoryMbMax = 16384--export const agentApplicationsRevisionsPartialUpdateBodySpecLimitsMaxCpuCoresDefault = 0.25-export const agentApplicationsRevisionsPartialUpdateBodySpecLimitsMaxCpuCoresExclusiveMin = 0-export const agentApplicationsRevisionsPartialUpdateBodySpecLimitsMaxCpuCoresMax = 8--export const agentApplicationsRevisionsPartialUpdateBodySpecLimitsDefault = {- max_turns: 50,- max_tool_calls: 200,- max_wall_seconds: 900,- max_memory_mb: 512,- max_cpu_cores: 0.25,-}-export const agentApplicationsRevisionsPartialUpdateBodySpecFrameworkPromptOmitDefault = []-export const agentApplicationsRevisionsPartialUpdateBodySpecFrameworkPromptVersionPinExclusiveMin = 0-export const agentApplicationsRevisionsPartialUpdateBodySpecFrameworkPromptVersionPinMax = 2147483647--export const agentApplicationsRevisionsPartialUpdateBodySpecResumeEnabledDefault = false-export const agentApplicationsRevisionsPartialUpdateBodySpecResumeMaxCompletedAgeMsDefault = 604800000-export const agentApplicationsRevisionsPartialUpdateBodySpecResumeMaxCompletedAgeMsExclusiveMin = 0-export const agentApplicationsRevisionsPartialUpdateBodySpecResumeMaxCompletedAgeMsMax = 2147483647-export const AgentApplicationsRevisionsPartialUpdateBody = /* @__PURE__ */ zod.object({parent_revision: zod.uuid().nullish(),bundle_uri: zod@@ -1026,571 +251,7 @@ export const AgentApplicationsRevisionsPartialUpdateBody = /* @__PURE__ */ zod.o.describe('Storage-prefix metadata for the bundle, e.g. `fs://my-agent/`. Optional — leave blank and the server fills `fs://<application-slug>/`. Bundles are addressed by revision id regardless, so this is only a prefix hint.'),- spec: zod- .object({- models: zod- .union([- zod.object({- mode: zod.literal('auto'),- level: zod- .enum(['low', 'medium', 'high'])- .default(agentApplicationsRevisionsPartialUpdateBodySpecModelsOneLevelDefault)- .describe(- 'Quality/cost tier (auto). low = cheapest, for short, formulaic, no-reasoning jobs (lookups, FAQ bots); medium = balanced default, for multi-step but bounded work; high = top-tier, for long, branching, reasoning-heavy work. Resolved to a priority-ordered cross-provider list at session start.'- ),- reasoning: zod- .enum(['minimal', 'low', 'medium', 'high', 'xhigh'])- .optional()- .describe(- 'Reasoning/thinking effort budget. minimal = no deliberation (fastest, cheapest) … xhigh = maximal (research-grade, ~5-10x the per-turn cost). Omit for the provider/spec default.'- ),- optimize_for: zod- .enum(['cost', 'availability'])- .default(agentApplicationsRevisionsPartialUpdateBodySpecModelsOneOptimizeForDefault)- .describe(- "Session model stability vs. resilience. `cost` (default): the first turn picks a working model and PINS it for the whole session — keeps the provider's prompt cache warm (cache reads are ~0.1-0.5x of full input) and never fails over mid-session; if the pinned model is down the turn fails rather than re-reading the whole context cold on another provider. `availability`: fail over to the next model when the session's model fails — survives an outage at the cost of a one-time cold re-read. Prefer `cost` for long/expensive sessions, `availability` where uptime matters more than spend."- ),- }),- zod.object({- mode: zod.literal('manual'),- models: zod- .array(- zod.object({- model: zod- .string()- .min(1)- .regex(- agentApplicationsRevisionsPartialUpdateBodySpecModelsTwoModelsItemModelRegExp- )- .describe(- 'Canonical model id, e.g. `anthropic/claude-sonnet-4-6` (see the agent-applications-models tool for served ids).'- ),- reasoning: zod- .enum(['minimal', 'low', 'medium', 'high', 'xhigh'])- .optional()- .describe('Per-model reasoning effort override (else the spec default).'),- })- )- .min(1)- .describe(- 'Explicit priority-ordered fallback list — the runner tries entries in order (primary first).'- ),- optimize_for: zod- .enum(['cost', 'availability'])- .default(agentApplicationsRevisionsPartialUpdateBodySpecModelsTwoOptimizeForDefault)- .describe(- "Session model stability vs. resilience. `cost` (default): pin the first working model for the whole session (warm prompt cache, no mid-session failover). `availability`: fail over down this list when the session's model fails (survives outages, re-reads context cold)."- ),- }),- ])- .default(agentApplicationsRevisionsPartialUpdateBodySpecModelsDefault)- .describe(- "How this agent selects its model. `auto`: pick a quality/cost `level` and the platform resolves it to a maintained, priority-ordered, cross-provider list at runtime. `manual`: give an explicit priority-ordered `models` list (primary first). `optimize_for` governs how the chosen model is treated across the session's turns."- ),- triggers: zod- .array(- zod.union([- zod.object({- type: zod.literal('slack'),- config: zod.object({- channel_id: zod.string().optional(),- mention_only: zod- .boolean()- .default(- agentApplicationsRevisionsPartialUpdateBodySpecTriggersItemOneConfigMentionOnlyDefault- ),- auto_resume_threads: zod- .boolean()- .default(- agentApplicationsRevisionsPartialUpdateBodySpecTriggersItemOneConfigAutoResumeThreadsDefault- ),- allow_workspace_participants: zod- .boolean()- .default(- agentApplicationsRevisionsPartialUpdateBodySpecTriggersItemOneConfigAllowWorkspaceParticipantsDefault- ),- ack_reaction: zod.string().optional(),- allow_direct_messages: zod- .boolean()- .default(- agentApplicationsRevisionsPartialUpdateBodySpecTriggersItemOneConfigAllowDirectMessagesDefault- ),- trusted_workspaces: zod.union([zod.array(zod.string()).min(1), zod.literal('*')]),- }),- }),- zod.object({- type: zod.literal('webhook'),- config: zod.object({- path: zod.string(),- }),- auth: zod.object({- modes: zod- .array(- zod.union([- zod.object({- type: zod.literal('public'),- acknowledge_public_exposure: zod.boolean(),- }),- zod.object({- type: zod.literal('posthog'),- scopes: zod- .array(zod.string())- .default(- agentApplicationsRevisionsPartialUpdateBodySpecTriggersItemTwoAuthModesItemTwoScopesDefault- ),- audience: zod- .enum(['project', 'organization'])- .default(- agentApplicationsRevisionsPartialUpdateBodySpecTriggersItemTwoAuthModesItemTwoAudienceDefault- ),- }),- zod.object({- type: zod.literal('jwt'),- issuer_secret_ref: zod.string().min(1),- }),- zod.object({- type: zod.literal('shared_secret'),- header: zod.string().min(1),- secret_ref: zod.string().min(1),- }),- zod.object({- type: zod.literal('posthog_internal'),- }),- ])- )- .optional(),- }),- }),- zod.object({- type: zod.literal('cron'),- config: zod.object({- name: zod.string().min(1),- schedule: zod.string().min(1),- timezone: zod- .string()- .default(- agentApplicationsRevisionsPartialUpdateBodySpecTriggersItemThreeConfigTimezoneDefault- ),- prompt: zod- .string()- .min(1)- .max(- agentApplicationsRevisionsPartialUpdateBodySpecTriggersItemThreeConfigPromptMax- ),- external_key: zod.string().optional(),- catch_up: zod- .enum(['all', 'most_recent', 'skip'])- .default(- agentApplicationsRevisionsPartialUpdateBodySpecTriggersItemThreeConfigCatchUpDefault- ),- max_catch_up_age_seconds: zod- .number()- .min(1)- .max(- agentApplicationsRevisionsPartialUpdateBodySpecTriggersItemThreeConfigMaxCatchUpAgeSecondsMax- )- .default(- agentApplicationsRevisionsPartialUpdateBodySpecTriggersItemThreeConfigMaxCatchUpAgeSecondsDefault- ),- }),- }),- zod.object({- type: zod.literal('chat'),- config: zod- .object({- allow_restart: zod- .boolean()- .default(- agentApplicationsRevisionsPartialUpdateBodySpecTriggersItemFourConfigAllowRestartDefault- ),- })- .default(agentApplicationsRevisionsPartialUpdateBodySpecTriggersItemFourConfigDefault),- auth: zod.object({- modes: zod- .array(- zod.union([- zod.object({- type: zod.literal('public'),- acknowledge_public_exposure: zod.boolean(),- }),- zod.object({- type: zod.literal('posthog'),- scopes: zod- .array(zod.string())- .default(- agentApplicationsRevisionsPartialUpdateBodySpecTriggersItemFourAuthModesItemTwoScopesDefault- ),- audience: zod- .enum(['project', 'organization'])- .default(- agentApplicationsRevisionsPartialUpdateBodySpecTriggersItemFourAuthModesItemTwoAudienceDefault- ),- }),- zod.object({- type: zod.literal('jwt'),- issuer_secret_ref: zod.string().min(1),- }),- zod.object({- type: zod.literal('shared_secret'),- header: zod.string().min(1),- secret_ref: zod.string().min(1),- }),- zod.object({- type: zod.literal('posthog_internal'),- }),- ])- )- .optional(),- }),- }),- zod.object({- type: zod.literal('mcp'),- config: zod- .object({- allow_restart: zod- .boolean()- .default(- agentApplicationsRevisionsPartialUpdateBodySpecTriggersItemFiveConfigAllowRestartDefault- ),- })- .default(agentApplicationsRevisionsPartialUpdateBodySpecTriggersItemFiveConfigDefault),- auth: zod.object({- modes: zod- .array(- zod.union([- zod.object({- type: zod.literal('public'),- acknowledge_public_exposure: zod.boolean(),- }),- zod.object({- type: zod.literal('posthog'),- scopes: zod- .array(zod.string())- .default(- agentApplicationsRevisionsPartialUpdateBodySpecTriggersItemFiveAuthModesItemTwoScopesDefault- ),- audience: zod- .enum(['project', 'organization'])- .default(- agentApplicationsRevisionsPartialUpdateBodySpecTriggersItemFiveAuthModesItemTwoAudienceDefault- ),- }),- zod.object({- type: zod.literal('jwt'),- issuer_secret_ref: zod.string().min(1),- }),- zod.object({- type: zod.literal('shared_secret'),- header: zod.string().min(1),- secret_ref: zod.string().min(1),- }),- zod.object({- type: zod.literal('posthog_internal'),- }),- ])- )- .optional(),- }),- }),- ])- )- .default(agentApplicationsRevisionsPartialUpdateBodySpecTriggersDefault),- tools: zod- .array(- zod.union([- zod.object({- kind: zod.literal('native'),- id: zod.string(),- requires_approval: zod- .boolean()- .default(- agentApplicationsRevisionsPartialUpdateBodySpecToolsItemOneRequiresApprovalDefault- ),- approval_policy: zod- .object({- type: zod- .enum(['principal', 'agent'])- .default(- agentApplicationsRevisionsPartialUpdateBodySpecToolsItemOneApprovalPolicyTypeDefault- ),- allow_edit: zod- .boolean()- .default(- agentApplicationsRevisionsPartialUpdateBodySpecToolsItemOneApprovalPolicyAllowEditDefault- ),- ttl_ms: zod- .number()- .min(- agentApplicationsRevisionsPartialUpdateBodySpecToolsItemOneApprovalPolicyTtlMsMin- )- .max(- agentApplicationsRevisionsPartialUpdateBodySpecToolsItemOneApprovalPolicyTtlMsMax- )- .default(- agentApplicationsRevisionsPartialUpdateBodySpecToolsItemOneApprovalPolicyTtlMsDefault- ),- })- .optional(),- }),- zod.object({- kind: zod.literal('custom'),- id: zod.string(),- path: zod.string(),- requires_approval: zod- .boolean()- .default(- agentApplicationsRevisionsPartialUpdateBodySpecToolsItemTwoRequiresApprovalDefault- ),- approval_policy: zod- .object({- type: zod- .enum(['principal', 'agent'])- .default(- agentApplicationsRevisionsPartialUpdateBodySpecToolsItemTwoApprovalPolicyTypeDefault- ),- allow_edit: zod- .boolean()- .default(- agentApplicationsRevisionsPartialUpdateBodySpecToolsItemTwoApprovalPolicyAllowEditDefault- ),- ttl_ms: zod- .number()- .min(- agentApplicationsRevisionsPartialUpdateBodySpecToolsItemTwoApprovalPolicyTtlMsMin- )- .max(- agentApplicationsRevisionsPartialUpdateBodySpecToolsItemTwoApprovalPolicyTtlMsMax- )- .default(- agentApplicationsRevisionsPartialUpdateBodySpecToolsItemTwoApprovalPolicyTtlMsDefault- ),- })- .optional(),- requires_identity: zod.string().optional(),- }),- zod.object({- kind: zod.literal('custom_template'),- from_template: zod.string(),- alias: zod.string(),- version: zod.number().min(1).optional(),- }),- zod.object({- kind: zod.literal('client'),- id: zod.string().min(1),- description: zod.string().min(1),- args_schema: zod- .looseObject({})- .default(agentApplicationsRevisionsPartialUpdateBodySpecToolsItemFourArgsSchemaDefault),- required: zod- .boolean()- .default(agentApplicationsRevisionsPartialUpdateBodySpecToolsItemFourRequiredDefault),- timeout_ms: zod- .number()- .min(1)- .max(agentApplicationsRevisionsPartialUpdateBodySpecToolsItemFourTimeoutMsMax)- .default(agentApplicationsRevisionsPartialUpdateBodySpecToolsItemFourTimeoutMsDefault),- interactive: zod- .boolean()- .default(- agentApplicationsRevisionsPartialUpdateBodySpecToolsItemFourInteractiveDefault- ),- }),- ])- )- .default(agentApplicationsRevisionsPartialUpdateBodySpecToolsDefault),- mcps: zod- .array(- zod.object({- id: zod.string().min(1),- url: zod.url(),- auth: zod- .object({- provider: zod.string().optional(),- })- .optional(),- secrets: zod- .array(zod.string())- .default(agentApplicationsRevisionsPartialUpdateBodySpecMcpsItemSecretsDefault),- headers: zod.record(zod.string(), zod.string()).optional(),- tools: zod- .array(- zod.union([- zod.string().min(1),- zod.object({- name: zod.string().min(1),- requires_approval: zod- .boolean()- .default(- agentApplicationsRevisionsPartialUpdateBodySpecMcpsItemToolsItemTwoRequiresApprovalDefault- ),- approval_policy: zod- .object({- type: zod- .enum(['principal', 'agent'])- .default(- agentApplicationsRevisionsPartialUpdateBodySpecMcpsItemToolsItemTwoApprovalPolicyTypeDefault- ),- allow_edit: zod- .boolean()- .default(- agentApplicationsRevisionsPartialUpdateBodySpecMcpsItemToolsItemTwoApprovalPolicyAllowEditDefault- ),- ttl_ms: zod- .number()- .min(- agentApplicationsRevisionsPartialUpdateBodySpecMcpsItemToolsItemTwoApprovalPolicyTtlMsMin- )- .max(- agentApplicationsRevisionsPartialUpdateBodySpecMcpsItemToolsItemTwoApprovalPolicyTtlMsMax- )- .default(- agentApplicationsRevisionsPartialUpdateBodySpecMcpsItemToolsItemTwoApprovalPolicyTtlMsDefault- ),- })- .optional(),- }),- ])- )- .optional(),- })- )- .default(agentApplicationsRevisionsPartialUpdateBodySpecMcpsDefault),- skills: zod- .array(- zod.object({- id: zod.string(),- path: zod.string(),- description: zod.string().optional(),- from_template: zod.string().optional(),- alias: zod.string().optional(),- version: zod.number().min(1).optional(),- source_version_id: zod.string().optional(),- })- )- .default(agentApplicationsRevisionsPartialUpdateBodySpecSkillsDefault),- identity_providers: zod- .array(- zod.union([- zod.object({- kind: zod.literal('posthog'),- id: zod- .string()- .min(1)- .default(- agentApplicationsRevisionsPartialUpdateBodySpecIdentityProvidersItemOneIdDefault- ),- binding: zod- .enum(['principal'])- .default(- agentApplicationsRevisionsPartialUpdateBodySpecIdentityProvidersItemOneBindingDefault- ),- scopes: zod- .array(zod.string())- .default(- agentApplicationsRevisionsPartialUpdateBodySpecIdentityProvidersItemOneScopesDefault- ),- client_id: zod.string().optional(),- }),- zod.object({- kind: zod.literal('oauth2'),- id: zod.string().min(1),- binding: zod- .enum(['principal'])- .default(- agentApplicationsRevisionsPartialUpdateBodySpecIdentityProvidersItemTwoBindingDefault- ),- authorize_url: zod.url(),- token_url: zod.url(),- client_id: zod.string().min(1),- client_secret_ref: zod.string().optional(),- scopes: zod- .array(zod.string())- .default(- agentApplicationsRevisionsPartialUpdateBodySpecIdentityProvidersItemTwoScopesDefault- ),- userinfo_url: zod.url().optional(),- }),- ])- )- .default(agentApplicationsRevisionsPartialUpdateBodySpecIdentityProvidersDefault),- secrets: zod- .array(- zod.union([- zod.string().min(1),- zod.object({- name: zod.string().min(1),- allowed_hosts: zod.array(zod.string().min(1)).min(1),- }),- ])- )- .default(agentApplicationsRevisionsPartialUpdateBodySpecSecretsDefault),- limits: zod- .object({- max_turns: zod- .number()- .gt(agentApplicationsRevisionsPartialUpdateBodySpecLimitsMaxTurnsExclusiveMin)- .max(agentApplicationsRevisionsPartialUpdateBodySpecLimitsMaxTurnsMax)- .default(agentApplicationsRevisionsPartialUpdateBodySpecLimitsMaxTurnsDefault),- max_tool_calls: zod- .number()- .gt(agentApplicationsRevisionsPartialUpdateBodySpecLimitsMaxToolCallsExclusiveMin)- .max(agentApplicationsRevisionsPartialUpdateBodySpecLimitsMaxToolCallsMax)- .default(agentApplicationsRevisionsPartialUpdateBodySpecLimitsMaxToolCallsDefault),- max_wall_seconds: zod- .number()- .gt(agentApplicationsRevisionsPartialUpdateBodySpecLimitsMaxWallSecondsExclusiveMin)- .max(agentApplicationsRevisionsPartialUpdateBodySpecLimitsMaxWallSecondsMax)- .default(agentApplicationsRevisionsPartialUpdateBodySpecLimitsMaxWallSecondsDefault),- max_output_tokens: zod- .number()- .gt(agentApplicationsRevisionsPartialUpdateBodySpecLimitsMaxOutputTokensExclusiveMin)- .max(agentApplicationsRevisionsPartialUpdateBodySpecLimitsMaxOutputTokensMax)- .optional(),- max_memory_mb: zod- .number()- .gt(agentApplicationsRevisionsPartialUpdateBodySpecLimitsMaxMemoryMbExclusiveMin)- .max(agentApplicationsRevisionsPartialUpdateBodySpecLimitsMaxMemoryMbMax)- .default(agentApplicationsRevisionsPartialUpdateBodySpecLimitsMaxMemoryMbDefault),- max_cpu_cores: zod- .number()- .gt(agentApplicationsRevisionsPartialUpdateBodySpecLimitsMaxCpuCoresExclusiveMin)- .max(agentApplicationsRevisionsPartialUpdateBodySpecLimitsMaxCpuCoresMax)- .default(agentApplicationsRevisionsPartialUpdateBodySpecLimitsMaxCpuCoresDefault),- })- .default(agentApplicationsRevisionsPartialUpdateBodySpecLimitsDefault),- reasoning: zod.enum(['minimal', 'low', 'medium', 'high', 'xhigh']).optional(),- framework_prompt: zod- .object({- omit: zod- .array(- zod.enum([- 'meta_tool_guidance',- 'state_contract',- 'tool_failure_guidance',- 'approval_guidance',- 'reasoning_hint',- ])- )- .default(agentApplicationsRevisionsPartialUpdateBodySpecFrameworkPromptOmitDefault),- version_pin: zod- .number()- .gt(agentApplicationsRevisionsPartialUpdateBodySpecFrameworkPromptVersionPinExclusiveMin)- .max(agentApplicationsRevisionsPartialUpdateBodySpecFrameworkPromptVersionPinMax)- .optional(),- })- .optional(),- resume: zod- .object({- enabled: zod.boolean().default(agentApplicationsRevisionsPartialUpdateBodySpecResumeEnabledDefault),- max_completed_age_ms: zod- .number()- .gt(agentApplicationsRevisionsPartialUpdateBodySpecResumeMaxCompletedAgeMsExclusiveMin)- .max(agentApplicationsRevisionsPartialUpdateBodySpecResumeMaxCompletedAgeMsMax)- .default(agentApplicationsRevisionsPartialUpdateBodySpecResumeMaxCompletedAgeMsDefault),- })- .optional(),- })- .optional(),+ spec: zod.unknown().optional(),})/**@@ -2385,6 +1046,26 @@ export const AgentApplicationsModelsParams = /* @__PURE__ */ zod.object({),})+/**+ * The canonical JSON Schema for an agent `spec` — every field, type, enum, default, and the discriminated unions for `models` / `triggers[]` / `tools[]`, each with an inline description. Emitted from the same source the runner validates against (fields with a default are optional on write), so read it BEFORE composing a spec for create / revisions-spec-update instead of guessing the shape. Pass `section` to fetch just one part.+ */+export const AgentApplicationsSpecSchemaParams = /* @__PURE__ */ zod.object({+ project_id: zod+ .string()+ .describe(+ "Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/."+ ),+})++export const AgentApplicationsSpecSchemaQueryParams = /* @__PURE__ */ zod.object({+ section: zod+ .string()+ .optional()+ .describe(+ 'Return only this top-level slice of the spec schema to save tokens — one of `models`, `triggers`, `tools`, `mcps`, `skills`, `identity_providers`, `secrets`, `limits`, `reasoning`, `framework_prompt`, `resume`. Omit for the whole spec schema.'+ ),+})+/*** Read-only catalog of every @posthog/* native tool the runner knows.*/diff --git a/services/mcp/src/tools/generated/agent_platform.ts b/services/mcp/src/tools/generated/agent_platform.tsindex 0128f315a674..c32a50cce681 100644--- a/services/mcp/src/tools/generated/agent_platform.ts+++ b/services/mcp/src/tools/generated/agent_platform.ts@@ -50,6 +50,7 @@ import {AgentApplicationsSessionsListQueryParams,AgentApplicationsSessionsRetrieveParams,AgentApplicationsSessionsRetrieveQueryParams,+ AgentApplicationsSpecSchemaQueryParams,AgentRevisionsEnvKeysClearParams,AgentRevisionsEnvKeysGetParams,AgentRevisionsEnvKeysListParams,@@ -847,6 +848,27 @@ const agentApplicationsSessionsRetrieve = (): ToolBase<},})+const AgentApplicationsSpecSchemaSchema = AgentApplicationsSpecSchemaQueryParams++const agentApplicationsSpecSchema = (): ToolBase<+ typeof AgentApplicationsSpecSchemaSchema,+ Schemas.AgentApplication+> => ({+ name: 'agent-applications-spec-schema',+ schema: AgentApplicationsSpecSchemaSchema,+ handler: async (context: Context, params: z.infer<typeof AgentApplicationsSpecSchemaSchema>) => {+ const projectId = await context.stateManager.getProjectId()+ const result = await context.api.request<Schemas.AgentApplication>({+ method: 'GET',+ path: `/api/projects/${encodeURIComponent(String(projectId))}/agent_applications/spec_schema/`,+ query: {+ section: params.section,+ },+ })+ return result+ },+})+const AgentNativeToolsListSchema = z.object({})const agentNativeToolsList = (): ToolBase<@@ -901,5 +923,6 @@ export const GENERATED_TOOLS: Record<string, () => ToolBase<ZodObjectAny>> = {'agent-applications-session-logs': agentApplicationsSessionLogs,'agent-applications-sessions-list': agentApplicationsSessionsList,'agent-applications-sessions-retrieve': agentApplicationsSessionsRetrieve,+ 'agent-applications-spec-schema': agentApplicationsSpecSchema,'agent-native-tools-list': agentNativeToolsList,}diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/agent-applications-revisions-create.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/agent-applications-revisions-create.jsonindex 5c62a58da63c..51c7cf74d144 100644--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/agent-applications-revisions-create.json+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/agent-applications-revisions-create.json@@ -21,992 +21,7 @@}]},- "spec": {- "properties": {- "framework_prompt": {- "properties": {- "omit": {- "default": [],- "items": {- "enum": [- "meta_tool_guidance",- "state_contract",- "tool_failure_guidance",- "approval_guidance",- "reasoning_hint"- ],- "type": "string"- },- "type": "array"- },- "version_pin": {- "exclusiveMinimum": 0,- "maximum": 2147483647,- "type": "number"- }- },- "type": "object"- },- "identity_providers": {- "default": [],- "items": {- "anyOf": [- {- "properties": {- "binding": {- "default": "principal",- "enum": ["principal"],- "type": "string"- },- "client_id": {- "type": "string"- },- "id": {- "default": "posthog",- "minLength": 1,- "type": "string"- },- "kind": {- "const": "posthog",- "type": "string"- },- "scopes": {- "default": [],- "items": {- "type": "string"- },- "type": "array"- }- },- "required": ["kind"],- "type": "object"- },- {- "properties": {- "authorize_url": {- "format": "uri",- "type": "string"- },- "binding": {- "default": "principal",- "enum": ["principal"],- "type": "string"- },- "client_id": {- "minLength": 1,- "type": "string"- },- "client_secret_ref": {- "type": "string"- },- "id": {- "minLength": 1,- "type": "string"- },- "kind": {- "const": "oauth2",- "type": "string"- },- "scopes": {- "default": [],- "items": {- "type": "string"- },- "type": "array"- },- "token_url": {- "format": "uri",- "type": "string"- },- "userinfo_url": {- "format": "uri",- "type": "string"- }- },- "required": ["kind", "id", "authorize_url", "token_url", "client_id"],- "type": "object"- }- ]- },- "type": "array"- },- "limits": {- "default": {- "max_cpu_cores": 0.25,- "max_memory_mb": 512,- "max_tool_calls": 200,- "max_turns": 50,- "max_wall_seconds": 900- },- "properties": {- "max_cpu_cores": {- "default": 0.25,- "exclusiveMinimum": 0,- "maximum": 8,- "type": "number"- },- "max_memory_mb": {- "default": 512,- "exclusiveMinimum": 0,- "maximum": 16384,- "type": "number"- },- "max_output_tokens": {- "exclusiveMinimum": 0,- "maximum": 200000,- "type": "number"- },- "max_tool_calls": {- "default": 200,- "exclusiveMinimum": 0,- "maximum": 2147483647,- "type": "number"- },- "max_turns": {- "default": 50,- "exclusiveMinimum": 0,- "maximum": 2147483647,- "type": "number"- },- "max_wall_seconds": {- "default": 900,- "exclusiveMinimum": 0,- "maximum": 2147483647,- "type": "number"- }- },- "type": "object"- },- "mcps": {- "default": [],- "items": {- "properties": {- "auth": {- "properties": {- "provider": {- "type": "string"- }- },- "type": "object"- },- "headers": {- "additionalProperties": {- "type": "string"- },- "propertyNames": {- "type": "string"- },- "type": "object"- },- "id": {- "minLength": 1,- "type": "string"- },- "secrets": {- "default": [],- "items": {- "type": "string"- },- "type": "array"- },- "tools": {- "items": {- "anyOf": [- {- "minLength": 1,- "type": "string"- },- {- "properties": {- "approval_policy": {- "properties": {- "allow_edit": {- "default": false,- "type": "boolean"- },- "ttl_ms": {- "default": 86400000,- "maximum": 604800000,- "minimum": 60000,- "type": "number"- },- "type": {- "default": "principal",- "enum": ["principal", "agent"],- "type": "string"- }- },- "type": "object"- },- "name": {- "minLength": 1,- "type": "string"- },- "requires_approval": {- "default": false,- "type": "boolean"- }- },- "required": ["name"],- "type": "object"- }- ]- },- "type": "array"- },- "url": {- "format": "uri",- "type": "string"- }- },- "required": ["id", "url"],- "type": "object"- },- "type": "array"- },- "models": {- "anyOf": [- {- "properties": {- "level": {- "default": "medium",- "description": "Quality/cost tier (auto). low = cheapest, for short, formulaic, no-reasoning jobs (lookups, FAQ bots); medium = balanced default, for multi-step but bounded work; high = top-tier, for long, branching, reasoning-heavy work. Resolved to a priority-ordered cross-provider list at session start.",- "enum": ["low", "medium", "high"],- "type": "string"- },- "mode": {- "const": "auto",- "type": "string"- },- "optimize_for": {- "default": "cost",- "description": "Session model stability vs. resilience. `cost` (default): the first turn picks a working model and PINS it for the whole session — keeps the provider's prompt cache warm (cache reads are ~0.1-0.5x of full input) and never fails over mid-session; if the pinned model is down the turn fails rather than re-reading the whole context cold on another provider. `availability`: fail over to the next model when the session's model fails — survives an outage at the cost of a one-time cold re-read. Prefer `cost` for long/expensive sessions, `availability` where uptime matters more than spend.",- "enum": ["cost", "availability"],- "type": "string"- },- "reasoning": {- "description": "Reasoning/thinking effort budget. minimal = no deliberation (fastest, cheapest) … xhigh = maximal (research-grade, ~5-10x the per-turn cost). Omit for the provider/spec default.",- "enum": ["minimal", "low", "medium", "high", "xhigh"],- "type": "string"- }- },- "required": ["mode"],- "type": "object"- },- {- "properties": {- "mode": {- "const": "manual",- "type": "string"- },- "models": {- "description": "Explicit priority-ordered fallback list — the runner tries entries in order (primary first).",- "items": {- "properties": {- "model": {- "description": "Canonical model id, e.g. `anthropic/claude-sonnet-4-6` (see the agent-applications-models tool for served ids).",- "minLength": 1,- "pattern": "^[a-z0-9_-]+\\/[a-zA-Z0-9._:-]+$",- "type": "string"- },- "reasoning": {- "description": "Per-model reasoning effort override (else the spec default).",- "enum": ["minimal", "low", "medium", "high", "xhigh"],- "type": "string"- }- },- "required": ["model"],- "type": "object"- },- "minItems": 1,- "type": "array"- },- "optimize_for": {- "default": "cost",- "description": "Session model stability vs. resilience. `cost` (default): pin the first working model for the whole session (warm prompt cache, no mid-session failover). `availability`: fail over down this list when the session's model fails (survives outages, re-reads context cold).",- "enum": ["cost", "availability"],- "type": "string"- }- },- "required": ["mode", "models"],- "type": "object"- }- ],- "default": {- "level": "medium",- "mode": "auto",- "optimize_for": "cost"- },- "description": "How this agent selects its model. `auto`: pick a quality/cost `level` and the platform resolves it to a maintained, priority-ordered, cross-provider list at runtime. `manual`: give an explicit priority-ordered `models` list (primary first). `optimize_for` governs how the chosen model is treated across the session's turns."- },- "reasoning": {- "enum": ["minimal", "low", "medium", "high", "xhigh"],- "type": "string"- },- "resume": {- "properties": {- "enabled": {- "default": false,- "type": "boolean"- },- "max_completed_age_ms": {- "default": 604800000,- "exclusiveMinimum": 0,- "maximum": 2147483647,- "type": "number"- }- },- "type": "object"- },- "secrets": {- "default": [],- "items": {- "anyOf": [- {- "minLength": 1,- "type": "string"- },- {- "properties": {- "allowed_hosts": {- "items": {- "minLength": 1,- "type": "string"- },- "minItems": 1,- "type": "array"- },- "name": {- "minLength": 1,- "type": "string"- }- },- "required": ["name", "allowed_hosts"],- "type": "object"- }- ]- },- "type": "array"- },- "skills": {- "default": [],- "items": {- "properties": {- "alias": {- "type": "string"- },- "description": {- "type": "string"- },- "from_template": {- "type": "string"- },- "id": {- "type": "string"- },- "path": {- "type": "string"- },- "source_version_id": {- "type": "string"- },- "version": {- "minimum": 1,- "type": "number"- }- },- "required": ["id", "path"],- "type": "object"- },- "type": "array"- },- "tools": {- "default": [],- "items": {- "anyOf": [- {- "properties": {- "approval_policy": {- "properties": {- "allow_edit": {- "default": false,- "type": "boolean"- },- "ttl_ms": {- "default": 86400000,- "maximum": 604800000,- "minimum": 60000,- "type": "number"- },- "type": {- "default": "principal",- "enum": ["principal", "agent"],- "type": "string"- }- },- "type": "object"- },- "id": {- "type": "string"- },- "kind": {- "const": "native",- "type": "string"- },- "requires_approval": {- "default": false,- "type": "boolean"- }- },- "required": ["kind", "id"],- "type": "object"- },- {- "properties": {- "approval_policy": {- "properties": {- "allow_edit": {- "default": false,- "type": "boolean"- },- "ttl_ms": {- "default": 86400000,- "maximum": 604800000,- "minimum": 60000,- "type": "number"- },- "type": {- "default": "principal",- "enum": ["principal", "agent"],- "type": "string"- }- },- "type": "object"- },- "id": {- "type": "string"- },- "kind": {- "const": "custom",- "type": "string"- },- "path": {- "type": "string"- },- "requires_approval": {- "default": false,- "type": "boolean"- },- "requires_identity": {- "type": "string"- }- },- "required": ["kind", "id", "path"],- "type": "object"- },- {- "properties": {- "alias": {- "type": "string"- },- "from_template": {- "type": "string"- },- "kind": {- "const": "custom_template",- "type": "string"- },- "version": {- "minimum": 1,- "type": "number"- }- },- "required": ["kind", "from_template", "alias"],- "type": "object"- },- {- "properties": {- "args_schema": {- "additionalProperties": {},- "default": {},- "properties": {},- "type": "object"- },- "description": {- "minLength": 1,- "type": "string"- },- "id": {- "minLength": 1,- "type": "string"- },- "interactive": {- "default": false,- "type": "boolean"- },- "kind": {- "const": "client",- "type": "string"- },- "required": {- "default": false,- "type": "boolean"- },- "timeout_ms": {- "default": 5000,- "maximum": 600000,- "minimum": 1,- "type": "number"- }- },- "required": ["kind", "id", "description"],- "type": "object"- }- ]- },- "type": "array"- },- "triggers": {- "default": [],- "items": {- "anyOf": [- {- "properties": {- "config": {- "properties": {- "ack_reaction": {- "type": "string"- },- "allow_direct_messages": {- "default": false,- "type": "boolean"- },- "allow_workspace_participants": {- "default": false,- "type": "boolean"- },- "auto_resume_threads": {- "default": false,- "type": "boolean"- },- "channel_id": {- "type": "string"- },- "mention_only": {- "default": false,- "type": "boolean"- },- "trusted_workspaces": {- "anyOf": [- {- "items": {- "type": "string"- },- "minItems": 1,- "type": "array"- },- {- "const": "*",- "type": "string"- }- ]- }- },- "required": ["trusted_workspaces"],- "type": "object"- },- "type": {- "const": "slack",- "type": "string"- }- },- "required": ["type", "config"],- "type": "object"- },- {- "properties": {- "auth": {- "properties": {- "modes": {- "items": {- "anyOf": [- {- "properties": {- "acknowledge_public_exposure": {- "type": "boolean"- },- "type": {- "const": "public",- "type": "string"- }- },- "required": ["type", "acknowledge_public_exposure"],- "type": "object"- },- {- "properties": {- "audience": {- "default": "project",- "enum": ["project", "organization"],- "type": "string"- },- "scopes": {- "default": [],- "items": {- "type": "string"- },- "type": "array"- },- "type": {- "const": "posthog",- "type": "string"- }- },- "required": ["type"],- "type": "object"- },- {- "properties": {- "issuer_secret_ref": {- "minLength": 1,- "type": "string"- },- "type": {- "const": "jwt",- "type": "string"- }- },- "required": ["type", "issuer_secret_ref"],- "type": "object"- },- {- "properties": {- "header": {- "minLength": 1,- "type": "string"- },- "secret_ref": {- "minLength": 1,- "type": "string"- },- "type": {- "const": "shared_secret",- "type": "string"- }- },- "required": ["type", "header", "secret_ref"],- "type": "object"- },- {- "properties": {- "type": {- "const": "posthog_internal",- "type": "string"- }- },- "required": ["type"],- "type": "object"- }- ]- },- "type": "array"- }- },- "type": "object"- },- "config": {- "properties": {- "path": {- "type": "string"- }- },- "required": ["path"],- "type": "object"- },- "type": {- "const": "webhook",- "type": "string"- }- },- "required": ["type", "config", "auth"],- "type": "object"- },- {- "properties": {- "config": {- "properties": {- "catch_up": {- "default": "most_recent",- "enum": ["all", "most_recent", "skip"],- "type": "string"- },- "external_key": {- "type": "string"- },- "max_catch_up_age_seconds": {- "default": 3600,- "maximum": 604800,- "minimum": 1,- "type": "number"- },- "name": {- "minLength": 1,- "type": "string"- },- "prompt": {- "maxLength": 4096,- "minLength": 1,- "type": "string"- },- "schedule": {- "minLength": 1,- "type": "string"- },- "timezone": {- "default": "UTC",- "type": "string"- }- },- "required": ["name", "schedule", "prompt"],- "type": "object"- },- "type": {- "const": "cron",- "type": "string"- }- },- "required": ["type", "config"],- "type": "object"- },- {- "properties": {- "auth": {- "properties": {- "modes": {- "items": {- "anyOf": [- {- "properties": {- "acknowledge_public_exposure": {- "type": "boolean"- },- "type": {- "const": "public",- "type": "string"- }- },- "required": ["type", "acknowledge_public_exposure"],- "type": "object"- },- {- "properties": {- "audience": {- "default": "project",- "enum": ["project", "organization"],- "type": "string"- },- "scopes": {- "default": [],- "items": {- "type": "string"- },- "type": "array"- },- "type": {- "const": "posthog",- "type": "string"- }- },- "required": ["type"],- "type": "object"- },- {- "properties": {- "issuer_secret_ref": {- "minLength": 1,- "type": "string"- },- "type": {- "const": "jwt",- "type": "string"- }- },- "required": ["type", "issuer_secret_ref"],- "type": "object"- },- {- "properties": {- "header": {- "minLength": 1,- "type": "string"- },- "secret_ref": {- "minLength": 1,- "type": "string"- },- "type": {- "const": "shared_secret",- "type": "string"- }- },- "required": ["type", "header", "secret_ref"],- "type": "object"- },- {- "properties": {- "type": {- "const": "posthog_internal",- "type": "string"- }- },- "required": ["type"],- "type": "object"- }- ]- },- "type": "array"- }- },- "type": "object"- },- "config": {- "default": {- "allow_restart": false- },- "properties": {- "allow_restart": {- "default": false,- "type": "boolean"- }- },- "type": "object"- },- "type": {- "const": "chat",- "type": "string"- }- },- "required": ["type", "auth"],- "type": "object"- },- {- "properties": {- "auth": {- "properties": {- "modes": {- "items": {- "anyOf": [- {- "properties": {- "acknowledge_public_exposure": {- "type": "boolean"- },- "type": {- "const": "public",- "type": "string"- }- },- "required": ["type", "acknowledge_public_exposure"],- "type": "object"- },- {- "properties": {- "audience": {- "default": "project",- "enum": ["project", "organization"],- "type": "string"- },- "scopes": {- "default": [],- "items": {- "type": "string"- },- "type": "array"- },- "type": {- "const": "posthog",- "type": "string"- }- },- "required": ["type"],- "type": "object"- },- {- "properties": {- "issuer_secret_ref": {- "minLength": 1,- "type": "string"- },- "type": {- "const": "jwt",- "type": "string"- }- },- "required": ["type", "issuer_secret_ref"],- "type": "object"- },- {- "properties": {- "header": {- "minLength": 1,- "type": "string"- },- "secret_ref": {- "minLength": 1,- "type": "string"- },- "type": {- "const": "shared_secret",- "type": "string"- }- },- "required": ["type", "header", "secret_ref"],- "type": "object"- },- {- "properties": {- "type": {- "const": "posthog_internal",- "type": "string"- }- },- "required": ["type"],- "type": "object"- }- ]- },- "type": "array"- }- },- "type": "object"- },- "config": {- "default": {- "allow_restart": false- },- "properties": {- "allow_restart": {- "default": false,- "type": "boolean"- }- },- "type": "object"- },- "type": {- "const": "mcp",- "type": "string"- }- },- "required": ["type", "auth"],- "type": "object"- }- ]- },- "type": "array"- }- },- "type": "object"- }+ "spec": {}},"required": ["application_id"],"type": "object"diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/agent-applications-revisions-partial-update.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/agent-applications-revisions-partial-update.jsonindex 95d3c6f5df30..cce334c65955 100644--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/agent-applications-revisions-partial-update.json+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/agent-applications-revisions-partial-update.json@@ -24,992 +24,7 @@}]},- "spec": {- "properties": {- "framework_prompt": {- "properties": {- "omit": {- "default": [],- "items": {- "enum": [- "meta_tool_guidance",- "state_contract",- "tool_failure_guidance",- "approval_guidance",- "reasoning_hint"- ],- "type": "string"- },- "type": "array"- },- "version_pin": {- "exclusiveMinimum": 0,- "maximum": 2147483647,- "type": "number"- }- },- "type": "object"- },- "identity_providers": {- "default": [],- "items": {- "anyOf": [- {- "properties": {- "binding": {- "default": "principal",- "enum": ["principal"],- "type": "string"- },- "client_id": {- "type": "string"- },- "id": {- "default": "posthog",- "minLength": 1,- "type": "string"- },- "kind": {- "const": "posthog",- "type": "string"- },- "scopes": {- "default": [],- "items": {- "type": "string"- },- "type": "array"- }- },- "required": ["kind"],- "type": "object"- },- {- "properties": {- "authorize_url": {- "format": "uri",- "type": "string"- },- "binding": {- "default": "principal",- "enum": ["principal"],- "type": "string"- },- "client_id": {- "minLength": 1,- "type": "string"- },- "client_secret_ref": {- "type": "string"- },- "id": {- "minLength": 1,- "type": "string"- },- "kind": {- "const": "oauth2",- "type": "string"- },- "scopes": {- "default": [],- "items": {- "type": "string"- },- "type": "array"- },- "token_url": {- "format": "uri",- "type": "string"- },- "userinfo_url": {- "format": "uri",- "type": "string"- }- },- "required": ["kind", "id", "authorize_url", "token_url", "client_id"],- "type": "object"- }- ]- },- "type": "array"- },- "limits": {- "default": {- "max_cpu_cores": 0.25,- "max_memory_mb": 512,- "max_tool_calls": 200,- "max_turns": 50,- "max_wall_seconds": 900- },- "properties": {- "max_cpu_cores": {- "default": 0.25,- "exclusiveMinimum": 0,- "maximum": 8,- "type": "number"- },- "max_memory_mb": {- "default": 512,- "exclusiveMinimum": 0,- "maximum": 16384,- "type": "number"- },- "max_output_tokens": {- "exclusiveMinimum": 0,- "maximum": 200000,- "type": "number"- },- "max_tool_calls": {- "default": 200,- "exclusiveMinimum": 0,- "maximum": 2147483647,- "type": "number"- },- "max_turns": {- "default": 50,- "exclusiveMinimum": 0,- "maximum": 2147483647,- "type": "number"- },- "max_wall_seconds": {- "default": 900,- "exclusiveMinimum": 0,- "maximum": 2147483647,- "type": "number"- }- },- "type": "object"- },- "mcps": {- "default": [],- "items": {- "properties": {- "auth": {- "properties": {- "provider": {- "type": "string"- }- },- "type": "object"- },- "headers": {- "additionalProperties": {- "type": "string"- },- "propertyNames": {- "type": "string"- },- "type": "object"- },- "id": {- "minLength": 1,- "type": "string"- },- "secrets": {- "default": [],- "items": {- "type": "string"- },- "type": "array"- },- "tools": {- "items": {- "anyOf": [- {- "minLength": 1,- "type": "string"- },- {- "properties": {- "approval_policy": {- "properties": {- "allow_edit": {- "default": false,- "type": "boolean"- },- "ttl_ms": {- "default": 86400000,- "maximum": 604800000,- "minimum": 60000,- "type": "number"- },- "type": {- "default": "principal",- "enum": ["principal", "agent"],- "type": "string"- }- },- "type": "object"- },- "name": {- "minLength": 1,- "type": "string"- },- "requires_approval": {- "default": false,- "type": "boolean"- }- },- "required": ["name"],- "type": "object"- }- ]- },- "type": "array"- },- "url": {- "format": "uri",- "type": "string"- }- },- "required": ["id", "url"],- "type": "object"- },- "type": "array"- },- "models": {- "anyOf": [- {- "properties": {- "level": {- "default": "medium",- "description": "Quality/cost tier (auto). low = cheapest, for short, formulaic, no-reasoning jobs (lookups, FAQ bots); medium = balanced default, for multi-step but bounded work; high = top-tier, for long, branching, reasoning-heavy work. Resolved to a priority-ordered cross-provider list at session start.",- "enum": ["low", "medium", "high"],- "type": "string"- },- "mode": {- "const": "auto",- "type": "string"- },- "optimize_for": {- "default": "cost",- "description": "Session model stability vs. resilience. `cost` (default): the first turn picks a working model and PINS it for the whole session — keeps the provider's prompt cache warm (cache reads are ~0.1-0.5x of full input) and never fails over mid-session; if the pinned model is down the turn fails rather than re-reading the whole context cold on another provider. `availability`: fail over to the next model when the session's model fails — survives an outage at the cost of a one-time cold re-read. Prefer `cost` for long/expensive sessions, `availability` where uptime matters more than spend.",- "enum": ["cost", "availability"],- "type": "string"- },- "reasoning": {- "description": "Reasoning/thinking effort budget. minimal = no deliberation (fastest, cheapest) … xhigh = maximal (research-grade, ~5-10x the per-turn cost). Omit for the provider/spec default.",- "enum": ["minimal", "low", "medium", "high", "xhigh"],- "type": "string"- }- },- "required": ["mode"],- "type": "object"- },- {- "properties": {- "mode": {- "const": "manual",- "type": "string"- },- "models": {- "description": "Explicit priority-ordered fallback list — the runner tries entries in order (primary first).",- "items": {- "properties": {- "model": {- "description": "Canonical model id, e.g. `anthropic/claude-sonnet-4-6` (see the agent-applications-models tool for served ids).",- "minLength": 1,- "pattern": "^[a-z0-9_-]+\\/[a-zA-Z0-9._:-]+$",- "type": "string"- },- "reasoning": {- "description": "Per-model reasoning effort override (else the spec default).",- "enum": ["minimal", "low", "medium", "high", "xhigh"],- "type": "string"- }- },- "required": ["model"],- "type": "object"- },- "minItems": 1,- "type": "array"- },- "optimize_for": {- "default": "cost",- "description": "Session model stability vs. resilience. `cost` (default): pin the first working model for the whole session (warm prompt cache, no mid-session failover). `availability`: fail over down this list when the session's model fails (survives outages, re-reads context cold).",- "enum": ["cost", "availability"],- "type": "string"- }- },- "required": ["mode", "models"],- "type": "object"- }- ],- "default": {- "level": "medium",- "mode": "auto",- "optimize_for": "cost"- },- "description": "How this agent selects its model. `auto`: pick a quality/cost `level` and the platform resolves it to a maintained, priority-ordered, cross-provider list at runtime. `manual`: give an explicit priority-ordered `models` list (primary first). `optimize_for` governs how the chosen model is treated across the session's turns."- },- "reasoning": {- "enum": ["minimal", "low", "medium", "high", "xhigh"],- "type": "string"- },- "resume": {- "properties": {- "enabled": {- "default": false,- "type": "boolean"- },- "max_completed_age_ms": {- "default": 604800000,- "exclusiveMinimum": 0,- "maximum": 2147483647,- "type": "number"- }- },- "type": "object"- },- "secrets": {- "default": [],- "items": {- "anyOf": [- {- "minLength": 1,- "type": "string"- },- {- "properties": {- "allowed_hosts": {- "items": {- "minLength": 1,- "type": "string"- },- "minItems": 1,- "type": "array"- },- "name": {- "minLength": 1,- "type": "string"- }- },- "required": ["name", "allowed_hosts"],- "type": "object"- }- ]- },- "type": "array"- },- "skills": {- "default": [],- "items": {- "properties": {- "alias": {- "type": "string"- },- "description": {- "type": "string"- },- "from_template": {- "type": "string"- },- "id": {- "type": "string"- },- "path": {- "type": "string"- },- "source_version_id": {- "type": "string"- },- "version": {- "minimum": 1,- "type": "number"- }- },- "required": ["id", "path"],- "type": "object"- },- "type": "array"- },- "tools": {- "default": [],- "items": {- "anyOf": [- {- "properties": {- "approval_policy": {- "properties": {- "allow_edit": {- "default": false,- "type": "boolean"- },- "ttl_ms": {- "default": 86400000,- "maximum": 604800000,- "minimum": 60000,- "type": "number"- },- "type": {- "default": "principal",- "enum": ["principal", "agent"],- "type": "string"- }- },- "type": "object"- },- "id": {- "type": "string"- },- "kind": {- "const": "native",- "type": "string"- },- "requires_approval": {- "default": false,- "type": "boolean"- }- },- "required": ["kind", "id"],- "type": "object"- },- {- "properties": {- "approval_policy": {- "properties": {- "allow_edit": {- "default": false,- "type": "boolean"- },- "ttl_ms": {- "default": 86400000,- "maximum": 604800000,- "minimum": 60000,- "type": "number"- },- "type": {- "default": "principal",- "enum": ["principal", "agent"],- "type": "string"- }- },- "type": "object"- },- "id": {- "type": "string"- },- "kind": {- "const": "custom",- "type": "string"- },- "path": {- "type": "string"- },- "requires_approval": {- "default": false,- "type": "boolean"- },- "requires_identity": {- "type": "string"- }- },- "required": ["kind", "id", "path"],- "type": "object"- },- {- "properties": {- "alias": {- "type": "string"- },- "from_template": {- "type": "string"- },- "kind": {- "const": "custom_template",- "type": "string"- },- "version": {- "minimum": 1,- "type": "number"- }- },- "required": ["kind", "from_template", "alias"],- "type": "object"- },- {- "properties": {- "args_schema": {- "additionalProperties": {},- "default": {},- "properties": {},- "type": "object"- },- "description": {- "minLength": 1,- "type": "string"- },- "id": {- "minLength": 1,- "type": "string"- },- "interactive": {- "default": false,- "type": "boolean"- },- "kind": {- "const": "client",- "type": "string"- },- "required": {- "default": false,- "type": "boolean"- },- "timeout_ms": {- "default": 5000,- "maximum": 600000,- "minimum": 1,- "type": "number"- }- },- "required": ["kind", "id", "description"],- "type": "object"- }- ]- },- "type": "array"- },- "triggers": {- "default": [],- "items": {- "anyOf": [- {- "properties": {- "config": {- "properties": {- "ack_reaction": {- "type": "string"- },- "allow_direct_messages": {- "default": false,- "type": "boolean"- },- "allow_workspace_participants": {- "default": false,- "type": "boolean"- },- "auto_resume_threads": {- "default": false,- "type": "boolean"- },- "channel_id": {- "type": "string"- },- "mention_only": {- "default": false,- "type": "boolean"- },- "trusted_workspaces": {- "anyOf": [- {- "items": {- "type": "string"- },- "minItems": 1,- "type": "array"- },- {- "const": "*",- "type": "string"- }- ]- }- },- "required": ["trusted_workspaces"],- "type": "object"- },- "type": {- "const": "slack",- "type": "string"- }- },- "required": ["type", "config"],- "type": "object"- },- {- "properties": {- "auth": {- "properties": {- "modes": {- "items": {- "anyOf": [- {- "properties": {- "acknowledge_public_exposure": {- "type": "boolean"- },- "type": {- "const": "public",- "type": "string"- }- },- "required": ["type", "acknowledge_public_exposure"],- "type": "object"- },- {- "properties": {- "audience": {- "default": "project",- "enum": ["project", "organization"],- "type": "string"- },- "scopes": {- "default": [],- "items": {- "type": "string"- },- "type": "array"- },- "type": {- "const": "posthog",- "type": "string"- }- },- "required": ["type"],- "type": "object"- },- {- "properties": {- "issuer_secret_ref": {- "minLength": 1,- "type": "string"- },- "type": {- "const": "jwt",- "type": "string"- }- },- "required": ["type", "issuer_secret_ref"],- "type": "object"- },- {- "properties": {- "header": {- "minLength": 1,- "type": "string"- },- "secret_ref": {- "minLength": 1,- "type": "string"- },- "type": {- "const": "shared_secret",- "type": "string"- }- },- "required": ["type", "header", "secret_ref"],- "type": "object"- },- {- "properties": {- "type": {- "const": "posthog_internal",- "type": "string"- }- },- "required": ["type"],- "type": "object"- }- ]- },- "type": "array"- }- },- "type": "object"- },- "config": {- "properties": {- "path": {- "type": "string"- }- },- "required": ["path"],- "type": "object"- },- "type": {- "const": "webhook",- "type": "string"- }- },- "required": ["type", "config", "auth"],- "type": "object"- },- {- "properties": {- "config": {- "properties": {- "catch_up": {- "default": "most_recent",- "enum": ["all", "most_recent", "skip"],- "type": "string"- },- "external_key": {- "type": "string"- },- "max_catch_up_age_seconds": {- "default": 3600,- "maximum": 604800,- "minimum": 1,- "type": "number"- },- "name": {- "minLength": 1,- "type": "string"- },- "prompt": {- "maxLength": 4096,- "minLength": 1,- "type": "string"- },- "schedule": {- "minLength": 1,- "type": "string"- },- "timezone": {- "default": "UTC",- "type": "string"- }- },- "required": ["name", "schedule", "prompt"],- "type": "object"- },- "type": {- "const": "cron",- "type": "string"- }- },- "required": ["type", "config"],- "type": "object"- },- {- "properties": {- "auth": {- "properties": {- "modes": {- "items": {- "anyOf": [- {- "properties": {- "acknowledge_public_exposure": {- "type": "boolean"- },- "type": {- "const": "public",- "type": "string"- }- },- "required": ["type", "acknowledge_public_exposure"],- "type": "object"- },- {- "properties": {- "audience": {- "default": "project",- "enum": ["project", "organization"],- "type": "string"- },- "scopes": {- "default": [],- "items": {- "type": "string"- },- "type": "array"- },- "type": {- "const": "posthog",- "type": "string"- }- },- "required": ["type"],- "type": "object"- },- {- "properties": {- "issuer_secret_ref": {- "minLength": 1,- "type": "string"- },- "type": {- "const": "jwt",- "type": "string"- }- },- "required": ["type", "issuer_secret_ref"],- "type": "object"- },- {- "properties": {- "header": {- "minLength": 1,- "type": "string"- },- "secret_ref": {- "minLength": 1,- "type": "string"- },- "type": {- "const": "shared_secret",- "type": "string"- }- },- "required": ["type", "header", "secret_ref"],- "type": "object"- },- {- "properties": {- "type": {- "const": "posthog_internal",- "type": "string"- }- },- "required": ["type"],- "type": "object"- }- ]- },- "type": "array"- }- },- "type": "object"- },- "config": {- "default": {- "allow_restart": false- },- "properties": {- "allow_restart": {- "default": false,- "type": "boolean"- }- },- "type": "object"- },- "type": {- "const": "chat",- "type": "string"- }- },- "required": ["type", "auth"],- "type": "object"- },- {- "properties": {- "auth": {- "properties": {- "modes": {- "items": {- "anyOf": [- {- "properties": {- "acknowledge_public_exposure": {- "type": "boolean"- },- "type": {- "const": "public",- "type": "string"- }- },- "required": ["type", "acknowledge_public_exposure"],- "type": "object"- },- {- "properties": {- "audience": {- "default": "project",- "enum": ["project", "organization"],- "type": "string"- },- "scopes": {- "default": [],- "items": {- "type": "string"- },- "type": "array"- },- "type": {- "const": "posthog",- "type": "string"- }- },- "required": ["type"],- "type": "object"- },- {- "properties": {- "issuer_secret_ref": {- "minLength": 1,- "type": "string"- },- "type": {- "const": "jwt",- "type": "string"- }- },- "required": ["type", "issuer_secret_ref"],- "type": "object"- },- {- "properties": {- "header": {- "minLength": 1,- "type": "string"- },- "secret_ref": {- "minLength": 1,- "type": "string"- },- "type": {- "const": "shared_secret",- "type": "string"- }- },- "required": ["type", "header", "secret_ref"],- "type": "object"- },- {- "properties": {- "type": {- "const": "posthog_internal",- "type": "string"- }- },- "required": ["type"],- "type": "object"- }- ]- },- "type": "array"- }- },- "type": "object"- },- "config": {- "default": {- "allow_restart": false- },- "properties": {- "allow_restart": {- "default": false,- "type": "boolean"- }- },- "type": "object"- },- "type": {- "const": "mcp",- "type": "string"- }- },- "required": ["type", "auth"],- "type": "object"- }- ]- },- "type": "array"- }- },- "type": "object"- }+ "spec": {}},"required": ["application_id", "id"],"type": "object"diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/agent-applications-spec-schema.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/agent-applications-spec-schema.jsonnew file mode 100644index 000000000000..b4364ba6039b--- /dev/null+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/agent-applications-spec-schema.json@@ -0,0 +1,10 @@+{+ "$schema": "https://json-schema.org/draft/2020-12/schema",+ "properties": {+ "section": {+ "description": "Return only this top-level slice of the spec schema to save tokens — one of `models`, `triggers`, `tools`, `mcps`, `skills`, `identity_providers`, `secrets`, `limits`, `reasoning`, `framework_prompt`, `resume`. Omit for the whole spec schema.",+ "type": "string"+ }+ },+ "type": "object"+}