Session

It's Just a While Loop: Building Agentic Apps in Flutter with the Claude API

If you write Flutter, you've probably watched the AI wave from the sidelines, assuming agents are
some exotic Python-and-cloud thing happening to other people. They aren't. This talk takes the
mystery out of agentic AI by showing what's actually inside the box, using a real, open-source
Flutter app rather than a toy. A single Claude API call returns content blocks and a stop reason,
and when that reason is tool_use, the app runs the requested tool, hands the result back, and
asks again. Wrap that in a loop and you have an agent. That's the whole trick, and the loop that
does it is about forty lines of Dart.

I'll start with a live demo: I'll ask the app to save an article and remind me to read it in two days,
and we'll watch Claude chain several local tools together to get it done. Then we'll go under the
hood and read the code that made that happen, built on the anthropic_sdk_dart package. We'll
look at the agent loop itself, how a tool is defined as a schema plus a plain Dart function, and
how a thin repository layer and a Bloc keep the whole thing testable and maintainable. I'll close
by showing how the same loop unlocks streaming, extended thinking, prompt caching, and the
Files API once the basics are in place. You'll leave knowing the Claude API is approachable from
the language and framework you already use, with the repo in hand to add your first tool this
week.


Everyone talks about AI agents like they're magic. They're not. An agent is a while loop around
the Claude API. I'll demo a real Flutter app doing it, then walk the actual code that makes it work.

Key takeaways

• Why an AI agent is just a loop around the Claude API, in about forty lines of Dart.
• How to define a tool as a schema plus a plain Dart function the loop can call.
• How a thin repository and a Bloc keep an agentic Flutter app testable as it grows.

Marcos Sevilla

Technical Delivery Lead at Very Good Ventures

Barcelona, Spain

Actions

Please note that Sessionize is not responsible for the accuracy or validity of the data provided by speakers. If you suspect this profile to be fake or spam, please let us know.

Jump to top