[{"data":1,"prerenderedAt":418},["ShallowReactive",2],{"docs-\u002Fdocs\u002Fv2\u002Fagent\u002Fmanaged-runtime":3},{"id":4,"title":5,"body":6,"description":16,"extension":412,"meta":413,"navigation":161,"path":414,"seo":415,"stem":416,"__hash__":417},"docs\u002Fdocs\u002Fv2\u002Fagent\u002Fmanaged-runtime.md","The Axon Runtime",{"type":7,"value":8,"toc":405},"minimark",[9,13,17,20,23,28,40,43,208,211,215,222,228,234,240,250,256,260,270,273,277,280,351,354,358,371,374,383,392,401],[10,11,5],"h1",{"id":12},"the-axon-runtime",[14,15,16],"p",{},"Every agent framework eventually forces the same decisions: how do you assemble the\ncontext window? How do you decide when the agent should stop? What happens when a tool\ncall fails? How do you persist session state across requests? How do you enforce what the\nagent is and isn't allowed to do?",[14,18,19],{},"In most frameworks, those decisions are yours. You read the docs, pick a strategy, and\nimplement it. Then you do it again for the next agent.",[14,21,22],{},"Axon makes those decisions once. The result is the managed runtime — the infrastructure\nlayer that every Axon agent runs on, regardless of what the agent does.",[24,25,27],"h2",{"id":26},"the-boundary","The boundary",[14,29,30,31,35,36,39],{},"The boundary is ",[32,33,34],"code",{},"axon.request()"," and ",[32,37,38],{},"axon.stream()",".",[14,41,42],{},"On your side: which prompts to load, which thread to continue, what policy to apply for\nthis invocation. On Axon's side: everything else.",[44,45,50],"pre",{"className":46,"code":47,"language":48,"meta":49,"style":49},"language-ts shiki shiki-themes dark-plus","const { stream } = axon.stream({\n    prompt: [session, task],          \u002F\u002F you assembled this\n    thread: \"project-alpha\",          \u002F\u002F you named this\n    policy: { fs: { write: false } }, \u002F\u002F you narrowed this\n})\n\nfor await (const entry of stream) {\n    \u002F\u002F the runtime ran the loop, dispatched tools, managed context\n    \u002F\u002F you receive structured output entries\n}\n","ts","",[32,51,52,84,109,125,150,156,163,190,196,202],{"__ignoreMap":49},[53,54,57,61,65,69,72,76,78,81],"span",{"class":55,"line":56},"line",1,[53,58,60],{"class":59},"scz_3","const",[53,62,64],{"class":63},"sTNBD"," { ",[53,66,68],{"class":67},"s9McN","stream",[53,70,71],{"class":63}," } = ",[53,73,75],{"class":74},"s3F5K","axon",[53,77,39],{"class":63},[53,79,68],{"class":80},"sCudf",[53,82,83],{"class":63},"({\n",[53,85,87,90,93,96,99,102,105],{"class":55,"line":86},2,[53,88,89],{"class":74},"    prompt:",[53,91,92],{"class":63}," [",[53,94,95],{"class":74},"session",[53,97,98],{"class":63},", ",[53,100,101],{"class":74},"task",[53,103,104],{"class":63},"],          ",[53,106,108],{"class":107},"sOLPB","\u002F\u002F you assembled this\n",[53,110,112,115,119,122],{"class":55,"line":111},3,[53,113,114],{"class":74},"    thread:",[53,116,118],{"class":117},"sKc5r"," \"project-alpha\"",[53,120,121],{"class":63},",          ",[53,123,124],{"class":107},"\u002F\u002F you named this\n",[53,126,128,131,133,136,138,141,144,147],{"class":55,"line":127},4,[53,129,130],{"class":74},"    policy:",[53,132,64],{"class":63},[53,134,135],{"class":74},"fs:",[53,137,64],{"class":63},[53,139,140],{"class":74},"write:",[53,142,143],{"class":59}," false",[53,145,146],{"class":63}," } }, ",[53,148,149],{"class":107},"\u002F\u002F you narrowed this\n",[53,151,153],{"class":55,"line":152},5,[53,154,155],{"class":63},"})\n",[53,157,159],{"class":55,"line":158},6,[53,160,162],{"emptyLinePlaceholder":161},true,"\n",[53,164,166,170,173,176,178,181,184,187],{"class":55,"line":165},7,[53,167,169],{"class":168},"sYbnZ","for",[53,171,172],{"class":168}," await",[53,174,175],{"class":63}," (",[53,177,60],{"class":59},[53,179,180],{"class":67}," entry",[53,182,183],{"class":59}," of",[53,185,186],{"class":74}," stream",[53,188,189],{"class":63},") {\n",[53,191,193],{"class":55,"line":192},8,[53,194,195],{"class":107},"    \u002F\u002F the runtime ran the loop, dispatched tools, managed context\n",[53,197,199],{"class":55,"line":198},9,[53,200,201],{"class":107},"    \u002F\u002F you receive structured output entries\n",[53,203,205],{"class":55,"line":204},10,[53,206,207],{"class":63},"}\n",[14,209,210],{},"You don't call the model directly. You don't manage the context window. You don't\nimplement retry logic or handle partial tool call responses. You stream entries.",[24,212,214],{"id":213},"what-axon-owns","What Axon owns",[14,216,217,221],{},[218,219,220],"strong",{},"Context assembly"," — Axon formats the system prompt, prior thread history, loaded\nprompts, and tool declarations into a context window. How it balances these against the\nmodel's context limit, when it compresses, how it prioritises — handled automatically.",[14,223,224,227],{},[218,225,226],{},"Tool dispatch"," — when the model decides to call a tool, Axon routes the call to the\ncapsule subprocess, executes it under the active policy, and feeds the result back into\nthe loop. You don't orchestrate this. You don't poll for results.",[14,229,230,233],{},[218,231,232],{},"Loop control"," — the agent runs until it reaches a natural stopping point or a\nconfigured stop condition fires. You don't implement a loop. You don't check whether\nthe agent is done.",[14,235,236,239],{},[218,237,238],{},"Stop conditions"," — the runtime detects when the agent has completed its task and\nterminates the loop cleanly. You consume the output stream; you don't monitor for\ncompletion signals.",[14,241,242,245,246,249],{},[218,243,244],{},"Session persistence"," — every session is written to ",[32,247,248],{},"data\u002Fsessions\u002F"," as a JSONL trace.\nNamed threads resume with full prior context by loading that trace. This is automatic.\nYou don't manage it and you don't call any persistence API.",[14,251,252,255],{},[218,253,254],{},"Kernel enforcement"," — agent code runs in the capsule, an isolated subprocess with its\nown process boundary. The kernel enforces the policy you declare — which files can be read or\nwritten, which processes can be spawned, which network calls can be made. The agent\nprocess has no direct access to any of these primitives. Policy violations are rejected\nbefore the function runs, not after.",[24,257,259],{"id":258},"why-this-matters","Why this matters",[14,261,262,263,266,267,269],{},"The same agent source works in every environment without modification. The runtime\nadapts to the environment; your code does not. The ",[32,264,265],{},"src\u002F"," you write on your laptop is\nthe same ",[32,268,265],{}," that runs in production.",[14,271,272],{},"When Axon ships a better context assembly strategy, a more efficient compression model,\nor a smarter stop condition, your agent gets it. You update a package version, not an\nimplementation. The infrastructure is maintained for you.",[24,274,276],{"id":275},"what-you-still-own","What you still own",[14,278,279],{},"The runtime manages execution. It does not write your agent.",[281,282,283,296],"table",{},[284,285,286],"thead",{},[287,288,289,293],"tr",{},[290,291,292],"th",{},"Yours",[290,294,295],{},"Runtime's",[297,298,299,312,320,328,335,343],"tbody",{},[287,300,301,309],{},[302,303,304,305,308],"td",{},"Agent identity (",[32,306,307],{},"boot.vue",")",[302,310,311],{},"Context window assembly",[287,313,314,317],{},[302,315,316],{},"Tools — what the agent can do",[302,318,319],{},"Tool dispatch and retry",[287,321,322,325],{},[302,323,324],{},"Prompts — what context it receives",[302,326,327],{},"Loop control and stop conditions",[287,329,330,333],{},[302,331,332],{},"Scripts — how work is orchestrated",[302,334,244],{},[287,336,337,340],{},[302,338,339],{},"Policy — what it's allowed to do",[302,341,342],{},"Capsule process isolation",[287,344,345,348],{},[302,346,347],{},"Routes — how it's exposed over HTTP",[302,349,350],{},"Engine API management",[14,352,353],{},"The line is intentional. Axon owns the hard infrastructure problems that are the same for\nevery agent. You own the things that make this agent distinct.",[24,355,357],{"id":356},"engines-are-swappable","Engines are swappable",[14,359,360,361,364,365,370],{},"The runtime is model-agnostic. One line in ",[32,362,363],{},"axon.config.ts"," selects the inference\nsource; the loop, tools, and policy don't change. ",[366,367,369],"a",{"href":368},"\u002Fdocs\u002Fv2\u002Fagent\u002Fruntime\u002Fengines","Engines","\ncovers the choice — managed, bring-your-own, or fully local.",[372,373],"hr",{},[14,375,376,382],{},[218,377,378],{},[366,379,381],{"href":380},"\u002Fdocs\u002Fv2\u002Fconcepts\u002Fstate-model","State & Memory"," — the four layers of state behind\nthe runtime behaviour you just read about.",[14,384,385,391],{},[218,386,387],{},[366,388,390],{"href":389},"\u002Fdocs\u002Fv2\u002Fagent\u002Ffolder","Agent Structure"," — the folder reference. Every file, what\nit does, what Axon does with it at boot and runtime.",[14,393,394,400],{},[218,395,396],{},[366,397,399],{"href":398},"\u002Fdocs\u002Fv2\u002Fconcepts\u002Fruntime-loop","The Runtime Loop"," — what one tick of the loop\nactually does, and why none of it is configuration.",[402,403,404],"style",{},"html pre.shiki code .scz_3, html code.shiki .scz_3{--shiki-default:#569CD6}html pre.shiki code .sTNBD, html code.shiki .sTNBD{--shiki-default:#D4D4D4}html pre.shiki code .s9McN, html code.shiki .s9McN{--shiki-default:#4FC1FF}html pre.shiki code .s3F5K, html code.shiki .s3F5K{--shiki-default:#9CDCFE}html pre.shiki code .sCudf, html code.shiki .sCudf{--shiki-default:#DCDCAA}html pre.shiki code .sOLPB, html code.shiki .sOLPB{--shiki-default:#6A9955}html pre.shiki code .sKc5r, html code.shiki .sKc5r{--shiki-default:#CE9178}html pre.shiki code .sYbnZ, html code.shiki .sYbnZ{--shiki-default:#C586C0}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);}",{"title":49,"searchDepth":86,"depth":86,"links":406},[407,408,409,410,411],{"id":26,"depth":86,"text":27},{"id":213,"depth":86,"text":214},{"id":258,"depth":86,"text":259},{"id":275,"depth":86,"text":276},{"id":356,"depth":86,"text":357},"md",{},"\u002Fdocs\u002Fv2\u002Fagent\u002Fmanaged-runtime",{"title":5,"description":16},"docs\u002Fv2\u002Fagent\u002Fmanaged-runtime","Yl03ye-b6oealLmFb7wt_qq6mwfeENCeNpd9aQDTNW4",1785671805773]