Skip to content
ShopNexus Docs
On this page Before the turn opens 1/7

The server stops a question before the turn opens; the agent stops a segment while it runs. A refusal of the first kind comes back at once as HTTP; one of the second kind reaches the console as a turn.finished event.

Before the turn opens

CheckWhereResult
The agent’s monthly budget is spentserver429 agent_budget
Over 30 questions and updates a minute from one moderatorserver, in each replica’s memory429 agent_rate_limited
The question is empty once cleanedserver400 invalid_request
The question is over 2000 charactersserver422 agent_input_rejected
The chat has an unfinished turnserver409 agent_turn_in_progress
FEATURE_ALL_AGENT or FEATURE_LLM is falseagent503, which the server answers as agent_unavailable

While running

LimitDefaultWhen passed
A segment’s deadline (limits.deadline_s, 10 to 300)60 secondsTIMED_OUT; the steps and tool calls so far stay
Model calls per segment (max_model_calls)40FAILED, agent_limit
Output tokens per model call (max_tokens)4096that call’s reply is cut
Tool output kept in context (AGENT_TOOL_OUTPUT_CAP)20 000 charactersthe rest pages through the read_output tool
The same tool with the same input2 callsthe third is cancelled, a guardrail event loop_stopped is written, and the model is told to answer with what it has

Budgets

Every model call carries user=<moderator id>, so LiteLLM applies each moderator’s daily budget; a console agent also has a monthly budget on its alias. A budget spent midway ends the segment FAILED with agent_budget, and the console’s ask box says asking is paused until midnight or until an admin adds budget. Each call’s cost comes from the x-litellm-response-cost header and adds up in the turn’s usage.

Provider rate limits

On a 429 from LiteLLM that is not a spent budget, the agent waits and sends the same request again. The wait comes from reset_at, retry-after-ms or retry-after, 60 seconds when none is given. A segment waits at most three times, at most 90 seconds each, and writes rate.waiting {until} for the console’s countdown. Stop now and the segment’s deadline end a wait.

Context

After each model call, a context.meter event reports the tokens used against the context window (limits.context_window, 128 000 by default). Past 80 %, the agent summarises every message before the model’s last reply with the same model, replaces them with one message holding the summary and the moderator’s question, and writes context.compacting and context.compacted. A context still full after that ends the segment with agent_context.

Error codes

CodeOutcomeCan continueText the console shows
agent_timeoutout_of_roomyesQuá thời gian trả lời. Hãy hỏi lại.
agent_limitout_of_roomyesLượt hỏi đã dùng hết số bước cho phép.
agent_contextout_of_roomyesNgữ cảnh của lượt hỏi đã đầy.
agent_failedbrokenyesAgent gặp lỗi giữa chừng. Có thể tiếp tục lượt này.
agent_stuckbrokenyesLượt hỏi bị gián đoạn. Hãy hỏi lại.
agent_unavailableunavailablenoAgent đang không trả lời được. Hãy thử lại sau.
agent_budgetblockednoHết hạn mức hôm nay.
agent_blockedblockednoLượt hỏi bị chặn.

A FAILED or TIMED_OUT turn can continue when it is the chat’s latest turn, it wrote at least a step, a tool call or some text, and its code is one of the five marked “yes”. A turn cancelled with End has the outcome stopped.

Known limits

  • Stop now, a tool’s time limit and the segment’s deadline cannot stop an MCP call already running on the server.
  • Pause, Stop now and updates reach the agent within about a second, the control poll interval.
  • The kill switches apply per process.
  • The agent masks personal data in its own audit log. Answers may quote personal data the moderator is allowed to read, and the server records those reads.
ShopNexus Docs
EN VI