Get an API key
Concepts

Timeouts and abort

Most calls give up after 60 seconds. The ones that make the server work for minutes deliberately do not, because abandoning them would not stop the work.

60 s defaulttimeout: 0 disablesAbortSignal
Using Python?

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

The defaults

CallDeadlineWhy
Most calls60 sA reply that has not arrived by then is not coming.
models.turn()300 sA turn can think for a long time before it answers.
assistant.generate()noneGeneration can take minutes; see below.
tools.convert(), tools.fetch()noneSame reason.
Streaming callsnoneThe connection is held open on purpose.
Why generation has no deadline

The work does not stop because you stopped listening: it finishes, and the call is still billed. A client-side deadline would therefore cost you the call and return nothing. Bound it with an AbortSignal instead, which you control.

Setting your own

// For the whole client
const api = new IaGenify({ apiKey, timeout: 15_000 });

// For one call
await api.models.turn({ model, messages, signal: AbortSignal.timeout(30_000) });
# For the whole client, in seconds
api = IaGenify(api_key=api_key, timeout=15)

# For one call
api.models.turn(model=model, messages=messages, timeout=30)

Aborting

Every call takes a signal. An abort you asked for is passed through as-is — it is not rewrapped as a timeout — so you can tell your own cancellation apart from the client giving up.

const controller = new AbortController();

const running = agent.run({
  message: "Audit the whole workspace.",
  onEvent: console.log,
  signal: controller.signal,
});

setTimeout(() => controller.abort(new Error("user cancelled")), 10_000);

try {
  await running;
} catch (err) {
  if (controller.signal.aborted) console.log("cancelled by us");
  else if (err.code === "timeout") console.log("the client gave up");
}
import threading
from iagenify import RequestTimeout

# Python has no AbortSignal: stop the agent from another thread
timer = threading.Timer(10, agent.stop)
timer.start()

try:
    result = agent.run(message="Audit the whole workspace.", on_event=print)
    if result["stopReason"] == "stopped":
        print("cancelled by us")
except RequestTimeout:
    print("the client gave up")
finally:
    timer.cancel()

The two failures you will see

codestatusMeaning
timeout408No answer within the deadline.
unreachable503The request never got there: wrong baseUrl, no network, nothing listening.

unreachable in a deployed service almost always means baseUrl is not the one you meant. Read api.baseUrl and compare it with https://api.iagenify.com.