[{"data":1,"prerenderedAt":1375},["ShallowReactive",2],{"docs-navigation":3,"docs-page-\u002Fdocs\u002Fagents\u002Fmemory-consequence-agents\u002Fend-to-end\u002Fpython":252,"docs-surround-\u002Fdocs\u002Fagents\u002Fmemory-consequence-agents\u002Fend-to-end\u002Fpython":1372},[4],{"title":5,"path":6,"stem":7,"children":8,"page":251},"Docs","\u002Fdocs","docs",[9,36,101,197,232],{"title":10,"path":11,"stem":12,"children":13},"GET STARTED","\u002Fdocs\u002Fget-started","docs\u002F1.get-started\u002F1.index",[14,16,20,24,28,32],{"title":15,"path":11,"stem":12},"Welcome",{"title":17,"path":18,"stem":19},"Quickstart","\u002Fdocs\u002Fget-started\u002Fquickstart","docs\u002F1.get-started\u002F2.quickstart",{"title":21,"path":22,"stem":23},"API","\u002Fdocs\u002Fget-started\u002Fapi","docs\u002F1.get-started\u002F3.api",{"title":25,"path":26,"stem":27},"SDKs and CLI","\u002Fdocs\u002Fget-started\u002Fsdks-cli","docs\u002F1.get-started\u002F4.sdks-cli",{"title":29,"path":30,"stem":31},"Sandbox testing","\u002Fdocs\u002Fget-started\u002Flocal-development","docs\u002F1.get-started\u002F5.local-development",{"title":33,"path":34,"stem":35},"Authentication","\u002Fdocs\u002Fget-started\u002Fauthentication","docs\u002F1.get-started\u002F6.authentication",{"title":37,"path":38,"stem":39,"children":40},"FUNDAMENTALS","\u002Fdocs\u002Ffundamentals","docs\u002F2.fundamentals\u002F01.index",[41,43,47,51,55,59,63,67,71,75],{"title":42,"path":38,"stem":39},"Fundamentals",{"title":44,"path":45,"stem":46},"Architecture","\u002Fdocs\u002Ffundamentals\u002Farchitecture","docs\u002F2.fundamentals\u002F02.architecture",{"title":48,"path":49,"stem":50},"Memory model","\u002Fdocs\u002Ffundamentals\u002Fmemory-model","docs\u002F2.fundamentals\u002F03.memory-model",{"title":52,"path":53,"stem":54},"Compression","\u002Fdocs\u002Ffundamentals\u002Fcompression","docs\u002F2.fundamentals\u002F04.compression",{"title":56,"path":57,"stem":58},"RAG and cached context","\u002Fdocs\u002Ffundamentals\u002Frag-cag","docs\u002F2.fundamentals\u002F05.rag-cag",{"title":60,"path":61,"stem":62},"Context cache","\u002Fdocs\u002Ffundamentals\u002Fcontext-cache","docs\u002F2.fundamentals\u002F06.context-cache",{"title":64,"path":65,"stem":66},"Security","\u002Fdocs\u002Ffundamentals\u002Fsecurity","docs\u002F2.fundamentals\u002F07.security",{"title":68,"path":69,"stem":70},"Languages","\u002Fdocs\u002Ffundamentals\u002Flanguages","docs\u002F2.fundamentals\u002F08.languages",{"title":72,"path":73,"stem":74},"UI patterns","\u002Fdocs\u002Ffundamentals\u002Fui","docs\u002F2.fundamentals\u002F09.ui",{"title":76,"path":77,"stem":78,"children":79},"Global, Regional, and Jurisdictional Memory","\u002Fdocs\u002Ffundamentals\u002Fdata-placement","docs\u002F2.fundamentals\u002F10.data-placement\u002F1.index",[80,81,85,89,93,97],{"title":76,"path":77,"stem":78},{"title":82,"path":83,"stem":84},"TypeScript \u002F JavaScript","\u002Fdocs\u002Ffundamentals\u002Fdata-placement\u002Ftypescript","docs\u002F2.fundamentals\u002F10.data-placement\u002F2.typescript",{"title":86,"path":87,"stem":88},"Python","\u002Fdocs\u002Ffundamentals\u002Fdata-placement\u002Fpython","docs\u002F2.fundamentals\u002F10.data-placement\u002F3.python",{"title":90,"path":91,"stem":92},"PHP","\u002Fdocs\u002Ffundamentals\u002Fdata-placement\u002Fphp","docs\u002F2.fundamentals\u002F10.data-placement\u002F4.php",{"title":94,"path":95,"stem":96},"Go","\u002Fdocs\u002Ffundamentals\u002Fdata-placement\u002Fgo","docs\u002F2.fundamentals\u002F10.data-placement\u002F5.go",{"title":98,"path":99,"stem":100},"Rust","\u002Fdocs\u002Ffundamentals\u002Fdata-placement\u002Frust","docs\u002F2.fundamentals\u002F10.data-placement\u002F6.rust",{"title":102,"path":103,"stem":104,"children":105},"AGENTS & CODE NUCLEI","\u002Fdocs\u002Fagents","docs\u002F3.agents\u002F01.index",[106,108,112,116,120,124,128,132,136,140,158,193],{"title":107,"path":103,"stem":104},"Agents",{"title":109,"path":110,"stem":111},"Codex Code Nucleus","\u002Fdocs\u002Fagents\u002Fcodex-code-nucleus","docs\u002F3.agents\u002F02.codex-code-nucleus",{"title":113,"path":114,"stem":115},"Claude Code Nucleus","\u002Fdocs\u002Fagents\u002Fclaude-code-nucleus","docs\u002F3.agents\u002F03.claude-code-nucleus",{"title":117,"path":118,"stem":119},"Google Gemini Code Nucleus","\u002Fdocs\u002Fagents\u002Fgoogle-gemini-code-nucleus","docs\u002F3.agents\u002F04.google-gemini-code-nucleus",{"title":121,"path":122,"stem":123},"GitHub Copilot Code Nucleus","\u002Fdocs\u002Fagents\u002Fgithub-copilot-code-nucleus","docs\u002F3.agents\u002F05.github-copilot-code-nucleus",{"title":125,"path":126,"stem":127},"Cursor Code Nucleus","\u002Fdocs\u002Fagents\u002Fcursor-code-nucleus","docs\u002F3.agents\u002F06.cursor-code-nucleus",{"title":129,"path":130,"stem":131},"Windsurf Code Nucleus","\u002Fdocs\u002Fagents\u002Fwindsurf-code-nucleus","docs\u002F3.agents\u002F07.windsurf-code-nucleus",{"title":133,"path":134,"stem":135},"Agent skills","\u002Fdocs\u002Fagents\u002Fagent-skills","docs\u002F3.agents\u002F08.agent-skills",{"title":137,"path":138,"stem":139},"Admin UI prompt","\u002Fdocs\u002Fagents\u002Fadmin-ui-prompt","docs\u002F3.agents\u002F09.admin-ui-prompt",{"title":141,"path":142,"stem":143,"children":144},"Team Code Governance","\u002Fdocs\u002Fagents\u002Fcode-governance","docs\u002F3.agents\u002F10.code-governance\u002F1.index",[145,146,150,154],{"title":141,"path":142,"stem":143},{"title":147,"path":148,"stem":149},"Local Team Setup","\u002Fdocs\u002Fagents\u002Fcode-governance\u002Flocal-team-setup","docs\u002F3.agents\u002F10.code-governance\u002F2.local-team-setup",{"title":151,"path":152,"stem":153},"Language Governance Packs","\u002Fdocs\u002Fagents\u002Fcode-governance\u002Flanguage-packs","docs\u002F3.agents\u002F10.code-governance\u002F3.language-packs",{"title":155,"path":156,"stem":157},"GitHub CI\u002FCD Governance","\u002Fdocs\u002Fagents\u002Fcode-governance\u002Fgithub-cicd","docs\u002F3.agents\u002F10.code-governance\u002F4.github-cicd",{"title":159,"path":160,"stem":161,"children":162},"Memory + Consequence Agents","\u002Fdocs\u002Fagents\u002Fmemory-consequence-agents","docs\u002F3.agents\u002F11.memory-consequence-agents\u002F1.index",[163,164,185,189],{"title":159,"path":160,"stem":161},{"title":165,"path":166,"stem":167,"children":168},"End-to-End Agent Example","\u002Fdocs\u002Fagents\u002Fmemory-consequence-agents\u002Fend-to-end","docs\u002F3.agents\u002F11.memory-consequence-agents\u002F2.end-to-end\u002F1.index",[169,170,173,176,179,182],{"title":165,"path":166,"stem":167},{"title":82,"path":171,"stem":172},"\u002Fdocs\u002Fagents\u002Fmemory-consequence-agents\u002Fend-to-end\u002Ftypescript","docs\u002F3.agents\u002F11.memory-consequence-agents\u002F2.end-to-end\u002F2.typescript",{"title":86,"path":174,"stem":175},"\u002Fdocs\u002Fagents\u002Fmemory-consequence-agents\u002Fend-to-end\u002Fpython","docs\u002F3.agents\u002F11.memory-consequence-agents\u002F2.end-to-end\u002F3.python",{"title":90,"path":177,"stem":178},"\u002Fdocs\u002Fagents\u002Fmemory-consequence-agents\u002Fend-to-end\u002Fphp","docs\u002F3.agents\u002F11.memory-consequence-agents\u002F2.end-to-end\u002F4.php",{"title":94,"path":180,"stem":181},"\u002Fdocs\u002Fagents\u002Fmemory-consequence-agents\u002Fend-to-end\u002Fgo","docs\u002F3.agents\u002F11.memory-consequence-agents\u002F2.end-to-end\u002F5.go",{"title":98,"path":183,"stem":184},"\u002Fdocs\u002Fagents\u002Fmemory-consequence-agents\u002Fend-to-end\u002Frust","docs\u002F3.agents\u002F11.memory-consequence-agents\u002F2.end-to-end\u002F6.rust",{"title":186,"path":187,"stem":188},"Industry Agent Use Cases","\u002Fdocs\u002Fagents\u002Fmemory-consequence-agents\u002Findustry-use-cases","docs\u002F3.agents\u002F11.memory-consequence-agents\u002F3.industry-use-cases",{"title":190,"path":191,"stem":192},"Historical Actions and Learning","\u002Fdocs\u002Fagents\u002Fmemory-consequence-agents\u002Fhistorical-learning","docs\u002F3.agents\u002F11.memory-consequence-agents\u002F4.historical-learning",{"title":194,"path":195,"stem":196},"Consequence decision support","\u002Fdocs\u002Fagents\u002Fconsequence","docs\u002F3.agents\u002F12.consequence",{"title":198,"path":199,"stem":200,"children":201},"MODEL PROVIDERS","\u002Fdocs\u002Fproviders","docs\u002F4.providers\u002F1.index",[202,204,208,212,216,220,224,228],{"title":203,"path":199,"stem":200},"Providers",{"title":205,"path":206,"stem":207},"OpenAI and Azure OpenAI","\u002Fdocs\u002Fproviders\u002Fopenai","docs\u002F4.providers\u002F2.openai",{"title":209,"path":210,"stem":211},"Anthropic Claude","\u002Fdocs\u002Fproviders\u002Fanthropic","docs\u002F4.providers\u002F3.anthropic",{"title":213,"path":214,"stem":215},"Google Gemini and Vertex AI","\u002Fdocs\u002Fproviders\u002Fgoogle-gemini","docs\u002F4.providers\u002F4.google-gemini",{"title":217,"path":218,"stem":219},"OpenAI-compatible providers","\u002Fdocs\u002Fproviders\u002Fopenai-compatible","docs\u002F4.providers\u002F5.openai-compatible",{"title":221,"path":222,"stem":223},"Groq","\u002Fdocs\u002Fproviders\u002Fgroq","docs\u002F4.providers\u002F6.groq",{"title":225,"path":226,"stem":227},"Cohere","\u002Fdocs\u002Fproviders\u002Fcohere","docs\u002F4.providers\u002F7.cohere",{"title":229,"path":230,"stem":231},"Amazon Bedrock","\u002Fdocs\u002Fproviders\u002Famazon-bedrock","docs\u002F4.providers\u002F8.amazon-bedrock",{"title":233,"path":234,"stem":235,"children":236},"CHANGELOG","\u002Fdocs\u002Fchangelog","docs\u002F5.changelog\u002F1.index",[237,239,243,247],{"title":238,"path":234,"stem":235},"Changelog",{"title":240,"path":241,"stem":242},"Roadmap","\u002Fdocs\u002Fchangelog\u002Froadmap","docs\u002F5.changelog\u002F2.roadmap",{"title":244,"path":245,"stem":246},"Release notes","\u002Fdocs\u002Fchangelog\u002Frelease-runbook","docs\u002F5.changelog\u002F3.release-runbook",{"title":248,"path":249,"stem":250},"Testing","\u002Fdocs\u002Fchangelog\u002Ftesting","docs\u002F5.changelog\u002F4.testing",false,{"id":253,"title":86,"body":254,"description":1367,"extension":1368,"meta":1369,"navigation":322,"path":174,"seo":1370,"stem":175,"__hash__":1371},"docs\u002Fdocs\u002F3.agents\u002F11.memory-consequence-agents\u002F2.end-to-end\u002F3.python.md",{"type":255,"value":256,"toc":1361},"minimark",[257,262,266,298,301,306,565,568,572,776,783,787,1178,1185,1189,1192,1346,1349,1357],[258,259,261],"h1",{"id":260},"python-memory-consequence","Python Memory + Consequence",[263,264,265],"p",{},"Install the Python 3.10+ SDK:",[267,268,273],"pre",{"className":269,"code":270,"language":271,"meta":272,"style":272},"language-bash shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","python -m pip install neutron-ai-sdk\n","bash","",[274,275,276],"code",{"__ignoreMap":272},[277,278,281,285,289,292,295],"span",{"class":279,"line":280},"line",1,[277,282,284],{"class":283},"sBMFI","python",[277,286,288],{"class":287},"sfazB"," -m",[277,290,291],{"class":287}," pip",[277,293,294],{"class":287}," install",[277,296,297],{"class":287}," neutron-ai-sdk\n",[263,299,300],{},"The SDK handles memory and agent context. The helper below calls industry-library and Consequence endpoints that are not yet exposed as typed Python methods.",[302,303,305],"h2",{"id":304},"client-and-authenticated-rest-helper","Client and authenticated REST helper",[267,307,310],{"className":308,"code":309,"language":284,"meta":272,"style":272},"language-python shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","from __future__ import annotations\n\nimport json\nimport os\nfrom typing import Any\nfrom urllib.request import Request, urlopen\n\nfrom neutron_ai import NeutronAIClient\n\n\ndef required_env(name: str) -> str:\n    value = os.environ.get(name)\n    if not value:\n        raise RuntimeError(f\"{name} is required\")\n    return value\n\n\nAPI_URL = required_env(\"NEUTRON_API_URL\").rstrip(\"\u002F\")\nNUCLEUS_ID = \"checkout-platform\"\n\n\ndef neutron_request(token: str, path: str, body: dict[str, Any]) -> dict[str, Any]:\n    request = Request(\n        f\"{API_URL}{path}\",\n        data=json.dumps(body).encode(\"utf-8\"),\n        method=\"POST\",\n        headers={\n            \"authorization\": f\"Bearer {token}\",\n            \"content-type\": \"application\u002Fjson\",\n        },\n    )\n    with urlopen(request, timeout=30) as response:\n        return json.loads(response.read().decode(\"utf-8\"))\n\n\ndef scoped(body: dict[str, Any]) -> dict[str, Any]:\n    return {\"nucleusId\": NUCLEUS_ID, **body}\n\n\nmemory = NeutronAIClient(\n    base_url=API_URL,\n    token=required_env(\"NEUTRON_API_TOKEN\"),\n    nucleus_id=NUCLEUS_ID,\n)\n",[274,311,312,317,324,330,336,342,348,353,359,364,369,375,381,387,393,399,404,409,415,421,426,431,437,443,449,455,461,467,473,479,485,491,497,503,508,513,519,525,530,535,541,547,553,559],{"__ignoreMap":272},[277,313,314],{"class":279,"line":280},[277,315,316],{},"from __future__ import annotations\n",[277,318,320],{"class":279,"line":319},2,[277,321,323],{"emptyLinePlaceholder":322},true,"\n",[277,325,327],{"class":279,"line":326},3,[277,328,329],{},"import json\n",[277,331,333],{"class":279,"line":332},4,[277,334,335],{},"import os\n",[277,337,339],{"class":279,"line":338},5,[277,340,341],{},"from typing import Any\n",[277,343,345],{"class":279,"line":344},6,[277,346,347],{},"from urllib.request import Request, urlopen\n",[277,349,351],{"class":279,"line":350},7,[277,352,323],{"emptyLinePlaceholder":322},[277,354,356],{"class":279,"line":355},8,[277,357,358],{},"from neutron_ai import NeutronAIClient\n",[277,360,362],{"class":279,"line":361},9,[277,363,323],{"emptyLinePlaceholder":322},[277,365,367],{"class":279,"line":366},10,[277,368,323],{"emptyLinePlaceholder":322},[277,370,372],{"class":279,"line":371},11,[277,373,374],{},"def required_env(name: str) -> str:\n",[277,376,378],{"class":279,"line":377},12,[277,379,380],{},"    value = os.environ.get(name)\n",[277,382,384],{"class":279,"line":383},13,[277,385,386],{},"    if not value:\n",[277,388,390],{"class":279,"line":389},14,[277,391,392],{},"        raise RuntimeError(f\"{name} is required\")\n",[277,394,396],{"class":279,"line":395},15,[277,397,398],{},"    return value\n",[277,400,402],{"class":279,"line":401},16,[277,403,323],{"emptyLinePlaceholder":322},[277,405,407],{"class":279,"line":406},17,[277,408,323],{"emptyLinePlaceholder":322},[277,410,412],{"class":279,"line":411},18,[277,413,414],{},"API_URL = required_env(\"NEUTRON_API_URL\").rstrip(\"\u002F\")\n",[277,416,418],{"class":279,"line":417},19,[277,419,420],{},"NUCLEUS_ID = \"checkout-platform\"\n",[277,422,424],{"class":279,"line":423},20,[277,425,323],{"emptyLinePlaceholder":322},[277,427,429],{"class":279,"line":428},21,[277,430,323],{"emptyLinePlaceholder":322},[277,432,434],{"class":279,"line":433},22,[277,435,436],{},"def neutron_request(token: str, path: str, body: dict[str, Any]) -> dict[str, Any]:\n",[277,438,440],{"class":279,"line":439},23,[277,441,442],{},"    request = Request(\n",[277,444,446],{"class":279,"line":445},24,[277,447,448],{},"        f\"{API_URL}{path}\",\n",[277,450,452],{"class":279,"line":451},25,[277,453,454],{},"        data=json.dumps(body).encode(\"utf-8\"),\n",[277,456,458],{"class":279,"line":457},26,[277,459,460],{},"        method=\"POST\",\n",[277,462,464],{"class":279,"line":463},27,[277,465,466],{},"        headers={\n",[277,468,470],{"class":279,"line":469},28,[277,471,472],{},"            \"authorization\": f\"Bearer {token}\",\n",[277,474,476],{"class":279,"line":475},29,[277,477,478],{},"            \"content-type\": \"application\u002Fjson\",\n",[277,480,482],{"class":279,"line":481},30,[277,483,484],{},"        },\n",[277,486,488],{"class":279,"line":487},31,[277,489,490],{},"    )\n",[277,492,494],{"class":279,"line":493},32,[277,495,496],{},"    with urlopen(request, timeout=30) as response:\n",[277,498,500],{"class":279,"line":499},33,[277,501,502],{},"        return json.loads(response.read().decode(\"utf-8\"))\n",[277,504,506],{"class":279,"line":505},34,[277,507,323],{"emptyLinePlaceholder":322},[277,509,511],{"class":279,"line":510},35,[277,512,323],{"emptyLinePlaceholder":322},[277,514,516],{"class":279,"line":515},36,[277,517,518],{},"def scoped(body: dict[str, Any]) -> dict[str, Any]:\n",[277,520,522],{"class":279,"line":521},37,[277,523,524],{},"    return {\"nucleusId\": NUCLEUS_ID, **body}\n",[277,526,528],{"class":279,"line":527},38,[277,529,323],{"emptyLinePlaceholder":322},[277,531,533],{"class":279,"line":532},39,[277,534,323],{"emptyLinePlaceholder":322},[277,536,538],{"class":279,"line":537},40,[277,539,540],{},"memory = NeutronAIClient(\n",[277,542,544],{"class":279,"line":543},41,[277,545,546],{},"    base_url=API_URL,\n",[277,548,550],{"class":279,"line":549},42,[277,551,552],{},"    token=required_env(\"NEUTRON_API_TOKEN\"),\n",[277,554,556],{"class":279,"line":555},43,[277,557,558],{},"    nucleus_id=NUCLEUS_ID,\n",[277,560,562],{"class":279,"line":561},44,[277,563,564],{},")\n",[263,566,567],{},"Keep each token in a server-side secret store. Do not pass workspace, approver, or internal credentials to the agent runtime.",[302,569,571],{"id":570},"install-knowledge-and-remember-reviewed-history","Install knowledge and remember reviewed history",[267,573,575],{"className":308,"code":574,"language":284,"meta":272,"style":272},"neutron_request(\n    required_env(\"NEUTRON_WORKSPACE_API_KEY\"),\n    \"\u002Fv1\u002Fplatform\u002Findustry-library\u002Fplugins\u002Fai-engineering-delivery\u002Finstall\",\n    {\"nucleusId\": NUCLEUS_ID},\n)\n\nmemory.remember({\n    \"scopeId\": \"history:checkout-releases\",\n    \"agentId\": \"agent:release-manager\",\n    \"type\": \"experience\",\n    \"privacyClass\": \"tenant\",\n    \"text\": (\n        \"Release 3.7 used a 5% cohort for 20 minutes before expansion. \"\n        \"The rollout paused when database lock time exceeded 250 ms. \"\n        \"Rollback succeeded. Verify lock duration before expanding similar changes.\"\n    ),\n    \"metadata\": {\n        \"source\": \"approved-release-review\",\n        \"release\": \"3.7\",\n        \"outcome\": \"rolled-back\",\n    },\n})\n\ncontext = memory.agent_context({\n    \"scopeIds\": [\n        \"industry:ai-engineering-delivery\",\n        \"service:checkout-api\",\n        \"history:checkout-releases\",\n        \"policy:production-change\",\n    ],\n    \"agentId\": \"agent:release-manager\",\n    \"task\": \"Prepare a safe release recommendation for checkout API version 3.8.\",\n    \"privacyClasses\": [\"tenant\"],\n    \"tokenBudget\": 1_600,\n    \"cachePolicy\": {\n        \"mode\": \"prefer_cache\",\n        \"keyMode\": \"intent_profile\",\n        \"ttlSeconds\": 300,\n        \"includeDynamicRag\": True,\n    },\n})\n",[274,576,577,582,587,592,597,601,605,610,615,620,625,630,635,640,645,650,655,660,665,670,675,680,685,689,694,699,704,709,714,719,724,728,733,738,743,748,753,758,763,768,772],{"__ignoreMap":272},[277,578,579],{"class":279,"line":280},[277,580,581],{},"neutron_request(\n",[277,583,584],{"class":279,"line":319},[277,585,586],{},"    required_env(\"NEUTRON_WORKSPACE_API_KEY\"),\n",[277,588,589],{"class":279,"line":326},[277,590,591],{},"    \"\u002Fv1\u002Fplatform\u002Findustry-library\u002Fplugins\u002Fai-engineering-delivery\u002Finstall\",\n",[277,593,594],{"class":279,"line":332},[277,595,596],{},"    {\"nucleusId\": NUCLEUS_ID},\n",[277,598,599],{"class":279,"line":338},[277,600,564],{},[277,602,603],{"class":279,"line":344},[277,604,323],{"emptyLinePlaceholder":322},[277,606,607],{"class":279,"line":350},[277,608,609],{},"memory.remember({\n",[277,611,612],{"class":279,"line":355},[277,613,614],{},"    \"scopeId\": \"history:checkout-releases\",\n",[277,616,617],{"class":279,"line":361},[277,618,619],{},"    \"agentId\": \"agent:release-manager\",\n",[277,621,622],{"class":279,"line":366},[277,623,624],{},"    \"type\": \"experience\",\n",[277,626,627],{"class":279,"line":371},[277,628,629],{},"    \"privacyClass\": \"tenant\",\n",[277,631,632],{"class":279,"line":377},[277,633,634],{},"    \"text\": (\n",[277,636,637],{"class":279,"line":383},[277,638,639],{},"        \"Release 3.7 used a 5% cohort for 20 minutes before expansion. \"\n",[277,641,642],{"class":279,"line":389},[277,643,644],{},"        \"The rollout paused when database lock time exceeded 250 ms. \"\n",[277,646,647],{"class":279,"line":395},[277,648,649],{},"        \"Rollback succeeded. Verify lock duration before expanding similar changes.\"\n",[277,651,652],{"class":279,"line":401},[277,653,654],{},"    ),\n",[277,656,657],{"class":279,"line":406},[277,658,659],{},"    \"metadata\": {\n",[277,661,662],{"class":279,"line":411},[277,663,664],{},"        \"source\": \"approved-release-review\",\n",[277,666,667],{"class":279,"line":417},[277,668,669],{},"        \"release\": \"3.7\",\n",[277,671,672],{"class":279,"line":423},[277,673,674],{},"        \"outcome\": \"rolled-back\",\n",[277,676,677],{"class":279,"line":428},[277,678,679],{},"    },\n",[277,681,682],{"class":279,"line":433},[277,683,684],{},"})\n",[277,686,687],{"class":279,"line":439},[277,688,323],{"emptyLinePlaceholder":322},[277,690,691],{"class":279,"line":445},[277,692,693],{},"context = memory.agent_context({\n",[277,695,696],{"class":279,"line":451},[277,697,698],{},"    \"scopeIds\": [\n",[277,700,701],{"class":279,"line":457},[277,702,703],{},"        \"industry:ai-engineering-delivery\",\n",[277,705,706],{"class":279,"line":463},[277,707,708],{},"        \"service:checkout-api\",\n",[277,710,711],{"class":279,"line":469},[277,712,713],{},"        \"history:checkout-releases\",\n",[277,715,716],{"class":279,"line":475},[277,717,718],{},"        \"policy:production-change\",\n",[277,720,721],{"class":279,"line":481},[277,722,723],{},"    ],\n",[277,725,726],{"class":279,"line":487},[277,727,619],{},[277,729,730],{"class":279,"line":493},[277,731,732],{},"    \"task\": \"Prepare a safe release recommendation for checkout API version 3.8.\",\n",[277,734,735],{"class":279,"line":499},[277,736,737],{},"    \"privacyClasses\": [\"tenant\"],\n",[277,739,740],{"class":279,"line":505},[277,741,742],{},"    \"tokenBudget\": 1_600,\n",[277,744,745],{"class":279,"line":510},[277,746,747],{},"    \"cachePolicy\": {\n",[277,749,750],{"class":279,"line":515},[277,751,752],{},"        \"mode\": \"prefer_cache\",\n",[277,754,755],{"class":279,"line":521},[277,756,757],{},"        \"keyMode\": \"intent_profile\",\n",[277,759,760],{"class":279,"line":527},[277,761,762],{},"        \"ttlSeconds\": 300,\n",[277,764,765],{"class":279,"line":532},[277,766,767],{},"        \"includeDynamicRag\": True,\n",[277,769,770],{"class":279,"line":537},[277,771,679],{},[277,773,774],{"class":279,"line":543},[277,775,684],{},[263,777,778,779,782],{},"Pass ",[274,780,781],{},"context[\"promptContext\"]"," to the chosen model only as supporting context. Current deployment evidence and the current task remain primary.",[302,784,786],{"id":785},"plan-and-record-the-decision","Plan and record the decision",[267,788,790],{"className":308,"code":789,"language":284,"meta":272,"style":272},"agent_token = required_env(\"NEUTRON_API_TOKEN\")\ndecision_scopes = [\n    \"industry:ai-engineering-delivery\",\n    \"service:checkout-api\",\n    \"history:checkout-releases\",\n    \"policy:production-change\",\n]\n\nrun = neutron_request(agent_token, \"\u002Fv1\u002Fconsequence\u002Fplan\", scoped({\n    \"scopeIds\": decision_scopes,\n    \"agentId\": \"agent:release-manager\",\n    \"task\": (\n        \"Compare delaying release 3.8, a 1% pilot, a 5% staged rollout, \"\n        \"and immediate release while preserving compatibility and the lock budget.\"\n    ),\n    \"domain\": \"engineering_ops\",\n    \"objectiveHints\": [\n        \"Reduce customer impact\",\n        \"Preserve rollback capability\",\n        \"Collect evidence before expansion\",\n    ],\n    \"constraintHints\": [\n        \"Database lock time must remain below the approved threshold\",\n        \"Expansion requires the accountable release owner\",\n        \"Rollback must remain available\",\n    ],\n    \"idempotencyKey\": \"checkout-3.8-release-review-v1\",\n    \"retentionDays\": 90,\n    \"contextPolicy\": {\n        \"includeMemory\": True,\n        \"includeKnowledge\": True,\n        \"includeContextCapsules\": True,\n        \"includePastDecisions\": True,\n        \"includeReflections\": True,\n    },\n    \"policy\": {\n        \"mode\": \"deep\",\n        \"depth\": 10,\n        \"maxScenarios\": 8,\n        \"maxRuntimeMs\": 8_000,\n        \"requireApprovalAboveRisk\": \"medium\",\n        \"allowExecution\": False,\n        \"storeSafeArtifactsOnly\": True,\n        \"includeCounterfactuals\": True,\n        \"includeReflections\": True,\n    },\n}))\n\nscenario_id = run.get(\"recommendedScenarioId\")\nif not scenario_id:\n    raise RuntimeError(\"No scenario satisfied the current decision boundary\")\n\ndecided = neutron_request(agent_token, \"\u002Fv1\u002Fconsequence\u002Fdecide\", scoped({\n    \"runId\": run[\"runId\"],\n    \"scopeIds\": [\"service:checkout-api\", \"policy:production-change\"],\n    \"selectedScenarioId\": scenario_id,\n    \"decisionSummary\": \"Selected the bounded pilot scenario for owner review.\",\n    \"rationaleSummary\": (\n        \"The pilot preserves rollback and gathers current lock-duration evidence. \"\n        \"Expansion remains conditional on the threshold and owner review.\"\n    ),\n}))\ndecision = decided[\"decisionRecord\"]\n\nif decision[\"status\"] == \"draft\":\n    neutron_request(\n        required_env(\"NEUTRON_APPROVER_TOKEN\"),\n        \"\u002Fv1\u002Fconsequence\u002Fapprove\",\n        scoped({\n            \"decisionId\": decision[\"decisionId\"],\n            \"scopeIds\": [\"service:checkout-api\", \"policy:production-change\"],\n            \"note\": \"Release owner approved the pilot only; expansion needs another review.\",\n        }),\n    )\n",[274,791,792,797,802,807,812,817,822,827,831,836,841,845,850,855,860,864,869,874,879,884,889,893,898,903,908,913,917,922,927,932,937,942,947,952,957,961,966,971,976,981,986,991,996,1001,1006,1011,1016,1022,1027,1033,1039,1045,1050,1056,1062,1068,1074,1080,1086,1092,1098,1103,1108,1114,1119,1125,1131,1137,1143,1149,1155,1161,1167,1173],{"__ignoreMap":272},[277,793,794],{"class":279,"line":280},[277,795,796],{},"agent_token = required_env(\"NEUTRON_API_TOKEN\")\n",[277,798,799],{"class":279,"line":319},[277,800,801],{},"decision_scopes = [\n",[277,803,804],{"class":279,"line":326},[277,805,806],{},"    \"industry:ai-engineering-delivery\",\n",[277,808,809],{"class":279,"line":332},[277,810,811],{},"    \"service:checkout-api\",\n",[277,813,814],{"class":279,"line":338},[277,815,816],{},"    \"history:checkout-releases\",\n",[277,818,819],{"class":279,"line":344},[277,820,821],{},"    \"policy:production-change\",\n",[277,823,824],{"class":279,"line":350},[277,825,826],{},"]\n",[277,828,829],{"class":279,"line":355},[277,830,323],{"emptyLinePlaceholder":322},[277,832,833],{"class":279,"line":361},[277,834,835],{},"run = neutron_request(agent_token, \"\u002Fv1\u002Fconsequence\u002Fplan\", scoped({\n",[277,837,838],{"class":279,"line":366},[277,839,840],{},"    \"scopeIds\": decision_scopes,\n",[277,842,843],{"class":279,"line":371},[277,844,619],{},[277,846,847],{"class":279,"line":377},[277,848,849],{},"    \"task\": (\n",[277,851,852],{"class":279,"line":383},[277,853,854],{},"        \"Compare delaying release 3.8, a 1% pilot, a 5% staged rollout, \"\n",[277,856,857],{"class":279,"line":389},[277,858,859],{},"        \"and immediate release while preserving compatibility and the lock budget.\"\n",[277,861,862],{"class":279,"line":395},[277,863,654],{},[277,865,866],{"class":279,"line":401},[277,867,868],{},"    \"domain\": \"engineering_ops\",\n",[277,870,871],{"class":279,"line":406},[277,872,873],{},"    \"objectiveHints\": [\n",[277,875,876],{"class":279,"line":411},[277,877,878],{},"        \"Reduce customer impact\",\n",[277,880,881],{"class":279,"line":417},[277,882,883],{},"        \"Preserve rollback capability\",\n",[277,885,886],{"class":279,"line":423},[277,887,888],{},"        \"Collect evidence before expansion\",\n",[277,890,891],{"class":279,"line":428},[277,892,723],{},[277,894,895],{"class":279,"line":433},[277,896,897],{},"    \"constraintHints\": [\n",[277,899,900],{"class":279,"line":439},[277,901,902],{},"        \"Database lock time must remain below the approved threshold\",\n",[277,904,905],{"class":279,"line":445},[277,906,907],{},"        \"Expansion requires the accountable release owner\",\n",[277,909,910],{"class":279,"line":451},[277,911,912],{},"        \"Rollback must remain available\",\n",[277,914,915],{"class":279,"line":457},[277,916,723],{},[277,918,919],{"class":279,"line":463},[277,920,921],{},"    \"idempotencyKey\": \"checkout-3.8-release-review-v1\",\n",[277,923,924],{"class":279,"line":469},[277,925,926],{},"    \"retentionDays\": 90,\n",[277,928,929],{"class":279,"line":475},[277,930,931],{},"    \"contextPolicy\": {\n",[277,933,934],{"class":279,"line":481},[277,935,936],{},"        \"includeMemory\": True,\n",[277,938,939],{"class":279,"line":487},[277,940,941],{},"        \"includeKnowledge\": True,\n",[277,943,944],{"class":279,"line":493},[277,945,946],{},"        \"includeContextCapsules\": True,\n",[277,948,949],{"class":279,"line":499},[277,950,951],{},"        \"includePastDecisions\": True,\n",[277,953,954],{"class":279,"line":505},[277,955,956],{},"        \"includeReflections\": True,\n",[277,958,959],{"class":279,"line":510},[277,960,679],{},[277,962,963],{"class":279,"line":515},[277,964,965],{},"    \"policy\": {\n",[277,967,968],{"class":279,"line":521},[277,969,970],{},"        \"mode\": \"deep\",\n",[277,972,973],{"class":279,"line":527},[277,974,975],{},"        \"depth\": 10,\n",[277,977,978],{"class":279,"line":532},[277,979,980],{},"        \"maxScenarios\": 8,\n",[277,982,983],{"class":279,"line":537},[277,984,985],{},"        \"maxRuntimeMs\": 8_000,\n",[277,987,988],{"class":279,"line":543},[277,989,990],{},"        \"requireApprovalAboveRisk\": \"medium\",\n",[277,992,993],{"class":279,"line":549},[277,994,995],{},"        \"allowExecution\": False,\n",[277,997,998],{"class":279,"line":555},[277,999,1000],{},"        \"storeSafeArtifactsOnly\": True,\n",[277,1002,1003],{"class":279,"line":561},[277,1004,1005],{},"        \"includeCounterfactuals\": True,\n",[277,1007,1009],{"class":279,"line":1008},45,[277,1010,956],{},[277,1012,1014],{"class":279,"line":1013},46,[277,1015,679],{},[277,1017,1019],{"class":279,"line":1018},47,[277,1020,1021],{},"}))\n",[277,1023,1025],{"class":279,"line":1024},48,[277,1026,323],{"emptyLinePlaceholder":322},[277,1028,1030],{"class":279,"line":1029},49,[277,1031,1032],{},"scenario_id = run.get(\"recommendedScenarioId\")\n",[277,1034,1036],{"class":279,"line":1035},50,[277,1037,1038],{},"if not scenario_id:\n",[277,1040,1042],{"class":279,"line":1041},51,[277,1043,1044],{},"    raise RuntimeError(\"No scenario satisfied the current decision boundary\")\n",[277,1046,1048],{"class":279,"line":1047},52,[277,1049,323],{"emptyLinePlaceholder":322},[277,1051,1053],{"class":279,"line":1052},53,[277,1054,1055],{},"decided = neutron_request(agent_token, \"\u002Fv1\u002Fconsequence\u002Fdecide\", scoped({\n",[277,1057,1059],{"class":279,"line":1058},54,[277,1060,1061],{},"    \"runId\": run[\"runId\"],\n",[277,1063,1065],{"class":279,"line":1064},55,[277,1066,1067],{},"    \"scopeIds\": [\"service:checkout-api\", \"policy:production-change\"],\n",[277,1069,1071],{"class":279,"line":1070},56,[277,1072,1073],{},"    \"selectedScenarioId\": scenario_id,\n",[277,1075,1077],{"class":279,"line":1076},57,[277,1078,1079],{},"    \"decisionSummary\": \"Selected the bounded pilot scenario for owner review.\",\n",[277,1081,1083],{"class":279,"line":1082},58,[277,1084,1085],{},"    \"rationaleSummary\": (\n",[277,1087,1089],{"class":279,"line":1088},59,[277,1090,1091],{},"        \"The pilot preserves rollback and gathers current lock-duration evidence. \"\n",[277,1093,1095],{"class":279,"line":1094},60,[277,1096,1097],{},"        \"Expansion remains conditional on the threshold and owner review.\"\n",[277,1099,1101],{"class":279,"line":1100},61,[277,1102,654],{},[277,1104,1106],{"class":279,"line":1105},62,[277,1107,1021],{},[277,1109,1111],{"class":279,"line":1110},63,[277,1112,1113],{},"decision = decided[\"decisionRecord\"]\n",[277,1115,1117],{"class":279,"line":1116},64,[277,1118,323],{"emptyLinePlaceholder":322},[277,1120,1122],{"class":279,"line":1121},65,[277,1123,1124],{},"if decision[\"status\"] == \"draft\":\n",[277,1126,1128],{"class":279,"line":1127},66,[277,1129,1130],{},"    neutron_request(\n",[277,1132,1134],{"class":279,"line":1133},67,[277,1135,1136],{},"        required_env(\"NEUTRON_APPROVER_TOKEN\"),\n",[277,1138,1140],{"class":279,"line":1139},68,[277,1141,1142],{},"        \"\u002Fv1\u002Fconsequence\u002Fapprove\",\n",[277,1144,1146],{"class":279,"line":1145},69,[277,1147,1148],{},"        scoped({\n",[277,1150,1152],{"class":279,"line":1151},70,[277,1153,1154],{},"            \"decisionId\": decision[\"decisionId\"],\n",[277,1156,1158],{"class":279,"line":1157},71,[277,1159,1160],{},"            \"scopeIds\": [\"service:checkout-api\", \"policy:production-change\"],\n",[277,1162,1164],{"class":279,"line":1163},72,[277,1165,1166],{},"            \"note\": \"Release owner approved the pilot only; expansion needs another review.\",\n",[277,1168,1170],{"class":279,"line":1169},73,[277,1171,1172],{},"        }),\n",[277,1174,1176],{"class":279,"line":1175},74,[277,1177,490],{},[263,1179,1180,1181,1184],{},"The application must verify the human approver before using ",[274,1182,1183],{},"NEUTRON_APPROVER_TOKEN",". Approval records authorization; it does not execute the release.",[302,1186,1188],{"id":1187},"observe-and-reflect","Observe and reflect",[263,1190,1191],{},"After the separately authorized application records trusted pilot evidence:",[267,1193,1195],{"className":308,"code":1194,"language":284,"meta":272,"style":272},"neutron_request(agent_token, \"\u002Fv1\u002Fconsequence\u002Fobserve\", scoped({\n    \"decisionId\": decision[\"decisionId\"],\n    \"scopeIds\": [\"service:checkout-api\", \"history:checkout-releases\"],\n    \"summary\": \"The 1% pilot completed without customer errors and was held for review.\",\n    \"observedMetrics\": {\n        \"pilot_percent\": 1,\n        \"pilot_minutes\": 30,\n        \"database_lock_p95_ms\": 180,\n        \"customer_error_rate\": 0,\n    },\n    \"unexpectedConsequences\": [\n        \"Cache warm-up took ten minutes longer than estimated.\"\n    ],\n    \"sourceRefs\": [\n        \"release-run:checkout-3.8-pilot\",\n        \"dashboard:database-locks-2026-08-15\",\n    ],\n}))\n\nreflected = neutron_request(\n    required_env(\"NEUTRON_INTERNAL_TOKEN\"),\n    \"\u002Fv1\u002Fconsequence\u002Freflect\",\n    scoped({\n        \"decisionId\": decision[\"decisionId\"],\n        \"scopeIds\": [\"service:checkout-api\", \"history:checkout-releases\"],\n    }),\n)\nlessons = reflected.get(\"reflectionLessons\", [])\nif not lessons:\n    raise RuntimeError(\"Reflection did not return a lesson\")\nlesson = lessons[-1]\n",[274,1196,1197,1202,1207,1212,1217,1222,1227,1232,1237,1242,1246,1251,1256,1260,1265,1270,1275,1279,1283,1287,1292,1297,1302,1307,1312,1317,1322,1326,1331,1336,1341],{"__ignoreMap":272},[277,1198,1199],{"class":279,"line":280},[277,1200,1201],{},"neutron_request(agent_token, \"\u002Fv1\u002Fconsequence\u002Fobserve\", scoped({\n",[277,1203,1204],{"class":279,"line":319},[277,1205,1206],{},"    \"decisionId\": decision[\"decisionId\"],\n",[277,1208,1209],{"class":279,"line":326},[277,1210,1211],{},"    \"scopeIds\": [\"service:checkout-api\", \"history:checkout-releases\"],\n",[277,1213,1214],{"class":279,"line":332},[277,1215,1216],{},"    \"summary\": \"The 1% pilot completed without customer errors and was held for review.\",\n",[277,1218,1219],{"class":279,"line":338},[277,1220,1221],{},"    \"observedMetrics\": {\n",[277,1223,1224],{"class":279,"line":344},[277,1225,1226],{},"        \"pilot_percent\": 1,\n",[277,1228,1229],{"class":279,"line":350},[277,1230,1231],{},"        \"pilot_minutes\": 30,\n",[277,1233,1234],{"class":279,"line":355},[277,1235,1236],{},"        \"database_lock_p95_ms\": 180,\n",[277,1238,1239],{"class":279,"line":361},[277,1240,1241],{},"        \"customer_error_rate\": 0,\n",[277,1243,1244],{"class":279,"line":366},[277,1245,679],{},[277,1247,1248],{"class":279,"line":371},[277,1249,1250],{},"    \"unexpectedConsequences\": [\n",[277,1252,1253],{"class":279,"line":377},[277,1254,1255],{},"        \"Cache warm-up took ten minutes longer than estimated.\"\n",[277,1257,1258],{"class":279,"line":383},[277,1259,723],{},[277,1261,1262],{"class":279,"line":389},[277,1263,1264],{},"    \"sourceRefs\": [\n",[277,1266,1267],{"class":279,"line":395},[277,1268,1269],{},"        \"release-run:checkout-3.8-pilot\",\n",[277,1271,1272],{"class":279,"line":401},[277,1273,1274],{},"        \"dashboard:database-locks-2026-08-15\",\n",[277,1276,1277],{"class":279,"line":406},[277,1278,723],{},[277,1280,1281],{"class":279,"line":411},[277,1282,1021],{},[277,1284,1285],{"class":279,"line":417},[277,1286,323],{"emptyLinePlaceholder":322},[277,1288,1289],{"class":279,"line":423},[277,1290,1291],{},"reflected = neutron_request(\n",[277,1293,1294],{"class":279,"line":428},[277,1295,1296],{},"    required_env(\"NEUTRON_INTERNAL_TOKEN\"),\n",[277,1298,1299],{"class":279,"line":433},[277,1300,1301],{},"    \"\u002Fv1\u002Fconsequence\u002Freflect\",\n",[277,1303,1304],{"class":279,"line":439},[277,1305,1306],{},"    scoped({\n",[277,1308,1309],{"class":279,"line":445},[277,1310,1311],{},"        \"decisionId\": decision[\"decisionId\"],\n",[277,1313,1314],{"class":279,"line":451},[277,1315,1316],{},"        \"scopeIds\": [\"service:checkout-api\", \"history:checkout-releases\"],\n",[277,1318,1319],{"class":279,"line":457},[277,1320,1321],{},"    }),\n",[277,1323,1324],{"class":279,"line":463},[277,1325,564],{},[277,1327,1328],{"class":279,"line":469},[277,1329,1330],{},"lessons = reflected.get(\"reflectionLessons\", [])\n",[277,1332,1333],{"class":279,"line":475},[277,1334,1335],{},"if not lessons:\n",[277,1337,1338],{"class":279,"line":481},[277,1339,1340],{},"    raise RuntimeError(\"Reflection did not return a lesson\")\n",[277,1342,1343],{"class":279,"line":487},[277,1344,1345],{},"lesson = lessons[-1]\n",[263,1347,1348],{},"Review the lesson's prediction delta, regret score, confidence adjustment, future policy suggestion, and memory-write policy before promoting it into durable memory.",[263,1350,1351,1352,1356],{},"Return to the ",[1353,1354,1355],"a",{"href":166},"shared lifecycle and production checklist",".",[1358,1359,1360],"style",{},"html pre.shiki code .sBMFI, html code.shiki .sBMFI{--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B}html pre.shiki code .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":272,"searchDepth":319,"depth":319,"links":1362},[1363,1364,1365,1366],{"id":304,"depth":319,"text":305},{"id":570,"depth":319,"text":571},{"id":785,"depth":319,"text":786},{"id":1187,"depth":319,"text":1188},"Build a memory-and-consequence agent with the Python SDK and public REST endpoints.","md",{},{"title":86,"description":1367},"4ifeZkDKak7O4lLmsZxzEluTT8MCsMCJRSKTP0Dxu0k",[1373,1374],{"title":82,"path":171,"stem":172,"children":-1},{"title":90,"path":177,"stem":178,"children":-1},1786883755934]