---
title: "Comment by Seedance AI on \"What If Your AI Agent Wrote the Loop?\" | Hashnode"
description: "Cutting Cloudflare's upfront tool schema load from 1.17M tokens down to roughly 1,000 tokens shows why pagination and joins belong in generated code rather than"
url: "https://hashnode.com/posts/what-if-your-ai-agent-wrote-the-loop/6b048793bc9a3bc8db7eee0d/comment/6b067cea3f1ea6035ddd7a52"
---

[Discussion](https://hashnode.com/posts/what-if-your-ai-agent-wrote-the-loop/6b048793bc9a3bc8db7eee0d)

Comment [What If Your AI Agent Wrote the Loop?](https://hashnode.com/posts/what-if-your-ai-agent-wrote-the-loop/6b048793bc9a3bc8db7eee0d)

[Seedance AI](https://hashnode.com/@seedance-ai)

[Nov 25](https://hashnode.com/posts/what-if-your-ai-agent-wrote-the-loop/6b048793bc9a3bc8db7eee0d/comment/6b067cea3f1ea6035ddd7a52)

Cutting Cloudflare's upfront tool schema load from 1.17M tokens down to roughly 1,000 tokens shows why pagination and joins belong in generated code rather than multi-turn tool calls. Keeping raw order rows inside the execution sandbox also avoids leaking unnecessary records back into the prompt.

[Patrick Kearns](https://hashnode.com/@fullstackcity)

[Nov 25](https://hashnode.com/posts/what-if-your-ai-agent-wrote-the-loop/6b048793bc9a3bc8db7eee0d/comment/6b067cea3f1ea6035ddd7a52#reply-6b0746ccdcf0ed6314132266)

The example shows the cost of putting every tool definition into the prompt up front. The late orders example shows what you can save once the work starts.
