[{"data":1,"prerenderedAt":215},["ShallowReactive",2],{"doc-\u002Fdocs\u002Fbub-agent":3},{"id":4,"title":5,"body":6,"description":208,"extension":209,"meta":210,"navigation":88,"path":211,"seo":212,"stem":213,"__hash__":214},"content\u002Fdocs\u002Fbub-agent.md","Agent integration with Bub main",{"type":7,"value":8,"toc":206},"minimark",[9,13,34,42,71,177,192,199,202],[10,11,5],"h1",{"id":12},"agent-integration-with-bub-main",[14,15,16,17,21,22,25,26,33],"p",{},"Linnaeus provides one decision tool through Bub. The ",[18,19,20],"code",{},"agent"," extra pins Bub main at\n",[18,23,24],{},"9bf70488e22a44eeb875a9d55d9a7d352b82e381",". Integration uses its\n",[27,28,32],"a",{"href":29,"rel":30},"https:\u002F\u002Fgithub.com\u002Fbubbuild\u002Fbub\u002Fblob\u002F9bf70488e22a44eeb875a9d55d9a7d352b82e381\u002Fwebsite\u002Fsrc\u002Fcontent\u002Fdocs\u002Fdocs\u002Fbuild\u002Fsdk.md",[31],"nofollow","Python SDK","\nto provide one batch decision tool and persistent session tapes.",[14,35,36,37,41],{},"Follow the ",[27,38,40],{"href":39},"inference","runtime and checkpoint setup"," first.",[43,44,49],"pre",{"className":45,"code":46,"language":47,"meta":48,"style":48},"language-bash shiki shiki-themes github-light github-dark","uv sync --extra agent\n","bash","",[18,50,51],{"__ignoreMap":48},[52,53,56,60,64,68],"span",{"class":54,"line":55},"line",1,[52,57,59],{"class":58},"sScJk","uv",[52,61,63],{"class":62},"sZZnC"," sync",[52,65,67],{"class":66},"sj4cs"," --extra",[52,69,70],{"class":62}," agent\n",[43,72,76],{"className":73,"code":74,"language":75,"meta":48,"style":48},"language-python shiki shiki-themes github-light github-dark","from pathlib import Path\n\nfrom linnaeus.bub_agent import create_agent\nfrom linnaeus.predictor import Predictor\n\npredictor = Predictor.from_checkpoint(\"pi-dal\u002FLinnaeus-0.1.0-2B\")\nframework, agent = create_agent(\n    predictor, workspace=Path.cwd(), tape_directory=Path(\"runs\u002Fagent-tapes\")\n)\n\n\nasync def decide():\n    command = ',linnaeus.decide state=\\'{\"message\":\"Please refund this invoice.\"}\\' '\n    command += 'questions=\\'{\"refund\":{\"type\":\"noul\",\"instructions\":\"Is a refund requested?\"}}\\''\n    async with framework.running():\n        stream = await agent.run_stream(session_id=\"billing\", prompt=command)\n        return [event async for event in stream]\n","python",[18,77,78,83,90,96,102,107,113,119,125,131,136,141,147,153,159,165,171],{"__ignoreMap":48},[52,79,80],{"class":54,"line":55},[52,81,82],{},"from pathlib import Path\n",[52,84,86],{"class":54,"line":85},2,[52,87,89],{"emptyLinePlaceholder":88},true,"\n",[52,91,93],{"class":54,"line":92},3,[52,94,95],{},"from linnaeus.bub_agent import create_agent\n",[52,97,99],{"class":54,"line":98},4,[52,100,101],{},"from linnaeus.predictor import Predictor\n",[52,103,105],{"class":54,"line":104},5,[52,106,89],{"emptyLinePlaceholder":88},[52,108,110],{"class":54,"line":109},6,[52,111,112],{},"predictor = Predictor.from_checkpoint(\"pi-dal\u002FLinnaeus-0.1.0-2B\")\n",[52,114,116],{"class":54,"line":115},7,[52,117,118],{},"framework, agent = create_agent(\n",[52,120,122],{"class":54,"line":121},8,[52,123,124],{},"    predictor, workspace=Path.cwd(), tape_directory=Path(\"runs\u002Fagent-tapes\")\n",[52,126,128],{"class":54,"line":127},9,[52,129,130],{},")\n",[52,132,134],{"class":54,"line":133},10,[52,135,89],{"emptyLinePlaceholder":88},[52,137,139],{"class":54,"line":138},11,[52,140,89],{"emptyLinePlaceholder":88},[52,142,144],{"class":54,"line":143},12,[52,145,146],{},"async def decide():\n",[52,148,150],{"class":54,"line":149},13,[52,151,152],{},"    command = ',linnaeus.decide state=\\'{\"message\":\"Please refund this invoice.\"}\\' '\n",[52,154,156],{"class":54,"line":155},14,[52,157,158],{},"    command += 'questions=\\'{\"refund\":{\"type\":\"noul\",\"instructions\":\"Is a refund requested?\"}}\\''\n",[52,160,162],{"class":54,"line":161},15,[52,163,164],{},"    async with framework.running():\n",[52,166,168],{"class":54,"line":167},16,[52,169,170],{},"        stream = await agent.run_stream(session_id=\"billing\", prompt=command)\n",[52,172,174],{"class":54,"line":173},17,[52,175,176],{},"        return [event async for event in stream]\n",[14,178,179,180,183,184,187,188,191],{},"The tool is named ",[18,181,182],{},"linnaeus.decide","; its model-facing alias is ",[18,185,186],{},"linnaeus_decide",". Supply\nindependent questions together against one state. Its optional ",[18,189,190],{},"image_path","\nargument names an image within the application's workspace. The returned\nprobabilities retain the predictor's meanings. Calls are serialized per predictor\ninstance, while each call batches its questions.",[14,193,194,195,198],{},"An application may configure Bub's planner\u002Fprovider and call ",[18,196,197],{},"run_stream"," with a\nnatural-language prompt. The application owns the framework lifetime and decides\nhow to act on the returned distributions.",[14,200,201],{},"The explicit comma-command calls the decision tool without an external planner.\nPlanner quality and provider cost depend on the application's provider settings.",[203,204,205],"style",{},"html pre.shiki code .sScJk, html code.shiki .sScJk{--shiki-default:#6F42C1;--shiki-dark:#B392F0}html pre.shiki code .sZZnC, html code.shiki .sZZnC{--shiki-default:#032F62;--shiki-dark:#9ECBFF}html pre.shiki code .sj4cs, html code.shiki .sj4cs{--shiki-default:#005CC5;--shiki-dark:#79B8FF}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":48,"searchDepth":85,"depth":92,"links":207},[],"Linnaeus provides one decision tool through Bub. The agent extra pins Bub main at\n9bf70488e22a44eeb875a9d55d9a7d352b82e381. Integration uses its\nPython SDK\nto provide one batch decision tool and persistent session tapes.","md",{},"\u002Fdocs\u002Fbub-agent",{"title":5,"description":208},"docs\u002Fbub-agent","eWXbb_WC6i5n78JxEJTWoaUCKDFO9P-QrfhIYy6_ibA",1790560641962]