From 1b2a9e3dcbbbf989087b36eb38b727374cfa3d50 Mon Sep 17 00:00:00 2001 From: akhisud3195 Date: Fri, 11 Jul 2025 17:27:55 +0530 Subject: [PATCH] Show max calls per parent-child only for child internal agents --- apps/rowboat/app/lib/agents.ts | 11 ++++ .../[projectId]/entities/agent_config.tsx | 54 ++++++++++--------- 2 files changed, 39 insertions(+), 26 deletions(-) diff --git a/apps/rowboat/app/lib/agents.ts b/apps/rowboat/app/lib/agents.ts index ba127ef8..f5e300db 100644 --- a/apps/rowboat/app/lib/agents.ts +++ b/apps/rowboat/app/lib/agents.ts @@ -1025,6 +1025,17 @@ export async function* streamResponse( break; } + // Only apply max calls limit to internal agents (task agents) + const targetAgentConfig = agentConfig[event.item.targetAgent.name]; + if (targetAgentConfig?.outputVisibility === 'internal') { + const maxCalls = targetAgentConfig?.maxCallsPerParentAgent || 3; + const currentCalls = transferCounter.get(agentName, event.item.targetAgent.name); + if (currentCalls >= maxCalls) { + eventLogger.log(`skipping handoff to ${event.item.targetAgent.name} || reason: max calls ${maxCalls} exceeded from ${agentName} to internal agent ${event.item.targetAgent.name}`); + continue; + } + } + // inject give up control instructions if needed (parent handing off to child) maybeInjectGiveUpControlInstructions( agents, diff --git a/apps/rowboat/app/projects/[projectId]/entities/agent_config.tsx b/apps/rowboat/app/projects/[projectId]/entities/agent_config.tsx index 353568d5..c748c79e 100644 --- a/apps/rowboat/app/projects/[projectId]/entities/agent_config.tsx +++ b/apps/rowboat/app/projects/[projectId]/entities/agent_config.tsx @@ -576,35 +576,37 @@ export function AgentConfig({ -
-
- -
- -
-
Max Calls Configuration
- This setting limits how many times a parent agent can call this agent in a single turn, to prevent infinite loops. -
+ {agent.outputVisibility === "internal" && ( +
+
+ +
+ +
+
Max Calls Configuration
+ This setting limits how many times a parent agent can call this agent in a single turn, to prevent infinite loops. +
+
+
+ handleUpdate({ + ...agent, + maxCallsPerParentAgent: parseInt(e.target.value) + })} + className="w-full max-w-24" + /> +
-
- handleUpdate({ - ...agent, - maxCallsPerParentAgent: parseInt(e.target.value) - })} - className="w-full max-w-24" - /> -
-
+ )} {USE_TRANSFER_CONTROL_OPTIONS && (