fomvasss/laravel-ai-tasks

AI task orchestrator for Laravel: routing, queue, audit, budget, webhooks
5,133 40
Install
composer require fomvasss/laravel-ai-tasks
Latest Version:3.27.1
PHP:^8.3
License:MIT
Last Updated:Sep 10, 2026
Links: GitHub  ·  Packagist
Maintainer: fomvasss

Laravel AI Tasks

License Latest Stable Version Total Downloads

AI task orchestrator for Laravel. Handles routing, queuing, audit logging, budget tracking, and webhook processing on top of laravel/ai as the transport layer.

Українською

Dashboard

  • Routing with fallback — a chain of drivers per task, the next one is tried when a provider is down
  • Queues — idempotency, delayed dispatch, retries of unusable results, onCompleted()/onFailed() hooks
  • Audit log — every run in ai_runs: driver, model, tokens, cost, duration, status
  • Budgets and cost tracking — per tenant, per driver and per model
  • Dashboard — runs, driver state, stuck runs, retry from the browser
  • Text, image, embeddings, TTS, transcription, tools & MCP, structured output, streaming
  • AI::fake() for tests

Requirements

  • PHP ^8.3
  • Laravel ^12 | ^13
  • laravel/ai ^1.2

Installation

composer require fomvasss/laravel-ai-tasks

php artisan vendor:publish --provider="Laravel\Ai\AiServiceProvider" --tag=ai-config
php artisan vendor:publish --tag=ai-tasks-config
php artisan vendor:publish --tag=ai-migrations
php artisan migrate
AI_DEFAULT=openai
OPENAI_API_KEY=sk-...

Security: the dashboard at /ai-tasks is open to anyone by default. Set dashboard.middleware to e.g. ['web', 'auth'] before deploying.

Quick start

php artisan ai:make-task SummarizeTask
use Fomvasss\AiTasks\DTO\AiPayload;
use Fomvasss\AiTasks\Tasks\AiTask;
use Laravel\Ai\Messages\UserMessage;

class SummarizeTask extends AiTask
{
    public function __construct(private readonly string $text) {}

    public function modality(): string
    {
        return 'text';
    }

    public function toPayload(): AiPayload
    {
        return new AiPayload(
            modality: 'text',
            messages: [new UserMessage("Summarize: {$this->text}")],
            systemPrompt: 'Reply in 3 sentences max.',
        );
    }
}
use Fomvasss\AiTasks\Facades\AI;

$response = AI::send(new SummarizeTask($text));   // sync
$runId = AI::queue(new SummarizeTask($text));     // queue
AI::stream(new SummarizeTask($text), fn (string $chunk) => print($chunk));

Documentation

Online: https://fomvasss.github.io/laravel-ai-tasks/ — the same pages as in docs/.

License

MIT — see LICENSE.

Support

If this package is useful to you, consider supporting its development:

Monobank Ko-Fi USDT TRC20

USDT TRC20: THLgp6DxiAtbNHvgnKV56vk1L38UuUagKf

Related Packages

Version History

Version Released PHP Laravel License
3.27.1 ^8.3 ^12.0|^13.0 MIT
3.27.0 ^8.3 ^12.0|^13.0 MIT
3.26.1 ^8.3 ^12.0|^13.0 MIT
3.26.0 ^8.3 ^12.0|^13.0 MIT
3.25.1 ^8.3 ^12.0|^13.0 MIT