feat: add AgentMaxIterationError exc (#30423)

This commit is contained in:
wangxiaolei
2026-01-01 00:40:54 +08:00
committed by GitHub
parent ae43ad5cb6
commit 9b6b2f3195
3 changed files with 22 additions and 0 deletions

View File

@ -119,3 +119,14 @@ class AgentVariableTypeError(AgentNodeError):
self.expected_type = expected_type
self.actual_type = actual_type
super().__init__(message)
class AgentMaxIterationError(AgentNodeError):
"""Exception raised when the agent exceeds the maximum iteration limit."""
def __init__(self, max_iteration: int):
self.max_iteration = max_iteration
super().__init__(
f"Agent exceeded the maximum iteration limit of {max_iteration}. "
f"The agent was unable to complete the task within the allowed number of iterations."
)