How It Works
A look at the Flarite AI agent loop — from your prompt to the final structured result.
The Agent Loop
When you send a prompt, Flarite doesn't just call a language model and return the text. It runs an agentic loop — the AI can call real API tools, inspect results, and continue reasoning until it has a complete answer.
Tool Calling
Flarite provides the AI with a set of typed tool definitions — one set per provider. Each tool maps to a real API endpoint. For example, the Cloudflare integration exposes tools likelist_zones, add_dns_record, get_worker_detail, and dozens more.
The AI model chooses which tools to invoke based on your prompt — and can chain multiple tool calls in a single response cycle. This means a prompt like "find any zone where the SSL mode is Flexible and change them all to Full" can trigger multiple API calls automatically.
Token Security During Tool Calls
Your API token is never sent to the AI model. It is only decrypted at the moment a tool makes an API call — server-side, in the Cloudflare Worker. The model only sees the results of the API call, not your credentials.
See Security Model and Token Encryption for full details.
Prompt Counting
Each call to /api/ai/command counts as one prompt against your monthly limit, regardless of how many tool calls the agent makes internally. The counter is shared across all providers — switching from Cloudflare to Stripe uses the same pool. See Plans & Limits.
Model
By default, Flarite uses Cloudflare Workers AI to run a high-quality open model. Users on eligible plans can enable Bring Your Own Model (BYOM) — letting you use your own Cloudflare AI account with unlimited prompts.
