1212use NeuronAI \Chat \Messages \Stream \Chunks \ToolResultChunk ;
1313use NeuronAI \Chat \Messages \ToolCallMessage ;
1414use NeuronAI \Chat \Messages \ToolResultMessage ;
15- use NeuronAI \Exceptions \ToolMaxTriesException ;
15+ use NeuronAI \Exceptions \ToolRunsExceededException ;
1616use NeuronAI \Observability \Events \ToolCalled ;
1717use NeuronAI \Observability \Events \ToolCalling ;
1818use NeuronAI \Tools \ToolInterface ;
@@ -32,7 +32,7 @@ public function __construct(
3232 }
3333
3434 /**
35- * @throws ToolMaxTriesException
35+ * @throws ToolRunsExceededException
3636 * @throws Throwable
3737 */
3838 public function __invoke (ToolCallEvent $ event , AgentState $ state ): Generator
@@ -52,7 +52,7 @@ public function __invoke(ToolCallEvent $event, AgentState $state): Generator
5252
5353 /**
5454 * @throws Throwable
55- * @throws ToolMaxTriesException
55+ * @throws ToolRunsExceededException
5656 */
5757 protected function executeTools (ToolCallMessage $ toolCallMessage , AgentState $ state ): Generator
5858 {
@@ -68,7 +68,7 @@ protected function executeTools(ToolCallMessage $toolCallMessage, AgentState $st
6868 /**
6969 * Execute a single tool with proper error handling and retry logic.
7070 *
71- * @throws ToolMaxTriesException If the tool exceeds its maximum retry attempts
71+ * @throws ToolRunsExceededException If the tool exceeds its maximum retry attempts
7272 * @throws Throwable If the tool execution fails
7373 */
7474 protected function executeSingleTool (ToolInterface $ tool , AgentState $ state ): void
@@ -81,7 +81,7 @@ protected function executeSingleTool(ToolInterface $tool, AgentState $state): vo
8181 // Single tool max tries have the highest priority over the global max tries
8282 $ runs = $ tool ->getMaxRuns () ?? $ this ->maxRuns ;
8383 if ($ state ->getToolAttempts ($ tool ->getName ()) > $ runs ) {
84- throw new ToolMaxTriesException ("Tool {$ tool ->getName ()} has been executed too many times: {$ runs }. " );
84+ throw new ToolRunsExceededException ("Tool {$ tool ->getName ()} has been executed too many times: {$ runs }. " );
8585 }
8686
8787 $ tool ->execute ();
0 commit comments