Eventos

Errore

{ type: "error", message, code }

La run va fail. E' emanata poco prima di run() rejet — quindi è un notizion, non un stato recuperabile.

the run then rejectsraretool failures are not this
Using Python?

Switch any code block to Python: the choice applies to every page. Python SDK guide and resource reference.

Campos

messagestring

Messaggio del erro.

codestring

Su cod, quando ha un — context_too_large, turn_failed, unauthorized.

Que non è un evento di erro

SituazioneAnunciat
Un utensilio gettatotool_end con ok: false — il loop continua
Un utensilio fu resistittool_end con refused: true
Un virat failed e sta sendo rejuziatretry
Un modele ha ceduto e il proximo è usafallback
Un soffit era alzatdone con stopReason
Quasi tutto ciò che va mal è manegnat dentro del loop

Un evento di errore significa che il loop non può continuare — il virare a fault su ogni model dopo ogni tentazione, il contesto non vat, la sessione non è autorizzata. Ciascuna di esse è una condizione a cui il code has de reagire, non una che l'agente puè lavorare.

Manejar-lo

import { IaGenifyError, NotEnoughCredits } from "iagenify";

try {
  await agent.run({ inputs, onEvent });
} catch (err) {
  if (err instanceof NotEnoughCredits) {
    // Never retried, on any model. Top up.
  } else if (err instanceof IaGenifyError && err.code === "context_too_large") {
    await agent.compact();
  } else {
    throw err;
  }
}
from iagenify import IaGenifyError, NotEnoughCredits

try:
    agent.run(inputs=inputs, on_event=on_event)
except NotEnoughCredits:
    pass  # Never retried, on any model. Top up.
except IaGenifyError as error:
    if error.code != "context_too_large":
        raise
    agent.compact()

L'evento e il rejet portano la medesima cosa — l'evento existe per una interface puèt mostrarlo senza attendere la promessa di stereo.

A subagent that fails does not fail the run

Il suo fallimento è emanat come un error che porta parentId, e il task termina l'appello con ok: false. Il padre prosegue con il risultato del outil — un delegat che non puèt fare il suo lavoro è informazion, non un crash.