Repository navigation
Sixth experiment: an AI agent's tool after a provider failover.
An agent of the Laravel AI SDK 1.4.0 runs in a queued job with a primary and a backup provider. Its tool, SendInvoiceEmail, runs on the primary; the next step gets a 429. prompt() then starts the whole run over on the backup, the model asks for the tool again, and the invoice goes out twice. The job succeeds and the rate limit isn't reported, so the only trace is the AgentFailedOver event. stream() already refuses to fail over once it has sent output; prompt() has no such check. With the fix from fix/no-failover-after-tools, the tool runs once and the job fails with RateLimitedException.
Both providers are a fake OpenAI-compatible server (bin/fake-ai-provider.php), so no model or API key is needed. Like experiments 4 and 5 it runs on the database queue, no broker: vendor/bin/phpunit tests/AgentFailoverTest.php.
Checked in CI with PHP 8.3–8.5, Laravel 13 and laravel/ai 1.4.0.