From 7da59263c8091ab8e083143d2b8c700bea75ab65 Mon Sep 17 00:00:00 2001 From: maxpetrusenkoagent Date: Mon, 22 Jun 2026 00:43:46 -0400 Subject: [PATCH] docs: clarify runaway team safeguards --- .../tutorial/termination.ipynb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/python/docs/src/user-guide/agentchat-user-guide/tutorial/termination.ipynb b/python/docs/src/user-guide/agentchat-user-guide/tutorial/termination.ipynb index b12b874043a0..86b16b35d31d 100644 --- a/python/docs/src/user-guide/agentchat-user-guide/tutorial/termination.ipynb +++ b/python/docs/src/user-guide/agentchat-user-guide/tutorial/termination.ipynb @@ -286,6 +286,24 @@ "combined_termination = max_msg_termination & text_termination" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Guarding Against Runaway Teams\n", + "\n", + "AutoGen does not currently expose a built-in agent or team capacity declaration, such as a maximum queue depth or a retry-after contract for callers. If your application needs backpressure, enforce it at the orchestration boundary instead of relying on every caller to retry correctly.\n", + "\n", + "Practical safeguards include:\n", + "\n", + "- Use {py:class}`~autogen_agentchat.conditions.MaxMessageTermination`, {py:class}`~autogen_agentchat.conditions.TokenUsageTermination`, and {py:class}`~autogen_agentchat.conditions.TimeoutTermination` together so a retry loop has hard message, token, and time ceilings.\n", + "- Use {py:class}`~autogen_agentchat.conditions.ExternalTermination` when your application observes saturation, provider rate limits, or queue growth outside the team and needs to stop the run programmatically.\n", + "- Implement a custom termination condition when overload is visible in the messages produced by your agents or tools, for example when a tool returns a rate-limit result or a caller receives too many retry requests.\n", + "- Keep tool loops bounded with agent settings such as `max_tool_iterations` so one overloaded tool cannot create an unbounded cascade.\n", + "\n", + "These safeguards are hard stop conditions. They do not advertise capacity to other agents, but they prevent a saturated team from running indefinitely while the application decides whether to retry later, fall back to another provider, or hand off to a human." + ] + }, { "cell_type": "markdown", "metadata": {},