Hi Anna team,
While developing an Anna App, I ran into a question about timeout handling for anna.llm.complete, and I would like to confirm whether the current behavior is expected or whether the docs / SDK contract could be clarified.
I checked the current official developer documentation, especially:
- App-Side LLM & Agent API
- App UI Host API
- Local Dev with
--llm
The documented anna.llm.complete(req) example is roughly:
const reply = await window.anna.llm.complete({
messages: [
{ role: "user", content: { type: "text", text: "Say hi" } },
],
maxTokens: 256,
});
From the docs, it looks like anna.llm.complete(input) itself does not publicly accept a timeout, timeoutMs, signal, or similar timeout/cancellation parameter.
However, when I inspected the local @anna-ai/app-runtime implementation, I found that the lower-level generic RPC method runtime.call(ns, method, args, options) does support timeoutMs, for example:
await runtime.call("llm", "complete", input, {
timeoutMs: 120_000,
});
So if an app wants to avoid the default SDK wait timeout used by anna.llm.complete(input), it currently seems necessary to bypass the higher-level helper and call the lower-level generic RPC method directly.
There is also a semantic concern here: this timeoutMs appears to be a local iframe SDK / runtime RPC wait timeout, not a timeout for the actual backend LLM request. In other words, the following situation seems possible:
- The app calls
runtime.call("llm", "complete", input, { timeoutMs: 5000 }) - After 5 seconds, the app-side Promise rejects with
RPC llm.complete timed out - But the LLM request in the dev harness / host / network layer is not cancelled
- Later, the LLM request may still complete successfully in logs or at the network layer
- The app runtime has already removed the pending request, so the late result no longer resolves the original caller
This can lead to a few practical issues:
- The app treats the request as failed, while the backend request may still be running
- If the app retries after timeout, it may create duplicate LLM requests
- This may cause duplicate quota usage or duplicate generation work
- It is not obvious whether
timeoutMsmeans “local SDK wait timeout” or “LLM request timeout” - The higher-level
anna.llm.completeAPI and the lower-levelruntime.callcapability feel inconsistent
I would like to ask:
- Is
anna.llm.complete(input)expected to officially supporttimeoutMsorAbortSignalin the future? - Is the current meaning of
runtime.call(..., { timeoutMs })only “local SDK wait timeout”, without cancelling the host / backend / provider-side request? - If so, could the docs explicitly distinguish between:
- app runtime RPC timeout
- host/backend LLM request timeout
- provider/model timeout
- What is the recommended best practice for long-running LLM completions? For example, should developers:
- use a longer
runtime.calltimeout - avoid automatic retries after timeout
- use agent sessions / streaming instead
- or wait for future cancellable
anna.llm.completesupport
- use a longer
I think it would be helpful to add a small section to the docs clarifying the current request schema supported by anna.llm.complete, and how runtime.call’s timeoutMs relates to the actual LLM request lifecycle. This would help developers avoid misunderstandings where the app times out but the backend request still completes, potentially causing duplicate requests or quota usage.