[{"data":1,"prerenderedAt":461,"buildId":462},["ShallowReactive",2],{"docs:\u002Fguide\u002Fagents":3},{"page":4,"section":16,"document":17,"credits":10,"prev":457,"next":10},{"id":5,"path":6,"file":7,"title":8,"sourceTitle":8,"description":9,"tagline":9,"eyebrow":10,"credits":10,"keywords":11,"icon":12,"layout":13,"sidebar":14,"toc":14,"kind":10,"group":10,"navigation":14,"order":15},"agents","\u002Fguide\u002Fagents","guide\u002Fagents.md","Coding agents","Tell coding agents how your program reaches machines, and let them test it without a real host.",null,[],"i-lucide-bot","article",true,6,"guide",{"nodes":18,"toc":453},[19,28,140,148,154,328,426,433,439],[20,21,22,23,27],"p",{},"A coding agent that works on a program built on fleethosts needs three facts: where the fleet is, how a run reports a dead machine, and how to test without one. Put them in ",[24,25,26],"code",{},"AGENTS.md",":",[29,30,33],"pre",{"language":31,"filename":26,"class":32,"wrap":14},"md","shiki shiki-themes github-light-default github-dark-default dark:github-dark-default",[24,34,36,45,46,45,48,45,77,45,93,45,110,45,135],{"class":35},"language-md",[37,38,41],"span",{"class":39,"style":40},"line","display: inline",[37,42,44],{"style":43},"color:#0550AE;--shiki-light-font-weight:bold;--shiki-dark:#79C0FF;--shiki-dark-font-weight:bold","## Machines","\n",[37,47],{"class":39,"style":40},[37,49,50,54,58,62,65,68,71,74],{"class":39,"style":40},[37,51,53],{"style":52},"color:#953800;--shiki-dark:#FFA657","-",[37,55,57],{"style":56},"color:#1F2328;--shiki-dark:#E6EDF3"," The fleet is in ",[37,59,61],{"style":60},"color:#0550AE;--shiki-dark:#79C0FF","`~\u002F.local\u002Fstate\u002Fmytool\u002Fhosts.json`",[37,63,64],{"style":56}," (",[37,66,67],{"style":60},"`recordHosts`",[37,69,70],{"style":56},", ",[37,72,73],{"style":60},"`recordedHosts`",[37,75,76],{"style":56}," from fleethosts).",[37,78,79,81,84,87,90],{"class":39,"style":40},[37,80,53],{"style":52},[37,82,83],{"style":60}," `runOnHosts`",[37,85,86],{"style":56}," returns one result per machine. Read ",[37,88,89],{"style":60},"`exitCode`",[37,91,92],{"style":56}," only when it is there: a machine that",[37,94,95,98,101,104,107],{"class":39,"style":40},[37,96,97],{"style":56},"  didn't answer has ",[37,99,100],{"style":60},"`reachable: false`",[37,102,103],{"style":56}," and an ",[37,105,106],{"style":60},"`error`",[37,108,109],{"style":56},", not a failed exit code.",[37,111,112,114,117,120,123,126,129,132],{"class":39,"style":40},[37,113,53],{"style":52},[37,115,116],{"style":56}," Tests never reach a real host. ",[37,118,119],{"style":60},"`MYTOOL_SSH`",[37,121,122],{"style":56}," and ",[37,124,125],{"style":60},"`MYTOOL_TAILSCALE`",[37,127,128],{"style":56}," name fake CLIs; a ",[37,130,131],{"style":60},"`.mjs`",[37,133,134],{"style":56}," file",[37,136,137],{"class":39,"style":40},[37,138,139],{"style":56},"  runs with Node.",[141,142,147],"h2",{"id":143,"anchor":144},"testing-without-a-host",{"label":145,"icon":146},"Section titled \"Testing without a host\"","#","Testing without a host",[20,149,150,153],{},[24,151,152],{},"\u003CPROGRAM>_SSH"," names the ssh fleethosts runs. Point it at a script that runs the remote command on this machine:",[29,155,158],{"language":156,"filename":157,"class":32,"wrap":14},"js","test\u002Ffake-ssh.mjs",[24,159,161,45,180,45,182,45,209,45,245,45,269,45,287],{"class":160},"language-js",[37,162,163,167,170,173,177],{"class":39,"style":40},[37,164,166],{"style":165},"color:#CF222E;--shiki-dark:#FF7B72","import",[37,168,169],{"style":56}," { spawnSync } ",[37,171,172],{"style":165},"from",[37,174,176],{"style":175},"color:#0A3069;--shiki-dark:#A5D6FF"," \"node:child_process\"",[37,178,179],{"style":56},";",[37,181],{"class":39,"style":40},[37,183,184,187,190,193,196,200,203,206],{"class":39,"style":40},[37,185,186],{"style":165},"const",[37,188,189],{"style":60}," args",[37,191,192],{"style":165}," =",[37,194,195],{"style":56}," process.argv.",[37,197,199],{"style":198},"color:#8250DF;--shiki-dark:#D2A8FF","slice",[37,201,202],{"style":56},"(",[37,204,205],{"style":60},"2",[37,207,208],{"style":56},");",[37,210,211,214,217,220,223,226,229,232,235,237,239,241,243],{"class":39,"style":40},[37,212,213],{"style":165},"while",[37,215,216],{"style":56}," (args[",[37,218,219],{"style":60},"0",[37,221,222],{"style":56},"] ",[37,224,225],{"style":165},"===",[37,227,228],{"style":175}," \"-o\"",[37,230,231],{"style":56},") args.",[37,233,234],{"style":198},"splice",[37,236,202],{"style":56},[37,238,219],{"style":60},[37,240,70],{"style":56},[37,242,205],{"style":60},[37,244,208],{"style":56},[37,246,247,250,252,254,256,258,261,263,266],{"class":39,"style":40},[37,248,249],{"style":165},"if",[37,251,216],{"style":56},[37,253,219],{"style":60},[37,255,222],{"style":56},[37,257,225],{"style":165},[37,259,260],{"style":175}," \"--\"",[37,262,231],{"style":56},[37,264,265],{"style":198},"shift",[37,267,268],{"style":56},"();",[37,270,271,273,276,279,281,284],{"class":39,"style":40},[37,272,186],{"style":165},[37,274,275],{"style":56}," [, ",[37,277,278],{"style":60},"command",[37,280,222],{"style":56},[37,282,283],{"style":165},"=",[37,285,286],{"style":56}," args;",[37,288,289,292,295,297,300,302,305,308,311,314,317,320,323,326],{"class":39,"style":40},[37,290,291],{"style":56},"process.",[37,293,294],{"style":198},"exit",[37,296,202],{"style":56},[37,298,299],{"style":198},"spawnSync",[37,301,202],{"style":56},[37,303,304],{"style":175},"\"sh\"",[37,306,307],{"style":56},", [",[37,309,310],{"style":175},"\"-c\"",[37,312,313],{"style":56},", command], { stdio: ",[37,315,316],{"style":175},"\"inherit\"",[37,318,319],{"style":56}," }).status ",[37,321,322],{"style":165},"??",[37,324,325],{"style":60}," 1",[37,327,208],{"style":56},[29,329,331],{"language":330,"class":32,"wrap":14},"ts",[24,332,334,45,368,45,420],{"class":333},"language-ts",[37,335,336,339,342,344,347,350,352,355,357,359,362,365],{"class":39,"style":40},[37,337,338],{"style":56},"process.env.",[37,340,341],{"style":60},"MYTOOL_SSH",[37,343,192],{"style":165},[37,345,346],{"style":165}," new",[37,348,349],{"style":198}," URL",[37,351,202],{"style":56},[37,353,354],{"style":175},"\".\u002Ffake-ssh.mjs\"",[37,356,70],{"style":56},[37,358,166],{"style":165},[37,360,361],{"style":56},".",[37,363,364],{"style":60},"meta",[37,366,367],{"style":56},".url).pathname;",[37,369,370,372,375,378,380,382,385,388,391,394,397,400,402,405,408,411,414,417],{"class":39,"style":40},[37,371,186],{"style":165},[37,373,374],{"style":56}," [",[37,376,377],{"style":60},"box",[37,379,222],{"style":56},[37,381,283],{"style":165},[37,383,384],{"style":165}," await",[37,386,387],{"style":198}," runOnHosts",[37,389,390],{"style":56},"(places, [{ host: ",[37,392,393],{"style":175},"\"box\"",[37,395,396],{"style":56}," }], [",[37,398,399],{"style":175},"\"echo\"",[37,401,70],{"style":56},[37,403,404],{"style":175},"\"hi\"",[37,406,407],{"style":56},"], ",[37,409,410],{"style":60},"5_000",[37,412,413],{"style":56},", { here: ",[37,415,416],{"style":60},"false",[37,418,419],{"style":56}," });",[37,421,422],{"class":39,"style":40},[37,423,425],{"style":424},"color:#6E7781;--shiki-dark:#8B949E","\u002F\u002F { host: \"box\", reachable: true, exitCode: 0, stdout: \"hi\\n\", stderr: \"\" }",[20,427,428,429,432],{},"Build the ",[24,430,431],{},"Places"," in a temporary folder, so a test never writes to the machine's own state.",[141,434,438],{"id":435,"anchor":436},"markdown-copies",{"label":437,"icon":146},"Section titled \"Markdown copies\"","Markdown copies",[20,440,441,442,445,446,449,450,361],{},"Every page on this site has a raw Markdown copy at ",[24,443,444],{},"\u002Fraw\u002F\u003Cpage>.md",", such as ",[24,447,448],{},"\u002Fraw\u002Fguide\u002Fhosts.md",", and a full index at ",[24,451,452],{},"\u002Fllms.txt",[454,456],{"id":143,"depth":455,"text":147},2,{"id":435,"depth":455,"text":438},{"path":458,"title":459,"description":460},"\u002Fguide\u002Fexec","Exec","Run a command to the end without throwing on its exit code, with support for timeouts and cancellation.",1796389874272,"46cbc05d-e250-4080-9447-dbba79b74350"]