Show max calls per parent-child only for child internal agents

This commit is contained in:
akhisud3195 2025-07-11 17:27:55 +05:30
parent 173dd9142f
commit 1b2a9e3dcb
2 changed files with 39 additions and 26 deletions

View file

@ -1025,6 +1025,17 @@ export async function* streamResponse(
break; 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) // inject give up control instructions if needed (parent handing off to child)
maybeInjectGiveUpControlInstructions( maybeInjectGiveUpControlInstructions(
agents, agents,

View file

@ -576,6 +576,7 @@ export function AgentConfig({
</div> </div>
</div> </div>
{agent.outputVisibility === "internal" && (
<div className="space-y-4"> <div className="space-y-4">
<div className="flex items-center"> <div className="flex items-center">
<label className={sectionHeaderStyles}> <label className={sectionHeaderStyles}>
@ -605,6 +606,7 @@ export function AgentConfig({
/> />
</div> </div>
</div> </div>
)}
{USE_TRANSFER_CONTROL_OPTIONS && ( {USE_TRANSFER_CONTROL_OPTIONS && (
<div className="space-y-4"> <div className="space-y-4">