import { Analysis, Utils } from "@tago-io/sdk";
import type { TagoContext } from "@tago-io/sdk";
async function handleReport(context: TagoContext, scope: unknown[]) {
const job = Utils.parseAIGeneration(scope[0]);
if (job?.status === "completed") {
console.log(job.output?.text);
}
}
Analysis.use(handleReport);
Reads an AI generation job from a callback Analysis scope.
When a job started with
callbackreaches a final status, the API runs the callback Analysis with the job asscope[0]. If the API process running the job stops, the callback does not run. Returns the job with its dates parsed, ornullwhen the value is not a generation job, for example when the Analysis also runs from other triggers.