Mule
Runs an AI model's reply-and-tool-call loop as one awaited, cancellable call, so a TypeScript service doesn't have to write that control flow itself.
Fastest path
Install
Add it to your project with npm, pnpm, Yarn or Bun.
TERMINAL npm install @fungi.computer/muleRun a scripted model reply
A faux model answers once, with no network call or credential; prints the run's final status.
home.ts import { fauxAssistantMessage } from "@earendil-works/pi-ai/providers/faux";import { mule } from "@fungi.computer/mule";import { fauxModel } from "@fungi.computer/mule/testing";const faux = fauxModel([fauxAssistantMessage("pong")]);const outcome = await mule.run({model: faux.model,retryable: faux.retryable,stream: faux.stream,systemPrompt: "Reply once.",messages: [{ role: "user", content: "ping", timestamp: 1 }],},() => {},);console.log(outcome.status); // "completed"