{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/reasonmachines-com/json-schema/reasonmachines-com-session-create-response-schema.json",
  "title": "SessionCreateResponse",
  "x-generated": "2026-11-23",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/reasonmachines-com-openapi.json#/components/schemas/SessionCreateResponse",
  "type": "object",
  "properties": {
    "session_id": {
      "type": [
        "string",
        "null"
      ]
    },
    "project_id": {
      "deprecated": true,
      "description": "Deprecated: Projects are retired in favour of Reasons.",
      "type": [
        "string",
        "null"
      ],
      "format": "uuid",
      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
    },
    "url": {
      "type": [
        "string",
        "null"
      ]
    },
    "status": {
      "type": "string",
      "enum": [
        "running",
        "exit",
        "error",
        "suspended"
      ],
      "description": "Lifecycle state, not task success: running, exit (execution completed), error (execution failed), or suspended (cancelled/quota; suspended_reason says which). An exit can have outcome failure or action_required. The task succeeded if and only if outcome is success; check outcome, result, and diagnostics before treating work as successful."
    },
    "session_policy": {
      "type": "object",
      "properties": {
        "version": {
          "type": "number",
          "const": 1,
          "description": "Version of this policy shape."
        },
        "mode": {
          "type": "string",
          "enum": [
            "standard",
            "isolated",
            "ephemeral"
          ],
          "description": "How the Session runs: standard for normal work, ephemeral for a single benchmark trial. isolated is retired: only Sessions created before its retirement report it, and a retry, follow-up, wake or move of one returns 409 session_mode_retired."
        },
        "components": {
          "type": "object",
          "properties": {
            "memoryRead": {
              "type": "boolean",
              "description": "Whether memory reads are enabled."
            },
            "memoryWrite": {
              "type": "boolean",
              "description": "Whether memory writes are enabled."
            },
            "skills": {
              "type": "boolean",
              "description": "Whether skills are enabled."
            },
            "inheritedInstructions": {
              "type": "boolean",
              "description": "Whether inherited instructions are enabled."
            },
            "integrations": {
              "type": "boolean",
              "description": "Whether integrations are enabled."
            },
            "secretInjection": {
              "type": "boolean",
              "description": "Whether secret injection is enabled."
            }
          },
          "required": [
            "memoryRead",
            "memoryWrite",
            "skills",
            "inheritedInstructions",
            "integrations",
            "secretInjection"
          ],
          "description": "The optional capability families, each enabled (true) or disabled (false) for this Session."
        },
        "workspaceOwnership": {
          "type": "string",
          "enum": [
            "managed",
            "externally-managed"
          ],
          "description": "Filesystem persistence owner. Sessions created with the deprecated ara-managed spelling report managed."
        },
        "personalContext": {
          "description": "Present and false when the Session was created with personal_context: false: it runs without its creator's personal skills, memory, secrets and connections. Absent when the creator's personal context loads.",
          "type": "boolean",
          "const": false
        },
        "pullRequestPolicy": {
          "description": "Present as draft_only when the Session was created with pull_request_policy: draft_only: its pull requests stay drafts and it cannot merge, queue, auto-merge or mark one ready. Absent for the normal delivery flow.",
          "type": "string",
          "const": "draft_only"
        }
      },
      "required": [
        "version",
        "mode",
        "components",
        "workspaceOwnership"
      ],
      "description": "Server-resolved immutable Session policy. Enabled components remain subject to normal permissions and configuration."
    },
    "runtime_profile": {
      "description": "runtime/reason-sync-yield-v1 on a retired isolated Session that requested it through the retired runtime_profile field. Null otherwise.",
      "oneOf": [
        {
          "type": "string",
          "const": "runtime/reason-sync-yield-v1"
        },
        {
          "type": "null"
        }
      ]
    },
    "experimental_runtime_profile": {
      "description": "The runtime profile the Session's latest Attempt runs: the default C2 harness on every Session that runs it, whether or not its request named it (a Session of the retired runtime/reason-capability-shell-v1 continues on it) — reported as runtime/reason-c2-tools-v7; runtime/reason-v7-sync-yield-v1 or runtime/reason-v7-sync-yield-machine-sdk-v1 on a stored Session of that retired harness; runtime/reason-v7-2026-10, runtime/reason-v7-2026-11, runtime/reason-v8-2026-10, runtime/reason-v8.1-2026-10, runtime/reason-v8.2-2026-10, runtime/reason-agent-1.2, runtime/reason-agent-1.3 or runtime/reason-agent-1.3.1 on a Session that runs it; a Session of a deleted v7 evaluation profile reports the default C2 harness, which it re-admits to. Null otherwise.",
      "oneOf": [
        {
          "type": "string",
          "enum": [
            "runtime/reason-c2-tools-v7",
            "runtime/reason-v7-sync-yield-v1",
            "runtime/reason-v7-sync-yield-machine-sdk-v1",
            "runtime/reason-v7-2026-10",
            "runtime/reason-v7-2026-11",
            "runtime/reason-v8-2026-10",
            "runtime/reason-v8.1-2026-10",
            "runtime/reason-v8.2-2026-10",
            "runtime/reason-agent-1.2",
            "runtime/reason-agent-1.3",
            "runtime/reason-agent-1.3.1"
          ]
        },
        {
          "type": "null"
        }
      ]
    },
    "experimental_runtime_features": {
      "description": "The runtime features the Session's create named (experimental_runtime_features), in canonical order. Null when it named none.",
      "type": [
        "array",
        "null"
      ],
      "items": {
        "type": "string",
        "enum": [
          "banner",
          "sdk_index",
          "service_tier",
          "output_cap",
          "git_metadata",
          "serial_reads",
          "recovery_defer_idle_hands",
          "fewer_tests_low",
          "fewer_tests_medium",
          "fewer_tests_high",
          "fewer_tests_max",
          "fewer_tests_max_alone",
          "verify_line_alone",
          "addendum_placebo",
          "bash_yield",
          "sync_bash",
          "turn_line_removed",
          "turn_line_questions",
          "output_cap_continue",
          "image_history_append_only",
          "cache_ttl_1h"
        ]
      }
    },
    "placement_receipt": {
      "$ref": "#/$defs/PlacementReceipt"
    },
    "delegation": {
      "type": "object",
      "properties": {
        "max_depth": {
          "type": "integer",
          "minimum": 1,
          "maximum": 5,
          "description": "How deep the tree may nest below its root Session."
        },
        "children_can_create_sessions": {
          "type": "boolean",
          "description": "Whether subagents above the last level may create Sessions that join the tree."
        }
      },
      "required": [
        "max_depth",
        "children_can_create_sessions"
      ],
      "description": "The delegation limits a caller set for this Session's tree (see `delegation` on createSession); absent when none were set, which is the default tree."
    },
    "reason_id": {
      "description": "The Reason the Session is filed under, or null for none. The same id as project_id.",
      "type": [
        "string",
        "null"
      ],
      "format": "uuid",
      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
    },
    "model": {
      "description": "The concrete model the Session was admitted with, after Auto and any model rollover resolved it; the same value Retrieve a session reports as model. Null when no session was created.",
      "type": [
        "string",
        "null"
      ]
    },
    "reasoning_effort": {
      "description": "The reasoning effort the Session runs with; null when none was set.",
      "type": [
        "string",
        "null"
      ]
    },
    "allow_model_rollover": {
      "type": "boolean",
      "description": "Whether model rollover is in effect for this Session: true when a run-out subscription or key may continue the turn on another connected account or on Reason (see allow_model_rollover on the request), false when the Session keeps the exact model it named."
    },
    "model_source_id": {
      "description": "The connected account the Session runs on: where its model routing starts, or the account `model_source_id` pinned with `allow_model_rollover: false`. Null when neither applies.",
      "type": [
        "string",
        "null"
      ]
    },
    "model_rolled_over": {
      "type": "boolean",
      "description": "True when a usage limit or outage already moved this first turn off the account it would otherwise use, onto another connected account or Reason credits, for the same model. It reports admission only; later rollovers are not reflected here."
    },
    "warnings": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/SessionStartWarning"
      },
      "description": "What the new Session will be missing, found by the checks that finished before it was created (see `require_ready`); the Session started anyway. Absent when nothing is known to be missing; send `require_ready: true` for the complete check. A replay of an earlier create reports none."
    }
  },
  "required": [
    "session_id",
    "project_id",
    "url",
    "status",
    "session_policy",
    "reason_id"
  ],
  "$defs": {
    "PlacementReceipt": {
      "type": "object",
      "properties": {
        "execution": {
          "type": "object",
          "properties": {
            "status": {
              "type": "string",
              "enum": [
                "known",
                "unknown",
                "unavailable"
              ]
            },
            "reason": {
              "type": "string"
            },
            "target": {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "enum": [
                    "cloud",
                    "mac",
                    "headless",
                    "cli",
                    "worker"
                  ]
                },
                "computer_id": {
                  "type": "string"
                },
                "device_id": {
                  "type": "string"
                },
                "root_id": {
                  "type": "string"
                }
              },
              "required": [
                "kind"
              ]
            },
            "basis": {
              "type": "string",
              "enum": [
                "applied_placement",
                "transition_source",
                "retained_placement"
              ]
            }
          },
          "required": [
            "status",
            "reason"
          ],
          "description": "Observed Session placement, not launch intent, desktop origin or a requested destination. Known identifies a placement, not permission or a guarantee that a command can run."
        },
        "physical_control": {
          "type": "object",
          "properties": {
            "status": {
              "type": "string",
              "enum": [
                "known",
                "unknown",
                "unavailable"
              ]
            },
            "reason": {
              "type": "string"
            },
            "target": {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "enum": [
                    "cloud",
                    "mac",
                    "headless",
                    "cli",
                    "worker"
                  ]
                },
                "computer_id": {
                  "type": "string"
                },
                "device_id": {
                  "type": "string"
                },
                "root_id": {
                  "type": "string"
                }
              },
              "required": [
                "kind"
              ]
            }
          },
          "required": [
            "status",
            "reason"
          ],
          "description": "Physical control can target a different computer for each operation. No default target is inferred from execution or desktop provenance."
        },
        "root_grant": {
          "type": "object",
          "properties": {
            "status": {
              "type": "string",
              "enum": [
                "known",
                "unknown",
                "unavailable"
              ]
            },
            "reason": {
              "type": "string"
            },
            "root_id": {
              "type": "string"
            }
          },
          "required": [
            "status",
            "reason"
          ],
          "description": "A known root id is not proof of a current grant. Operations reauthorize their exact root and actor."
        },
        "browser": {
          "type": "object",
          "properties": {
            "status": {
              "type": "string",
              "enum": [
                "known",
                "unknown",
                "unavailable"
              ]
            },
            "reason": {
              "type": "string"
            }
          },
          "required": [
            "status",
            "reason"
          ],
          "description": "Browser profile and signed-in identity are operation-specific. Unknown does not mean signed out or unavailable."
        },
        "computer": {
          "description": "Authorized inventory observation only; ready or live does not assert this Session is executing there.",
          "type": "object",
          "properties": {
            "id": {
              "type": "string"
            },
            "kind": {
              "type": "string",
              "enum": [
                "cloud",
                "mac",
                "cli",
                "worker"
              ]
            },
            "state": {
              "type": "string"
            },
            "live": {
              "type": "boolean"
            }
          },
          "required": [
            "id",
            "kind",
            "state",
            "live"
          ]
        }
      },
      "required": [
        "execution",
        "physical_control",
        "root_grant",
        "browser"
      ],
      "description": "Additive observational receipt. Unknown means this response cannot establish the fact; unavailable means there is affirmative evidence it is not currently usable. Never authorizes an operation. Absent on older servers and on list responses."
    },
    "SessionStartWarning": {
      "type": "object",
      "properties": {
        "code": {
          "type": "string",
          "enum": [
            "integration_needs_auth",
            "integration_offline",
            "integration_error",
            "integration_secret_missing",
            "reason_secret_missing"
          ],
          "description": "integration_needs_auth: a connection is signed out or has no token. integration_offline / integration_error: it failed its last connection check. integration_secret_missing: its configuration names a secret with no value. reason_secret_missing: Sessions under the Reason asked for a secret that still has no value this Session gets."
        },
        "integration": {
          "type": "string",
          "description": "The connection's slug, for an integration warning."
        },
        "secret_name": {
          "type": "string",
          "description": "The secret's name (never its value), for a secret warning."
        },
        "message": {
          "type": "string",
          "description": "One plain sentence: what is missing and how to fix it."
        }
      },
      "required": [
        "code",
        "message"
      ]
    }
  }
}