fomvasss / laravel-ai-tasks
AI task orchestrator for Laravel: routing, queue, audit, budget, webhooks
3.38.1
2026-10-07 22:15 UTC
Requires
- php: ^8.3
- illuminate/contracts: ^12.0|^13.0
- illuminate/database: ^12.0|^13.0
- illuminate/events: ^12.0|^13.0
- illuminate/http: ^12.0|^13.0
- illuminate/pipeline: ^12.0|^13.0
- illuminate/queue: ^12.0|^13.0
- illuminate/support: ^12.0|^13.0
- laravel/ai: ^1.2
Requires (Dev)
- orchestra/testbench: ^10.0|^11.0
- phpunit/phpunit: ^11.0
Suggests
- aws/aws-sdk-php: Required by the bedrock driver (no longer installed by laravel/ai 1.0)
- laravel/mcp: Native MCP client support (recommended over HttpMcpClient for production use)
Provides
None
Conflicts
None
Replaces
None
- dev-master
- 3.x-dev
- 3.38.1
- 3.38.0
- 3.37.0
- 3.36.1
- 3.36.0
- 3.35.0
- 3.34.0
- 3.33.0
- 3.32.2
- 3.32.1
- 3.32.0
- 3.31.2
- 3.31.1
- 3.31.0
- 3.30.0
- 3.29.0
- 3.28.0
- 3.27.2
- 3.27.1
- 3.27.0
- 3.26.1
- 3.26.0
- 3.25.1
- 3.25.0
- 3.24.3
- 3.24.2
- 3.24.1
- 3.24.0
- 3.23.0
- 3.22.0
- 3.21.3
- 3.21.2
- 3.21.1
- 3.21.0
- 3.20.0
- 3.19.1
- 3.19.0
- 3.18.0
- 3.17.0
- 3.16.0
- 3.15.0
- 3.14.1
- 3.14.0
- 3.13.0
- 3.12.0
- 3.11.2
- 3.11.1
- 3.11.0
- 3.10.0
- 3.9.0
- 3.8.0
- 3.7.1
- 3.7.0
- 3.6.0
- 3.5.0
- 3.4.0
- 3.3.2
- 3.3.1
- 3.3.0
- 3.2.1
- 3.2.0
- 3.1.0
- 3.0.0
- 2.x-dev
- 2.1.0
- 2.0.0
- 1.x-dev
- 1.0.0
- 0.2.0
- 0.1.0
This package is auto-updated.
Last update: 2026-10-07 22:16:05 UTC
README
AI task orchestrator for Laravel. Handles routing, queuing, audit logging, budget tracking, and webhook processing on top of laravel/ai as the transport layer.
- 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-tasksis open to anyone by default. Setdashboard.middlewareto 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/.
- Installation · Configuration
- Tasks · Running tasks · Queued tasks · Driver routing
- Structured output · Tools & MCP · Tool choice & approval · Modalities
- Budgets & tenants · Cost tracking · Provider override
- Dashboard · Webhooks · Testing
- Guides: Production checklist · Chat assistant · Tools in practice · Provider quirks · Testing in practice
- Reference: AI facade · AiTask · AiPayload & AiResponse · ai_runs · Events · Commands · Providers
- Upgrading · Changelog
License
MIT — see LICENSE.
Support
If this package is useful to you, consider supporting its development:
USDT TRC20:
THLgp6DxiAtbNHvgnKV56vk1L38UuUagKf
