Cloudflare AI·

Two Weeks with Cloudflare AI and Tools

My Odyssey (and Why I Switched to AWS Bedrock)
the man is seated at his desk at his computer with his back to the camera head in his hands crying

Two Weeks with Cloudflare AI and Tools: My Odyssey (and Why I Switched to AWS Bedrock)

Let me set the scene: It’s late at night, my family’s asleep, and I’m working on a personal project, staring at yet another Cloudflare AI doc. For two weeks, I’ve been on a mission—get Cloudflare’s AI to use tools for my project. I’m a developer, so I’m stubborn. But even stubbornness has its limits.

Week 1 Start: The Optimism Phase

I started out like every developer does: full of hope, docs open in one tab, terminal in the other. Cloudflare’s pitch is strong—serverless, scalable, and AI at the edge. What could go wrong? I already have a Nuxt blog, which I just added AI chat to using the new Nuxt UI Pro. I thought, “This is going to be a breeze.” I mean, how hard could it be to get AI tools working with Cloudflare?

Week 2 Start: The Debugging Spiral

By week two, I was deep in the weeds. I tried every example, every forum post, every Stack Overflow answer that even mentioned Cloudflare AI. I've been using ai-sdk + NuxtHub + Cloudflare AI Gateway, and I even cloned down all their repos trying to debug it.

I’ve built an AI tools with LangChain and Python at work, but wanted to keep to TypeScript for my site.

Week 2 End: Acceptance (and a Little Bit of Rage)

By the end of week two, I was a bit broken. I had made almost no progress on getting tools to work, but found tons of ways they didn’t. And let’s be clear: my tool was just calling a function to generate a random temperature. I couldn’t even get that to work. I was getting errors like:

NoSuchToolError [AI_NoSuchToolError]: Model tried to call unavailable tool 'undefined'. Available tools: getWeatherInformation.

I tried different models, different configurations, tried adding unit tests, but the way Cloudflare injects its remote env.AI is really odd. During this time I saw this post by Pooya Parsa which summed up my feelings perfectly. The injection of the env is a nightmare to try to write tests for. Go find an example on how, I'll wait.

The final blow was when I thought I had it working. It was giving me a response, and I thought I had it working. I was getting random temperature values, supposedly from the tool. After checking the messages, it turned out that @cf/meta/llama-4-scout-17b-16e-instruct was hallucinating that it called a tool and just gave me a number...

I realized I was spending more time fighting the platform than building my product. That’s when it hit me: it’s okay to give up. Sometimes, the best move is to walk away.

The Switch to AWS

At work, I use AWS all day, every day. I know it like the back of my hand. But I also like to try new things. I thought Cloudflare would be a good change of pace. But after two weeks of wrestling with their AI tools, I decided to go back to what I know best: AWS.

So for now, the goal was to swap the AI chat to use Bedrock instead of the Cloudflare AI tools. I'll likely keep hosting the site on Cloudflare, but I needed a reliable AI backend. I wanted to use the same tools I was already familiar with, and AWS was calling my name.

What I Learned

  • The issue wasn’t really Cloudflare AI, but likely ai-sdk not supporting tools when Cloudflare was the provider. That would have been fine if I ever got an error message that made sense. But between fighting the cloudflare Env remote environment, streaming responses, not getting any errors that made sense.
  • Sometimes, persistence is overrated. Know when to cut your losses.
  • Good docs and community support are worth their weight in gold.
  • It’s okay to switch tools. Your project (and your sanity) will thank you.

Final Thoughts

If you’re thinking about using Cloudflare AI tools, go in with your eyes open. Maybe you’ll have better luck than I did. But if you find yourself two weeks in, still fighting the same bugs—don’t be afraid to stop. Time box your problem and if your not making progress then pivot.

Happy coding, and may your AI tools always work on the first try (but let’s be real, they probably won’t).