1. Go to this page and download the library: Download ronu/laravel-agent-protocol library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
use Ronu\LaravelAgentProtocol\Security\AgentGuard\AgentContext;
use Ronu\LaravelAgentProtocol\Security\AgentGuard\IntentPlan;
use Ronu\LaravelAgentProtocol\Security\AgentGuard\ToolExecutionGuard;
$plan = IntentPlan::fromArray($llmOutput);
$context = new AgentContext(
userIdentifier: (string) auth()->id(),
tenantId: request()->header('X-Tenant-Id'),
locale: request()->header('Accept-Language'),
source: 'n8n',
channel: 'webhook',
permissions: ['security.user.view'],
);
$result = app(ToolExecutionGuard::class)->authorize($plan, $graph, $context);
if (! $result->allowed) {
return response()->json($result->toArray(), $result->status());
}
// The adapter may now call the real Laravel API.