Skip to content

Instantly share code, notes, and snippets.

@pazteddy
Created May 13, 2026 20:20
Show Gist options
  • Select an option

  • Save pazteddy/b297ed90a31e3d314494d36e257efa67 to your computer and use it in GitHub Desktop.

Select an option

Save pazteddy/b297ed90a31e3d314494d36e257efa67 to your computer and use it in GitHub Desktop.
Verifica límite ANTES de ejecutar para el caso tool_use
if (this.toolCallsLastTurn + toolUseBlocks.length > MAX_TOOL_CALLS) {
console.warn(
`Límite de ${MAX_TOOL_CALLS} tool calls alcanzado en este turno`
);
const limitMessage =
`He alcanzado el límite de ${MAX_TOOL_CALLS} llamadas a herramientas por turno. ` +
`Para completar esta tarea, intenta dividirla en preguntas más específicas.`;
this.messages.push({
role: "assistant",
content: limitMessage,
});
return {
text: limitMessage,
toolsUsed,
inputTokens: inputTokensThisTurn,
outputTokens: outputTokensThisTurn,
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment