(agentId: string, limit: number = 3)
| 401 | } |
| 402 | |
| 403 | public getLastToolsForAgent(agentId: string, limit: number = 3): ToolCall[] { |
| 404 | const iterations = this.getIterationsForAgent(agentId); |
| 405 | const allTools: ToolCall[] = []; |
| 406 | |
| 407 | // Collect all tools from all iterations, most recent first |
| 408 | for (let i = iterations.length - 1; i >= 0; i--) { |
| 409 | const iteration = iterations[i]; |
| 410 | // Add tools in reverse order (most recent first within the iteration) |
| 411 | for (let j = iteration.tools.length - 1; j >= 0; j--) { |
| 412 | allTools.push(iteration.tools[j]); |
| 413 | if (allTools.length >= limit) { |
| 414 | return allTools; |
| 415 | } |
| 416 | } |
| 417 | } |
| 418 | |
| 419 | return allTools; |
| 420 | } |
| 421 | |
| 422 | public getToolsFromLastIteration(agentId: string): ToolCall[] { |
| 423 | const iterations = this.getIterationsForAgent(agentId); |
nothing calls this directly
no test coverage detected