Agent integration with Bub main
Linnaeus provides one decision tool through Bub. The agent extra pins Bub main at
9bf70488e22a44eeb875a9d55d9a7d352b82e381. Integration uses its
Python SDK
to provide one batch decision tool and persistent session tapes.
Follow the runtime and checkpoint setup first.
uv sync --extra agent
from pathlib import Path
from linnaeus.bub_agent import create_agent
from linnaeus.predictor import Predictor
predictor = Predictor.from_checkpoint("pi-dal/Linnaeus-0.1.0-2B")
framework, agent = create_agent(
predictor, workspace=Path.cwd(), tape_directory=Path("runs/agent-tapes")
)
async def decide():
command = ',linnaeus.decide state=\'{"message":"Please refund this invoice."}\' '
command += 'questions=\'{"refund":{"type":"noul","instructions":"Is a refund requested?"}}\''
async with framework.running():
stream = await agent.run_stream(session_id="billing", prompt=command)
return [event async for event in stream]
The tool is named linnaeus.decide; its model-facing alias is linnaeus_decide. Supply
independent questions together against one state. Its optional image_path
argument names an image within the application's workspace. The returned
probabilities retain the predictor's meanings. Calls are serialized per predictor
instance, while each call batches its questions.
An application may configure Bub's planner/provider and call run_stream with a
natural-language prompt. The application owns the framework lifetime and decides
how to act on the returned distributions.
The explicit comma-command calls the decision tool without an external planner. Planner quality and provider cost depend on the application's provider settings.