jordanpartridge / laravel-ai-parallel-tools
Run opted-in tool calls from one Laravel AI agent step concurrently.
Package info
github.com/shadetheory/laravel-ai-parallel-tools
pkg:composer/jordanpartridge/laravel-ai-parallel-tools
Requires
- php: ^8.3
- illuminate/concurrency: ^12.0|^13.0
- illuminate/console: ^12.0|^13.0
- illuminate/contracts: ^12.0|^13.0
- illuminate/support: ^12.0|^13.0
- laravel/ai: ^1.3
Requires (Dev)
- laravel/pint: ^1.26
- orchestra/testbench: ^10.6|^11.0
- pestphp/pest: ^3.0|^4.0
- pestphp/pest-plugin-laravel: ^3.0|^4.0
- phpstan/phpstan: ^2.1
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-11-05 04:41:10 UTC
README
Run the tool calls from one Laravel AI step concurrently, for tools you mark with #[Concurrent].
The model chooses which tools to call, and it may return several calls in one response. This package changes how those calls are executed. The guide is Parallel Tools.
Installation
You need PHP 8.3 or newer, Laravel 12 or 13, and laravel/ai 1.3 or newer.
composer require jordanpartridge/laravel-ai-parallel-tools
Package discovery registers JordanPartridge\ParallelTools\ParallelToolsServiceProvider. This package has no configuration file.
Example
<?php namespace App\Ai\Tools; use Illuminate\Contracts\JsonSchema\JsonSchema; use JordanPartridge\ParallelTools\Attributes\Concurrent; use Laravel\Ai\Contracts\Tool; use Laravel\Ai\Tools\Request; use Stringable; #[Concurrent] class WeatherLookup implements Tool { /** * Get the description of the tool's purpose. */ public function description(): Stringable|string { return 'Look up the current weather for a city.'; } /** * Execute the tool. */ public function handle(Request $request): Stringable|string { return '72F and clear in '.$request['city']; } /** * Get the tool's schema definition. */ public function schema(JsonSchema $schema): array { return [ 'city' => $schema->string()->required(), ]; } }
<?php namespace App\Ai\Agents; use App\Ai\Tools\WeatherLookup; use Laravel\Ai\Contracts\Agent; use Laravel\Ai\Contracts\HasTools; use Laravel\Ai\Promptable; class TravelAgent implements Agent, HasTools { use Promptable; public function instructions(): string { return 'You help travelers. Use your tools, then answer.'; } public function tools(): iterable { return [ new WeatherLookup, ]; } }
use App\Ai\Agents\TravelAgent; $response = (new TravelAgent)->prompt('What is the weather in Paris and Oslo?'); return (string) $response;
If the model asks for both cities in one step, the two calls run together. The rest of the setup is in the documentation.
License
Laravel AI Parallel Tools is open-sourced software licensed under the MIT license.